Appendix: R Packages

R is a free software available from http://www.r-project.org. One can click CRAN on its Web page to select a nearby CRAN Mirror to download and install the software and selected packages. For financial time series analysis, the Rmetrics of Diethelm Wuertz and his associates have produced many useful packages, including fBasics, timeSeries, fGarch, etc. We use many functions of these packages in this book. Further information concerning installing R and the commands used can be found either on the Web page of this book or on the author's teaching Web page.

R and S-Plus are objective-oriented software. They enable users to create many objects. For instance, one can use the command ts to create a time series object. Treating time series data as a time series object in R has some advantages, but it requires some learning to get used to it. It is, however, not necessary to create a time series object in R to perform the analyses discussed in this book. As an illustration, consider the monthly simple returns to the General Motors stock from January 1975 to December 2008; see Exercise 1.2. The data have 408 observations. The following R commands are used to illustrate the points:

> da=read.table(“m-gm3dx7508.txt”,header=T)  % Load data

> gm=da[,2]     % Column 2 contains GM stock returns  

> gm1=ts(gm,frequency=12,start=c(1975,1))

% Creates a ts object.

> par(mfcol=c(2,1))   % Put two plots on a page.

> plot(gm,type=‘l’)

> plot(gm1,type=‘l’)

> acf(gm,lag=24)

> acf(gm1,lag=24) ...

Get Analysis of Financial Time Series, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.