# Distribution of infinite sum $\sum_{t=0}^{\infty} \epsilon_t r^t$

In my current statistics course we're being taught about time series, and in this context we came across sums like this: $$\sum_{t=1}^{\infty} \epsilon_t r^t \quad \epsilon_t\sim \text{WN}(0,\sigma^2) \quad |r|<1$$ Where the $$r$$ is originally a $$\phi$$, representing the coefficients in a model as: $$y_t=c+\phi y_{t-1}+\epsilon_t$$, and WN stands for white noise with mean 0 and variance $$\sigma^2$$.

I'm interested in studying the expected value and variance of that sum, call it $$S(r)$$. The problem that brings me here is the following: i wrote a little program in STATA to calculate many sums and show me the variance, and it doesn't align with my calculations (the expected value does seem to be OK though) ... why?

I calculated the following: $$E(S)=E\left(\sum_{t=1}^{\infty} \epsilon_t r^t \right)=\sum_{t=1}^{\infty} E(\epsilon_t r^t)=\sum_{t=1}^{\infty} E(\epsilon_t) r^t=\sum_{t=1}^{\infty} 0 r^t=0$$ $$V(S)=V\left(\sum_{t=1}^{\infty} \epsilon_t r^t \right)=\sum_{t=1}^{\infty} V(\epsilon_t r^t)=\sum_{t=1}^{\infty} V(\epsilon_t) r^t=\sum_{t=1}^{\infty} \sigma^2 r^t=\sigma^2 \sum_{t=1}^{\infty} r^t=\sigma^2 \frac{r}{1-r}$$

And the code

    clear all
program define geos, rclass
drop _all
set obs 500
gen a=invnorm(uniform())
gen y=_n
scalar define r=0.8
gen u=r^y
gen x=a*u
sum x
return scalar s=sum(x)
end
simulate S=r(s), reps(5000): geos
program drop _all
sum S, det
cd "C:\Users\Federico\Desktop\Geosum"
kdensity S, saving(Sum_80.png) title(80)


where $$\epsilon_t\sim N(0,1)$$ for simplicity. But doing this for various values of r, and regressing the variance as a function of r, i get $$\hat{var}_i=0.92r_i^2$$ (the r term and the constant are not significant, so i omitted them).

As an aside: i would like to "complete" the program so it runs for different values of r, and then saves the variance, instead of me running it various times and changing the value of r each time. I tried using "forvalues" but didn't succeed. Does anyone have a suggestion as to how i could do that?

• The aside part is off-topic here. – Dimitriy V. Masterov Nov 13 '17 at 17:17

$$V(\epsilon_tr^t)=V(\epsilon_t)r^{2t}.$$
$$\sigma^2\frac{r^2}{1-r^2}.$$