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=\mu * \left\{ x_n
\right\}_{1 \leq n \leq N}, x_1 = \sigma * u_1 /
\sqrt{1-\rho^2}, x_n=\rho * x_{n-1} + \sigma * u_n
x = AR1()
plot(x,type='l',col=rgb(.5,0,0,.5))