# What is the relationship between average of a rolling intercept and the intercept from a regression over the entire period?

If i calculate rolling (e.g. 3 periods back) intercepts for a time series using OLS, is the average of these rolling intercepts then in some way related to the intercept from an OLS of the entire series?

Below is an example - the average of the rolling intercepts is 1.05, while the intercept from regression on the whole series is 2.21.

• Contemplate this: add a huge value $a$ to $y_3$ and subtract $a$ from $y_9.$ Consider the effects this will have on the mean of the rolling intercepts and the overall intercept. – whuber Nov 15 '19 at 14:03
• I cannot reproduce your rolling intercepts. Could you explain how you are computing them? – whuber Nov 20 '19 at 20:37
• In excel: INTERCEPT([2.03, 2.27, 2.43], [1.85,1.83, 1.57])=4.11 – jthg Nov 21 '19 at 8:04
• And then just pull down the formula, so each intercept is based on the last 3 values of x and y – jthg Nov 21 '19 at 8:17
• That's a pretty good summary. The nature of these "outliers" matters, though: the principle is that when you change the value of a response (y) near one extreme of the regressor (x), the fitted line will change greatly, but when you change the response near the mean of the regressors, the fitted line may change little. Indeed, in your data there are two pairs with identical regressor values; changing the responses without changing the average response within a pair doesn't change the overall fitted line whatsoever--but it can change some of the running fits dramatically. – whuber Nov 21 '19 at 16:08

There is no direct relationship between these two estimation methods, and their interaction depends on the underlying data in a complex way. To see this, we can derive the formulae for the two estimators. Using the whole dataset, the OLS intercept estimator in simple linear regression can be written as:

$$\hat{\beta}_0 = \frac{1}{n} \sum_{i=1}^n \Bigg[ y_i - x_i \cdot \frac{(\sum_{i=1}^n x_i y_i) - \tfrac{1}{n} (\sum_{i=1}^n x_i) (\sum_{i=1}^n y_i)}{(\sum_{i=1}^n x_i^2) - \tfrac{1}{n} (\sum_{i=1}^n x_i)^2} \Bigg].$$

Suppose you have $$n$$ data points and you compute the average of the rolling-intercepts, each with a window of $$m data points. For each $$k=0,...,n-m$$ the individual OLS rolling-intercepts (each taken over values $$i = k+1,...,k+m$$) can be written as:

\begin{aligned} \hat{\beta}_0^{(k)} &=\frac{1}{m} \sum_{i=k+1}^{k+m} \Bigg[ y_i - x_i \cdot \frac{(\sum_{i=k+1}^{k+m} x_i y_i) - \tfrac{1}{m} (\sum_{i=k+1}^{k+m} x_i) (\sum_{i=k+1}^{k+m} y_i)}{(\sum_{i=k+1}^{k+m} x_i^2) - \tfrac{1}{m} (\sum_{i=k+1}^{k+m} x_i)^2} \Bigg]. \\[6pt] \end{aligned}

Taking the average of these rolling-intercepts gives:

\begin{aligned} \hat{\beta}_0^* &\equiv \frac{1}{n-m} \sum_{k=0}^{n-m} \hat{\beta}_0^* \\[6pt] &= \frac{1}{m(n-m)} \sum_{k=0}^{n-m} \sum_{i=k+1}^{k+m} \Bigg[ y_i - x_i \cdot \frac{(\sum_{i=k+1}^{k+m} x_i y_i) - \tfrac{1}{m} (\sum_{i=k+1}^{k+m} x_i) (\sum_{i=k+1}^{k+m} y_i)}{(\sum_{i=k+1}^{k+m} x_i^2) - \tfrac{1}{m} (\sum_{i=k+1}^{k+m} x_i)^2} \Bigg] \\[6pt] &= \frac{1}{m(n-m)} \sum_{i=1}^{m} \sum_{k=\max(0,i-m)}^{\min(n-m,i-1)} \Bigg[ y_i - x_i \cdot \frac{(\sum_{i=k+1}^{k+m} x_i y_i) - \tfrac{1}{m} (\sum_{i=k+1}^{k+m} x_i) (\sum_{i=k+1}^{k+m} y_i)}{(\sum_{i=k+1}^{k+m} x_i^2) - \tfrac{1}{m} (\sum_{i=k+1}^{k+m} x_i)^2} \Bigg]. \\[6pt] \end{aligned}

As can be seen, this second estimator has a complicated form, and does not reduce to a function of the OLS estimator for the whole dataset.