Time Series Trend Calculator Formula
Understand the math behind the time series trend calculator. Each variable explained with a worked example.
Formulas Used
Trend Slope (per period)
trend_slope = slopeTrend Intercept
trend_intercept = interceptForecast Period 6
next_forecast = intercept + slope * 6Average Value
avg_value = sum_y / 5Variables
| Variable | Description | Default |
|---|---|---|
y1 | Period 1 Value | 100 |
y2 | Period 2 Value | 108 |
y3 | Period 3 Value | 115 |
y4 | Period 4 Value | 120 |
y5 | Period 5 Value | 130 |
sum_y | Derived value= y1 + y2 + y3 + y4 + y5 | calculated |
sum_xy | Derived value= 1*y1 + 2*y2 + 3*y3 + 4*y4 + 5*y5 | calculated |
sum_x | Derived value= 15 | calculated |
sum_x2 | Derived value= 55 | calculated |
n | Derived value= 5 | calculated |
slope | Derived value= (5 * sum_xy - 15 * sum_y) / (5 * 55 - 225) | calculated |
intercept | Derived value= (sum_y - slope * 15) / 5 | calculated |
How It Works
How to Estimate a Time Series Trend
Method
Fit a least-squares regression line Y = a + b*t where t is the time period (1, 2, 3, ...). The slope b is the average change per period. The intercept a is the estimated value at t=0. Extrapolating the line gives forecasts for future periods.
Slope b = [n*Sum(t*y) - Sum(t)*Sum(y)] / [n*Sum(t^2) - (Sum(t))^2]
Worked Example
Five periods with values 100, 108, 115, 120, 130.
y1 = 100y2 = 108y3 = 115y4 = 120y5 = 130
- 01Sum(y) = 573, Sum(t) = 15, Sum(t^2) = 55
- 02Sum(t*y) = 1*100 + 2*108 + 3*115 + 4*120 + 5*130 = 1791
- 03Slope = (5*1791 - 15*573) / (5*55 - 225) = (8955-8595)/50 = 7.2
- 04Intercept = (573 - 7.2*15)/5 = (573 - 108)/5 = 93
- 05Forecast for period 6: 93 + 7.2*6 = 136.2
Ready to run the numbers?
Open Time Series Trend Calculator