ergMean | R Documentation |
Compute the ergodic (running) mean.
ergMean(x)
x |
vector for which to compute the running mean |
A vector y
with each element defined by y[i] = mean(x[1:i])
# Compare:
ergMean(1:10)
mean(1:10)
# Running mean for iid N(5, 1) samples:
x = rnorm(n = 10^4, mean = 5, sd = 1)
plot(ergMean(x))
abline(h=5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.