ergMean: Compute the ergodic (running) mean.

Description Usage Arguments Value Examples

View source: R/helper_functions.R

Description

Compute the ergodic (running) mean.

Usage

1

Arguments

x

vector for which to compute the running mean

Value

A vector y with each element defined by y[i] = mean(x[1:i])

Examples

1
2
3
4
5
6
7
8
# 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)

drkowal/dfosr documentation built on May 7, 2020, 3:09 p.m.