CommencerCommencer gratuitement

Compute the ACF for Several MA Time Series

Unlike an AR(1), an MA(1) model has no autocorrelation beyond lag 1, an MA(2) model has no autocorrelation beyond lag 2, etc. The lag-1 autocorrelation for an MA(1) model is not \(\small \theta\), but rather \(\small \theta / (1+\theta^2)\). For example, if the MA parameter, \(\small \theta\), is = +0.9, the first-lag autocorrelation will be \(\small 0.9/(1+(0.9)^2)=0.497\), and the autocorrelation at all other lags will be zero. If the MA parameter, \(\small \theta\), is -0.9, the first-lag autocorrelation will be \(\small -0.9/(1+(-0.9)^2)=-0.497\).

You will verify these autocorrelation functions for the three time series you generated in the last exercise.

Cet exercice fait partie du cours

Time Series Analysis in Python

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Import the plot_acf module from statsmodels
from statsmodels.graphics.tsaplots import plot_acf

# Plot 1: MA parameter = -0.9
plot_acf(___, lags=20)
plt.show()
Modifier et exécuter le code