8.1 Chinook data

We will illustrate the analysis of seasonal catch data using a data set of monthly chinook salmon from Washington state.

Load the chinook salmon data set

This is in the FishForecast package.

require(FishForecast)
head(chinook.month)
(#tab:f80-load_packages)
YearMonthSpeciesStatelog.metric.tonsmetric.tonsValue
1990JanChinookWA3.4 29.91.09e+05
1990FebChinookWA3.8145.13.09e+05
1990MarChinookWA3.5133.52.01e+05
1990AprChinookWA4.2570  4.31e+05
1990MayChinookWA5.2 181  8.6e+05 
1990JunChinookWA4.3779.24.2e+05 

The data are monthly and start in January 1990. To make this into a ts object do

chinookts <- ts(chinook.month$log.metric.tons, start=c(1990,1), frequency=12)

start is the year and month and frequency is the number of months in the year. If we had quarterly data that started in 2nd quarter of 1990, our call would be

ts(chinook$log.metric.tons, start=c(1990,2), frequency=4)

If we had daily data starting on hour 5 of day 10 and each row was an hour, our call would be

ts(chinook$log.metric.tons, start=c(10,5), frequency=24)

Use ?ts to see more examples of how to set up ts objects.

Plot seasonal data

Now that we have specified our seasonal data as a ts object, it is easy to plot because R knows what the season is.

plot(chinookts)