1
$\begingroup$

I want to calculate the degree of slope at each point in a time series. Different time series have different scales. The final number should be normalized in the range of +/-90 degrees. Basically, when I plot my time series in Excel, I can see the degree of slope up or down, 0=flat, 70=very steep up, -20=gradual slope down. I want to calculate the "number" for what I am seeing.

I thought using the arctangent(P-P1), P=current point, P1=previous point would work. Not at all. For example on one time series: atan(1.166031374-1.168266667) yields -0.00224. On another times series, atan(11373.92-11342.05) = 1.539431. Certainly not normalized across different value scales nor producing values between +/-90.

Visually, it’s so easy to see the degree of slope in my chart! Yet, over the last year I’ve tried more than a hundred work arounds, mostly complex. They approximate what I want but seem very convoluted and inelegant. I’d appreciate any insights into solving this problem.

$\endgroup$
  • 1
    $\begingroup$ I have been plagued by the same problem for a few months now and I sort of came up with a solution. Calculate percentage changes of the time series' and the perform regression with respect to time coordinates. This should give you a slope coefficient which I think can be compared between different time series since the unit of the slope coefficient would be %. I am not strong when it comes to statistics but explained in plain terms, it feels like this might work for the purpose of comparing slopes of two different time series'. Please do let me know if I have got something wrong about this. (I $\endgroup$ – Kanmani Aug 23 '18 at 8:33
  • $\begingroup$ This question conflates the visual impression with trends in the data in an unhelpful way. The visual impression is hugely driven by features of the plot, rather than features of the data. Consider that changing the scale of either axis will change the visual impression of the slope without any change in the data. $\endgroup$ – mkt - Reinstate Monica Aug 23 '18 at 12:11
2
$\begingroup$

This looks like an old question, but I'm surprised that nobody has pointed out that it's not even well-defined.

By basic trigonometry, the angle between one point of a time series, $y_i$ at time $t_i$, and the next, $y_{i+1}$ and time $t_{i+1}$, would be

$\theta = \arctan\left(\frac{y_{i+1}-y_{i}}{t_{i+1}-t_{i}}\right)$

but the quantity in parenthesis is not unitless. The angle $\theta$ therefore changes, and not even linearly, if you change the scale of $y$ (e.g. from dollars to thousands of dollars, or meters to feet) or the scale of $t$ (e.g., from seconds to weeks).

Worse, there is always some sort of scaling involved when translating from data to a graph (which is "what you see"), so even if $y$ and $t$ have the same units, the computed angle won't correspond to the perceived angle unless the graph is created with a 1:1 aspect ratio between the axes.

| cite | improve this answer | |
$\endgroup$
1
$\begingroup$

You'd better standardizing the slope coefficients (regression on standardized values produces standardzied coefficients) than this. The angle of a slope does not move in the same manner throughout the scale of -90 to 0 to 90deg (see when you switch x axis for y) and can't be vertical by definition of a function.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you for your assistance. I appreciate it. If by "standardizing" you mean normalizing the value based on historical values, I've tried that. For example, by using a simple max/min over that last 50 periods or a standard deviation calculation over some time period. I was hoping for something a bit more roboust. Or maybe I do not understand what you are saying. Could you be more explicit or an example please? $\endgroup$ – expertalmost Feb 25 '14 at 10:38
  • $\begingroup$ I mean standardizing the series to norm(0,1) by taking logs where necessary and then apply (x[i]-mean(x))/sd(x) to each value. Then proceed with regression. The coefficients at the linear parameter will be standardized in a way that it would allow for comparison with other slopes. $\endgroup$ – Germaniawerks Feb 26 '14 at 8:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.