Exercise

# Simulate AR(1) Time Series

You will simulate and plot a few AR(1) time series, each with a different parameter, \(\small \phi\), using the `arima_process`

module in statsmodels. In this exercise, you will look at an AR(1) model with a large positive \(\small \phi\) and a large negative \(\small \phi\), but feel free to play around with your own parameters.

There are a few conventions when using the `arima_process`

module that require some explanation. First, these routines were made very generally to handle both AR and MA models. We will cover MA models next, so for now, just ignore the MA part. Second, when inputting the coefficients, you must include the zero-lag coefficient of 1, and the sign of the other coefficients is opposite what we have been using (to be consistent with the time series literature in signal processing). For example, for an AR(1) process with \(\small \phi=0.9\), the array representing the AR parameters would be `ar = np.array([1, -0.9])`

Instructions

**100 XP**

- Import the class
`ArmaProcess`

in the`arima_process`

module. - Plot the simulated AR processes:
- Let
`ar1`

represent an array of the AR parameters [1, \(\small -\phi\)] as explained above. For now, the MA parameter array,`ma1`

, will contain just the lag-zero coefficient of one. - With parameters
`ar1`

and`ma1`

, create an instance of the class`ArmaProcess(ar,ma)`

called`AR_object1`

. - Simulate 1000 data points from the object you just created,
`AR_object1`

, using the method`.generate_sample()`

. Plot the simulated data in a subplot.

- Let
- Repeat for the other AR parameter.