AR1 {codadiags} | R Documentation |
Generate auto-regressive order 1 sequence
AR1(length = 1000, mean = 0, sd = 1, rho = 0.1, rand = function() { rnorm(1) })
length |
size of the sequence |
mean |
mean value of the sequence μ |
sd |
standard deviation of the sequence σ |
rho |
auto-correlation factor |
rand |
function to generate one random step |
Auto Regressive ("AR") sequence
X=μ * ≤ft\{ x_n \right\}_{1 ≤q n ≤q N}, x_1 = σ * u_1 / √{1-ρ^2}, x_n=ρ * x_{n-1} + σ * u_n
x = AR1() plot(x,type='l',col=rgb(.5,0,0,.5))