MATH4341: Spatio-temporal statistics
Term 2: Temporal modelling and time series analysis
Computer Lab 2: ARMA Models
Load up RStudio via your favourite method. If you can’t use RStudio for some reason, most of what we do in these labs can probably be done using WebR, but the instructions will assume RStudio. You will also want to have the web version of the lecture notes to refer to.
Question 1
Reproduce all of the plots and computations from Chapter 3 of the lecture notes by copying and pasting each code block in turn. Make sure you understand what each block is doing.
Question 2
You should have finished Question 1 by analysing the example ARMA(1,1) model from Example 3.4.2.
- In the example, 2,000 observations were simulated. Go back and simulate 5,000 observations from the model. Try both the method using
signal::filter
and the method usingarima.sim
, and verify that they are both doing essentially the same thing by looking at the ACF and PACF in both cases. - We now take this simulated data set and pretend that we don’t know how it was generated. The ACF and PACF give us some clues as to the generation mechanism, but are not conclusive. Suppose that on the basis of examining the ACF and PACF, someone suggests that an AR(3) model might be appropriate (why would they do that?). Fit an AR(3) model to this data. Referring to Chapter 4 of the notes as necessary, first fit it using moment matching, then least squares, and then finally by using the built-in
arima
function. Verify that all three methods lead to similar parameter estimates. Use the parameter estimates from thearima
function for the next part of this question. - Using
ARMAacf
, or otherwise, plot the ACF and PACF of the model fitted in the previous part. Compare them to the ACF and PACF of the true generating process (which here we know). What do you notice? - Using the
arima
function, fit the following alternative models: AR(2), AR(4), ARMA(1,1), ARMA(2,1). How would you go about choosing between all of the fitted models if you didn’t know the true generating mechanism? There is no single right answer to this question, but it might be interesting to study the residuals from the fitted models.