Lab: ARIMA(p,d,q) Model Fitting


Getting Started

Start R


Reading in data into R from a file

There is time series data in a file test.series

You can use the scan and ts R commmands to read and make your data an object of class time series.

> test <- scan("https://edoras.sdsu.edu/~babailey/stat673/test.series")
> test.ts <- ts(test)

Now, you can make all the appropriate time series plots!
What model would you fit to the data?


R function: ar, arima, tsdiag

> help(ar)

Let's run one of the examples in the help function!

How about,
> ar(lh)

> help(arima)

As far as I can tell, there are no model diagnostics for ar. What should you look for?


Example 1: Model Identification and Fitting

Simulate and fit ARIMA(2,1,2)

Let's look at sample code in arimasim.r

How well did the model fit the data?

What are the estimated parameters?


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 1: Monthly Sunspot Data, AR(p)

> help(sunspots)
> help(sunspot.month)

Let's look at sample code in sunspot.r

As far as I can tell, there are no model diagnostics for ar. What should you look at?

Fit a model with the arima Call the fit sunfit2 For model diagnostics for arima function try:

> tsdiag(sunfit2)