Estimate the simple moving average model
Now that you've simulated some MA models and calculated the ACF from these models, your next step is to fit the simple moving average (MA) model to some data using the arima()
command. For a given time series x
we can fit the simple moving average (MA) model using arima(..., order = c(0, 0, 1))
. Note for reference that an MA model is an ARIMA(0, 0, 1) model.
In this exercise, you'll practice using a preloaded time series (x
, shown in the plot on the right) as well as the Nile
dataset used in earlier chapters.
Este ejercicio forma parte del curso
Time Series Analysis in R
Instrucciones del ejercicio
- Use
arima()
to fit the MA model to the seriesx
. - What are the slope (
ma1
), mean (intercept
), and innovation variance (sigma^2
) estimates produced by yourarima()
output? Paste these into your workspace. - Use a similar call to
arima()
to fit the MA model to theNile
data. Save the results asMA
and useprint()
to display the output. - Finally, use the pre-written commands to plot the
Nile
data and your fitted MA values.
Ejercicio interactivo práctico
Prueba este ejercicio completando el código de muestra.
# Fit the MA model to x
arima(___, order = ___)
# Paste the slope (ma1) estimate below
# Paste the slope mean (intercept) estimate below
# Paste the innovation variance (sigma^2) estimate below
# Fit the MA model to Nile
MA <- arima(___, order = ___)
print(MA)
# Plot Nile and MA_fit
ts.plot(Nile)
MA_fit <- Nile - resid(MA)
points(MA_fit, type = "l", col = 2, lty = 2)