Stats 4540/6571 Some Splus Commands for Creating, Plotting Time Series NOTE: If you want some information on working in Splus, you can check the following website www.math.mun.ca/~sneddon/st4590 In particular, you can look at the links on "Splus help" and the "lab sessions". The following Splus commands were used to generate the attached plots. Key commands: cts (calendar time series) rts (regularly spaced time series) tsplot (plot a time series) ####################### par(mfrow=c(3,1)) plot(fruitimp.vec, type = 'l', xlab = "Time", ylab = "Million $") mtext("Canadian Monthly Fruit Imports, 1980-2001") fruitimp.ts <- cts(fruitimp.vec, start = dates("01/01/1980"), units = "months") # Another way to create the time series, using rts # fruitimp.ts <- rts(fruitimp.vec, start = c(1980, 1), frequency = 12) tsplot(fruitimp.ts) mtext("Canadian Monthly Fruit Imports, using cts and tsplot") fruitimp.ts.small <- cts(fruitimp.vec[1:48], start = dates("01/01/1980"), units = "months") tsplot(fruitimp.ts.small) mtext("Canadian Monthly Fruit Imports, 1980-1984") ########################################################### par(mfrow =c (2,1)) # Time series of the Southern Oscillation Index (SOI). This is the # indicator of the atmospheric phenomenon El Nino. It is the pressure # difference between Darwin, Australia and Tahiti. soi.vec.ts <- cts(soi.vec,start=("01/01/1882"), units = "months") mtext("Southern Oscillation Index (El Nino)") tsplot(soi.vec.ts) Nice plot?? # Let's look at last 22 months of data: tsplot(soi.vec.ts[1200:1464]) mtext("Southern Oscillation Index (El Nino)")