MulaiMulai sekarang secara gratis

Fit a pure seasonal model

As with other models, you can fit seasonal models in R using the sarima() command in the astsa package.

To get a feeling of how pure seasonal models work, it is best to consider simulated data. We generated 250 observations from a pure seasonal model given by $$X_t = .9 X_{t-12} + W_t + .5 W_{t-12}\,,$$ which we would denote as a SARMA(P = 1, Q = 1)S = 12. Three years of data and the model ACF and PACF are plotted for you.

You will compare the sample ACF and PACF values from the generated data to the true values displayed.

The astsa package is preloaded for you and the generated data are in x.

Latihan ini adalah bagian dari kursus

ARIMA Models in R

Lihat Kursus

Petunjuk latihan

  • Use acf2() to plot the sample ACF and PACF of the generated data to lag 60 and compare to actual values. To estimate to lag 60, set the max.lag argument equal to 60.
  • Fit the model to generated data using sarima(). In addition to the p, d, and q arguments in your sarima() command, specify P, D, Q, and S (note that R is case sensitive).

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Plot sample P/ACF to lag 60 and compare to the true values
acf2(___, max.lag = ___)

# Fit the seasonal model to x
sarima(x, p = 0, d = 0, q = 0, P = ___, D = 0, Q = ___, S = ___)
Edit dan Jalankan Kode