Periodograms

# Plot some time series
par ( mfrow=c(3,2) )

ts.plot ( bonds.yield[,1], main="daily bond yields", xlab="day", ylab="yield" )
ts.plot( co2, main="Mauna Loa CO2 concentration", xlab="Year", ylab="concentration" )
ts.plot ( tsmatrix ( corn.rain, corn.yield ), main="Rainfall and Corn Yield", xlab="Year", ylab="rain (inches), yield (bushels per acre)" )
ts.plot ( lynx, main="Annual Number of Lynx Trappings", xlab="Year", ylab="Number of Lynx" )
ts.plot ( ozone.median, main="Ozone levels", sub="Median daily maxima for June to August", xlab="Day" )
ts.plot ( sunspots, main="Monthly Mean Relative Sunspot Numbers", xlab="Year" )
#----------------------------------------------------------------------

#####################################################################
# Estimate the periodogram of the CO2 series

par ( mfrow=c(5,1) )

ts.plot( co2, main="Mauna Loa CO2 concentration", xlab="Year", ylab="concentration" )

# Raw data
spectrum ( co2 )

# Detrended data
spectrum ( co2 - ma.filt2 )

# Deseasonalized data
spectrum ( co2 - s.hat )

# Detrended and deseasonalized
spectrum ( co2 - s.hat - ma.filt2 )
#####################################################################
# Estimate the periodogram of the other five time series series
par ( mfrow=c(5,2) )

ts.plot ( bonds.yield[,1] )
spectrum ( bonds.yield[,1] )

ts.plot ( tsmatrix ( corn.rain, corn.yield ) )
spectrum ( tsmatrix(corn.rain,corn.yield) )

ts.plot ( lynx )
spectrum ( lynx )

ts.plot ( ozone.median )
spectrum ( ozone.median )

ts.plot ( sunspots )
spectrum ( sunspots )