## Front Cover

## Other Information

## Errata & Clarifications

## Diving for Pearls _{*}

## Getting Started With R

- To download R, go to CRAN. The installation includes help files and some user manuals. In addition, you can find helpful tutorials by following CRAN's link to Contributed Documentation. There's also a lot of advice out there in cyberspace, but some of it will be outdated because R goes through many revisions.
- Here's a little tutorial on R and time series analysis: an R time series quick fix.
- Here are some issues we have with R and time series analysis:
R issues.

## Data Files

The data files below are listed according to the chapter in which they are first presented. Most of the data files are one long column, even if they contain more than one series. Some data files are in multicolumn formats. It would be a good idea to look at the file before you use it. As you can see, the data files have .dat extensions, but they are ascii files that can be opened with any text editor (like notepad).

CHAPTER 1 eq5exp6.dat fmri.dat globtemp.dat jj.dat nyse.dat recruit.dat soi.dat soiltemp.dat speech.dat |
CHAPTER 2 cmort.dat gas.dat oil.dat part.dat temp.dat varve.dat |
CHAPTER 3 ar1boot.dat birth.dat globtemp2.dat gnp96.dat prod.dat so2.dat unemp.dat |
CHAPTER 4 salt.dat sunspots.dat |

CHAPTER 5 flu.dat fracdiff.dat lead.dat sales.dat sdyr.dat |
CHAPTER 6 ar1miss.dat Folland.dat HL.dat Jones.dat Newbold.dat |
CHAPTER 7 beamd.dat bnrf1ebv.dat bnrf1hvs.dat ch7fmri.dat clim-hyd.dat econ5.dat eq+exp.dat |
EVERYTHING data.zip (for windows) data.tar.gz (for unix) |

## R Code That May Be Useful for Class

- Here's a list of the R code used in the examples in Chapters 1 to 5: R code used in the text.
- For Chapter 2, you can save yourself time and headaches
by installing and using the R package
dynlm.
You can find an example in our little
tutorial
just following the
`lm()`example. - To use the R scripts listed below,
you have to
**source**them first. The basic idea is you can have any number of R commands in an external file and you can execute them at any time by*reading*the file into R. This can be done by cutting-and-pasting the commands into R, or by*sourcing*the file, say ‘commands.R’, by issuing the command`source("commands.R")`. For Windows, Source is available on the File menu. Here's a little movie that shows how to source code: start the show -
**Get it all:**You can get all of the code listed below in one file: itall.R. Just download the file to a convenient location and then source it... you'll get`lag.plot2`,`acf2`,`sarima`, and`sarima.for`in one swell foop! More details and some examples follow: - In Chapter 2, Example 2.6, there's code to duplicate Figure 2.8, the lag plots of
one series versus another. I made that into an R function
called lag.plot2.R.
The call to the function is
`lag.plot2(x1,x2,m)`and the result is a grid of scatterplots of x1(t-h) versus x2(t) for h = 0, 1,..., m; that is, the first series is the one that gets lagged. For example,`lag.plot2(soi,rec,8)`will reproduce Figure 2.8. - To help with modeling in Chapter 3, here's an R function that will plot the ACF and PACF of a time series
at the same time on the SAME SCALE, and it leaves out the zero lag in the ACF:
acf2.R.
If your time series is
in x and you want the ACF and PACF of x to lag 50,
the call to the function is
`acf2(x,50)`. The number of lags is optional, so`acf2(x)`will use a default number of lags [√*n*+ 10, where*n*is the number of observations]. - We also have something that makes it easier
to fit ARIMA models (both seasonal and non-seasonal).
For lack of a better name, it's called sarima:
sarima.R.
If your time series is in x and you want to fit an ARIMA(p,d,q) model to your data, the call is
`sarima(x,p,d,q)`. The results are the parameter estimates, standard errors, AIC, AICc, BIC (as defined in Chapter 2) and diagnostics. To fit a seasonal ARIMA model, the call is`sarima(x,p,d,q,P,D,Q,s)`. So, for example,`sarima(x,2,1,0)`will fit an ARIMA(2,1,0) model to the series in x, and`sarima(x,2,1,0,0,1,1,12)`will fit a seasonal ARIMA(2,1,0)×(0,1,1)_{12}model to the series in x. - If you want to obtain forecasts after a suitable model is chosen, you can use
sarima.for.R in a similar manner to
sarima.
The call for the non-seasonal case is
`sarima.for(x,n.ahead,p,d,q)`and the call for the seasonal case is`sarima.for(x,n.ahead,p,d,q,P,D,Q,s)`, where`n.ahead`specifies the number of steps ahead you want to forecast. The code will also produce a graph of the last 100 points of the series and the forecasts with prediction error bounds (2 PEs).

You can find some examples here. You might want to read the first three issues listed in R time series issues for some additional information.

## R Code and Examples for Chapter 6

... has been moved to Chapter 6 R Scripts and Examples## R and Matlab Code and Examples for Chapter 7

... was never here in the first place and it's still not here. But you can find it at Chapter 7 Code and Examples## ASTSA

ASTSA is
a Windows time series package that is
distributed as Freeware and is provided “As is”
without warranty of any kind, either expressed or
implied. ASTSA may not be distributed as a component
of any commercial product without a prior license
agreement with the authors. If you do not agree with
these terms, do not download the program.
**If you have questions about ASTSA, please contact
RHS.
Just so you know, ASTSA was written in Visual Basic 3, so it's a 16-bit
application (think Windows 3.1). It seems to have held up and runs on XP
with high probability. It's anyone's guess if it will run on Vista.
ASTSA hasn't been supported for a long time, and there won't be any updates.
**

- To install ASTSA, download ASTSAsetup.exe (less than 1 mb) to your desktop and run the setup program.
- If you prefer, you can get ASTSA in a zipped archive: astsa.zip. Just download astsa.zip, unzip it to a convenient location, and put a shortcut to astsa.exe on your desktop and/or your start menu.
- You can uninstall the program by simply deleting the ASTSA directory and any shortcuts that were created. ASTSAsetup puts one shortcut on the desktop and another on the Start-Programs menu.
- You might also want the ASTSA manual. Many of the data sets used in the text are included with ASTSA - click here for details.

## STuFF - LinKs and Other Useful Info

- To request an evaluation copy of the text or to request an instructor's manual, follow this link to Springer. This will take you to the site for North America. You can select a different region from a menu at the top of the page.
- Here are more time series data sets (these are from Jon Cryer's text).
- If you are still data hungry, you can find lots of time series data here:
StatLib
Datasets. Just search on key words
*time series*. - Anthony Brockwell has an open source time series package that runs on Windows and Linux called Cronos. You can use it to fit ARIMA, ARFIMA, GARCH, and Stochastic Volatility models using both Bayesian and frequentist analyses.
- There are at least three R packages that facilitate state space modeling: DLM, DSE, and SSPIR.
- Our web pages render beautifully with Firefox: