Lab: ARMA(p,q) Model Fitting


Getting Started

Start R

R function: ar, arima, tsdiag

> help(ar)

> help(arima)


Example 1: Simulate an AR(1) process and fit an AR(1) model to your simulated data.

You can fit with both the ar and arima functions!

How do the diagnostic plots look?

For model diagnostics for arima function try:

> tsdiag(fit)


Example 2: Luteinizing Hormone Data

> help(lh)

Let's look at the sample code in lh1.r

What models would you try to fit?

Let's look at the sample code in lh2.r

Which is the best model?

For a more complete dataset: diggle



Example 3: Repeat: Simulate an AR(1) process and fit an AR(1) model to your simulated data.

You can fit with both the ar and arima functions!

How do the diagnostic plots look?

For model diagnostics for arima function try:

> tsdiag(fit)

To make a Normal Q-Q plot of the residuals:

> qqnorm(fit$residuals)
> qqline(fit$residuals)

Do the residuals appear to look normally distributed?

Just for fun: Simulate an AR(2) process and fit an AR(1) model to your simulated data.
Make diagnotic plots. How do the plots look?


Example 4: Case Study: TSA color dataset

(a) Let's see if we can use the TSA R package and produce the plots in Chapter 1 from: Text Book webpage

These are: Exhibit 1.3 and Exhibit 1.4

(b) Make an ACF and PACF plot of the color dataset. What model(s) would you fit to the data?

(c) Fit the above models and make diagnostic plots with tsdiag function and examine the normal Q-Q plot of the residuals. How well does the model fit the data?

(d) What is the AIC of the model(s)?


Example 5: Case Study: TSA oil.price dataset