Seasonal time series

Seasonal time series have a trend, error, and a seasonality component. Consider the sales figures of winter clothing. They tend to rise during winter and flat ten out during summer and other seasons. This is the seasonality effect. Seasonality is always of a fixed and known period.

We will use another small dataset to show seasonality—the number of births per month in New York City from January 1946 to December 1959:

> births <- scan("")Read 168 items> births.ts <- ts(births, frequency = 12)> births.comps <- decompose(births.ts)

Using the decompose function, we split the trend, seasonality, and error from the time series. Let us now plot these components using plot(births.comps) ...

Get R Data Analysis Projects now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.