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("http://www.rohan.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)

> help(arima)


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?

For model diagnostics for arima function try:

> tsdiag(sunfit2)


Example 2: 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 3: 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