SimulateAR1 {pRSR} | R Documentation |
An AR(1) series with mean zero and variance 1 and with autocorrelation paramater phi is simulated.
SimulateAR1(n, phi)
n |
length of series |
phi |
autocorrelation parameter |
The model equation is:
z[t] = phi*z[t-1]+a[t],
where z[1] is N(0,1) and a[t] are NID(0, siga),
siga=\sqrt(1/(1-phi^2))
.
autocorrelated time series of length n
e<-SimulateAR1(10^4, phi=0.8)
mean(e)
sd(e)
acf(e, lag.max=5, plot=FALSE)