Hello.. I have a difficulty in calculating with stata the following formula.

yt= bo + xt with rolling way t=1~39, 2~40, ..... 129~167

Here, rolling way means "estimate is applied over a given data sample and the sample is moved up or "rolled" forward one observation. This process continues until all observations are exhausted. "

Basically, the b0 is yt-xt and the estimated bo is the average of yt-xt t=1~39, 2~40, ..... 129~167.

there will be total 129 estimated bo.

and for each 129 estimated bo, there will be 39 residuals. (so total 129 * 39 = 5031)

If anyone can give me some help with coding this formula, I would really appreciate it.

Thank you!