Start R
R function: ar, arima, tsdiag
> help(ar)
> help(arima)
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?
> 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
(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)?