Compare the random walk (RW) and autoregressive (AR) models
The random walk (RW) model is a special case of the autoregressive (AR) model, in which the slope parameter is equal to 1
. Recall from previous chapters that the RW model is not stationary and exhibits very strong persistence. Its sample autocovariance function (ACF) also decays to zero very slowly, meaning past values have a long lasting impact on current values.
The stationary AR model has a slope parameter between -1 and 1. The AR model exhibits higher persistence when its slope parameter is closer to 1, but the process reverts to its mean fairly quickly. Its sample ACF also decays to zero at a quick (geometric) rate, indicating that values far in the past have little impact on future values of the process.
In this exercise, you'll explore these qualities by simulating and plotting additional data from an AR model.
Este ejercicio forma parte del curso
Time Series Analysis in R
Instrucciones del ejercicio
- Use
arima.sim()
to simulate 200 observations from an AR model with slope0.9
. Save this tox
. - Use
ts.plot()
to plotx
and useacf()
to view its sample ACF. - Now do the same from an AR model with slope
0.98
. Save this toy
. - Now do the same from a RW model (
z
), and compare the time series and sample ACFs generated by these three models.
Ejercicio interactivo práctico
Prueba este ejercicio completando el código de muestra.
# Simulate and plot AR model with slope 0.9
x <- arima.sim(model = ___, n = ___)
ts.plot(___)
acf(___)
# Simulate and plot AR model with slope 0.98
y <-
ts.plot(___)
acf(___)
# Simulate and plot RW model
z <-
ts.plot(___)
acf(___)