## Two General Aspects of Time Series Patterns

- 13/05/2016
- 757
- 0 Like

**Published In**

- Big Data
- Analytics
- Business Intelligence

**Introduction**

Though I have discussed other components of time series data in past articles, I can describe most time series patterns in terms of two basic classes of components: trend and seasonality. The first represents a general systematic linear or a nonlinear component that changes over time and does not repeat, or, at least, does not repeat within the time range captured by our data (e.g., a plateau followed by a period of exponential growth). The second may have a similar structure (e.g., a plateau followed by a period of exponential growth, but repeats itself in systematic intervals over time. These two general classes of time series components may coexist in real-life data (Dell, 2015). As an example, consider the sales of a company, which can grow rapidly over the years, but they still follow consistent seasonal patterns (e.g., as much as 25% of yearly sales each year are made in December, whereas only 4% in August).

**Discovering Patterns**

This general pattern is well illustrated (see Figure 1) by the international passenger data series (G), as mentioned in the textbook Time Series: Forecast and Control by Box (Box, Jenkins, & Reinsel, 2008), representing monthly international airline passenger totals (measured in thousands) for twelve consecutive years from 1960 to 1972. If you plot the successive observations (months) of airline passenger totals, a clear and almost linear trend emerges, indicating that the airline industry enjoyed steady growth over the years (approximately four times more passengers traveled in 1970 than in 1960). Additionally, the monthly figures will follow a nearly identical pattern each year (e.g., more people travel during holidays than during any other time of the year). This example data file also illustrates a very common general type of pattern in time series data, where the amplitude of the seasonal changes increases with the overall trend (i.e., the variance is correlated with the mean over the segments of the series). This pattern which is called multiplicative seasonality indicates that the relative amplitude of seasonal changes is constant over time, (Strickland, 2016) so it is related to the trend.

**Decomposing Time Series Data with R**

One alternative for decomposing a time series is to use the stlplus-Package in R, as follows (Hafen, 2016), using the airpass dataset from the TSA-Package in R (Chan & Ripley, 2012). The airpass dataset contains monthly total international airline passengers from 01/1960 – 12/1971. The remainder component represents time series error not explained by the other components, trend, and seasonality. The R code is comprised of 8 lines.

The code produces the following charts:

1. Time series decomposition by component over Time (Figure 2)

2. Centered Seasonal plus Reminder versus Time per Month (hour, day, week, as appropriate) (Figure 3)

3. Trend and Remainder over Time (Figure 4)

4. Seasonal over Time by Month (hour, day, week, as appropriate) (Figure 5)

5. Remainder over Time by Month (hour, day, week, as appropriate) (Figure 6)

**Conclusion**

The foregoing visual inspection of time series data is much better than using the decompose() function in R, which only provides a similar plot of Figure 2. Analyzing the patterns in time series data helps use specify the model we will use to base our forecasts on.

**Works Cited**

Box, G. E., Jenkins, G. M., & Reinsel, G. C. (2008). Time Series Analysis: Forecasting and Control. (4th, Ed.) Hoboken, NJ: John Wiley & Sons. Retrieved from 978-0-470-27284-8

Chan, K.-S., & Ripley, B. (2012, 11 13). TSA: Time Series Analysis. Retrieved from The Comprehensive R Archive Network (CRAN): https://cran.r-project.org/web/packages/TSA/index.html

Time Series Analysis - Statistics Textbook - Dell. (revised May 8, 2015). Retrieved from http://documents.software.dell.com/Statistics/Textbook/Time-Series-Analysis

Strickland, J. Exponential Smoothing of Time Series Data in R. (February 24, 2016). Retrieved from http://www.datasciencecentral.com/xn/detail/6448529:BlogPost:391378?xg_source=ac

Copyright© 2016, Jeffrey Strickland. All rights reserved. This article or any portion thereof may not be reproduced or used in any manner whatsoever without the express written permission of the author except for the use of brief quotations in a review.

- 13/05/2016
- 757
- 0 Like

## Two General Aspects of Time Series Patterns

- 13/05/2016
- 757
- 0 Like

#### Jeffrey Strickland

Predictive Analytics Consultant at Clarity Solution Group

Opinions expressed by Grroups members are their own.

#### Top Authors

**Introduction**

Though I have discussed other components of time series data in past articles, I can describe most time series patterns in terms of two basic classes of components: trend and seasonality. The first represents a general systematic linear or a nonlinear component that changes over time and does not repeat, or, at least, does not repeat within the time range captured by our data (e.g., a plateau followed by a period of exponential growth). The second may have a similar structure (e.g., a plateau followed by a period of exponential growth, but repeats itself in systematic intervals over time. These two general classes of time series components may coexist in real-life data (Dell, 2015). As an example, consider the sales of a company, which can grow rapidly over the years, but they still follow consistent seasonal patterns (e.g., as much as 25% of yearly sales each year are made in December, whereas only 4% in August).

**Discovering Patterns**

This general pattern is well illustrated (see Figure 1) by the international passenger data series (G), as mentioned in the textbook Time Series: Forecast and Control by Box (Box, Jenkins, & Reinsel, 2008), representing monthly international airline passenger totals (measured in thousands) for twelve consecutive years from 1960 to 1972. If you plot the successive observations (months) of airline passenger totals, a clear and almost linear trend emerges, indicating that the airline industry enjoyed steady growth over the years (approximately four times more passengers traveled in 1970 than in 1960). Additionally, the monthly figures will follow a nearly identical pattern each year (e.g., more people travel during holidays than during any other time of the year). This example data file also illustrates a very common general type of pattern in time series data, where the amplitude of the seasonal changes increases with the overall trend (i.e., the variance is correlated with the mean over the segments of the series). This pattern which is called multiplicative seasonality indicates that the relative amplitude of seasonal changes is constant over time, (Strickland, 2016) so it is related to the trend.

**Decomposing Time Series Data with R**

One alternative for decomposing a time series is to use the stlplus-Package in R, as follows (Hafen, 2016), using the airpass dataset from the TSA-Package in R (Chan & Ripley, 2012). The airpass dataset contains monthly total international airline passengers from 01/1960 – 12/1971. The remainder component represents time series error not explained by the other components, trend, and seasonality. The R code is comprised of 8 lines.

The code produces the following charts:

1. Time series decomposition by component over Time (Figure 2)

2. Centered Seasonal plus Reminder versus Time per Month (hour, day, week, as appropriate) (Figure 3)

3. Trend and Remainder over Time (Figure 4)

4. Seasonal over Time by Month (hour, day, week, as appropriate) (Figure 5)

5. Remainder over Time by Month (hour, day, week, as appropriate) (Figure 6)

**Conclusion**

The foregoing visual inspection of time series data is much better than using the decompose() function in R, which only provides a similar plot of Figure 2. Analyzing the patterns in time series data helps use specify the model we will use to base our forecasts on.

**Works Cited**

Box, G. E., Jenkins, G. M., & Reinsel, G. C. (2008). Time Series Analysis: Forecasting and Control. (4th, Ed.) Hoboken, NJ: John Wiley & Sons. Retrieved from 978-0-470-27284-8

Chan, K.-S., & Ripley, B. (2012, 11 13). TSA: Time Series Analysis. Retrieved from The Comprehensive R Archive Network (CRAN): https://cran.r-project.org/web/packages/TSA/index.html

Time Series Analysis - Statistics Textbook - Dell. (revised May 8, 2015). Retrieved from http://documents.software.dell.com/Statistics/Textbook/Time-Series-Analysis

Strickland, J. Exponential Smoothing of Time Series Data in R. (February 24, 2016). Retrieved from http://www.datasciencecentral.com/xn/detail/6448529:BlogPost:391378?xg_source=ac

Copyright© 2016, Jeffrey Strickland. All rights reserved. This article or any portion thereof may not be reproduced or used in any manner whatsoever without the express written permission of the author except for the use of brief quotations in a review.

- 13/05/2016
- 757
- 0 Like

## Jeffrey Strickland

Predictive Analytics Consultant at Clarity Solution Group

Opinions expressed by Grroups members are their own.