Example:

Suppose \(Y^{b}\sim{\rm \mathcal{N}(0,1^{2})}\).

Let’s draw a sample of size 500 from our population.

B = 500
Y = rnorm(B, mean = 0, sd = 1)

The mean etahat is given by \[\hat{\eta}_{B} = \frac{1}{B}\sum_{b=1}^{B}Y^{b}\]

etahat = mean(Y)
etahat
## [1] 0.06913924
etahat.all = cumsum(Y)/c(1:B) 

plot(etahat.all, col = "red", type = "l", lwd = 2,)
abline(h = 0)