Get startedGet started for free

Fitting an ARMA model

You are now ready to merge the AR model and the MA model into the ARMA model. We generated data from the ARMA(2,1) model, $$X_t = X_{t-1} - .9 X_{t-2} + W_t + .8 W_{t-1}, $$ x <- arima.sim(model = list(order = c(2, 0, 1), ar = c(1, -.9), ma = .8), n = 250). Look at the simulated data and the sample ACF and PACF pair to determine a possible model.

Recall that for ARMA(\(p, q\)) models, both the theoretical ACF and PACF tail off. In this case, the orders are difficult to discern from data and it may not be clear if either the sample ACF or sample PACF is cutting off or tailing off. In this case, you know the actual model orders, so fit an ARMA(2,1) to the generated data. General modeling strategies will be discussed further in the course.

This exercise is part of the course

ARIMA Models in R

View Course

Exercise instructions

  • The package astsa is preloaded. 250 ARMA(2,1) observations are in x.
  • As in the previous exercises, use plot() to plot the generated data in x and use acf2() to view the sample ACF and PACF pairs.
  • Use sarima() to fit an ARMA(2,1) to the generated data. Examine the t-table and compare the estimates to the true values.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# astsa is preloaded

# Plot x


# Plot the sample P/ACF of x


# Fit an ARMA(2,1) to the data and examine the t-table

Edit and Run Code