Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Time Series Analysis in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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()
Code bewerken en uitvoeren