1. Learn
  2. /
  3. Courses
  4. /
  5. Time Series Analysis in Python

Exercise

Simulate MA(1) Time Series

You will simulate and plot a few MA(1) time series, each with a different parameter, \(\small \theta\), using the arima_process module in statsmodels, just as you did in the last chapter for AR(1) models. You will look at an MA(1) model with a large positive \(\small \theta\) and a large negative \(\small \theta\).

As in the last chapter, when inputting the coefficients, you must include the zero-lag coefficient of 1, but unlike the last chapter on AR models, the sign of the MA coefficients is what we would expect. For example, for an MA(1) process with \(\small \theta=-0.9\), the array representing the MA parameters would be ma = np.array([1, -0.9])

Instructions

100 XP
  • Import the class ArmaProcess in the arima_process module.
  • Plot the simulated MA(1) processes
    • Let ma1 represent an array of the MA parameters [1, \(\small \theta\)] as explained above. The AR parameter array will contain just the lag-zero coefficient of one.
    • With parameters ar1 and ma1, create an instance of the class ArmaProcess(ar,ma) called MA_object1.
    • Simulate 1000 data points from the object you just created, MA_object1, using the method .generate_sample(). Plot the simulated data in a subplot.
  • Repeat for the other MA parameter.