next up previous
Next: Up: Appendix of S-Plus Code. Previous: Time Series Plots

Computing within-month averages and subtracting.

 

As a first cut at removing the seasonality of the nottem data, we compute average temperatures across years within a month. This is done below and the results are plotted.

> nottem.matrix_matrix(nottem,ncol=12,byrow=T)
> # This arranges the data in a matrix.  The columns are the data in a
> # given month (first column is all the Januaries) and the rows are
> # the data in a given year.
> nottem.monthly.means_apply(nottem.matrix,2,mean)
> plot(1:12,nottem.monthly.means)
> #1:12 is the sequence of integers 1 to 12
> nottem.dev.mm_nottem-rep(monthly.means,20)
> # Note that there are 20 years worth of data, so we have to repeat the
> # sequence of monthly means 20 times.
> ts.plot(nottem.dev.mm)

The last two plots appear as Figures 5 and 7.



Dennis Cox
Thu Jan 16 12:20:07 CST 1997