{"id":8956,"date":"2021-02-24T11:31:03","date_gmt":"2021-02-24T16:31:03","guid":{"rendered":"https:\/\/demand-planning.com\/?p=8956"},"modified":"2021-02-24T11:35:37","modified_gmt":"2021-02-24T16:35:37","slug":"practical-methods-for-identifying-seasonality-in-a-dataset","status":"publish","type":"post","link":"https:\/\/demand-planning.com\/2021\/02\/24\/practical-methods-for-identifying-seasonality-in-a-dataset\/","title":{"rendered":"Practical Methods For Identifying Seasonality In A Dataset"},"content":{"rendered":"<span class=\"cb-itemprop\" itemprop=\"reviewBody\"><hr \/>\n<p>At my former company, Bendix Commercial Vehicle Systems, an Ohio-based manufacturer of brakes and safety systems, I was asked to come up with a list of seasonal items across multiple levels of product hierarchy.<\/p>\n<p>The product hierarchy was part \u2192 plant \u2192 device code \u2192 main family, and was spread across several plants, focusing exclusively on the aftermarket portion of the business. The project developed into a means of identifying seasonality via multiple indicators and approaches, culminating in the use of a statistical forecasting model for comparison against moving average models. Below is a summary of the project complete with the process steps and outputs. The primary tools used were <a href=\"https:\/\/demand-planning.com\/2018\/01\/15\/forecast-excel\/\">Excel<\/a> and the R forecasting package.<\/p>\n<h2><strong>Starting With Time Series Decomposition <\/strong><\/h2>\n<p>To accomplish this task, I went back to some basic yet powerful statistical concepts, beginning with time series decomposition. In time series decomposition, seasonality can be separated from noise and trend (at least in theory). I ended up identifying seasonality in 2 ways \u2013 the first was with <a href=\"https:\/\/demand-planning.com\/2018\/01\/15\/forecast-excel\/\">Excel<\/a>, using a median demand value over each year compared to each month\u2019s demand patterns. <a href=\"https:\/\/demand-planning.com\/2018\/01\/15\/forecast-excel\/\">Excel<\/a> doesn\u2019t have a decomposition feature, so I performed this manually.<\/p>\n<p>In this case, if the output (what I called \u201cindices\u201d) were the same or close for over 75% of the year, I considered it to be seasonal. The reason why I allowed values that were \u2018close\u2019 as well as the same was to account for any rounding or fluctuation in decimals as decimals were not recorded to every decimal place.<\/p>\n<p>Having the ability towards the end of the project to program in R, I used the default time series decomposition function in this package to identify seasonality as well. R seemed to confuse (or fail to distinguish seasonality) from noise in the time series tested. This I attribute to natural fluctuations in demand levels from year to year. Given my earlier analysis in <a href=\"https:\/\/demand-planning.com\/2018\/01\/15\/forecast-excel\/\">Excel<\/a>, I was fairly confident that seasonality existed in the dataset, so I started looking at other models that could confirm or deny this. I eventually utilized <a href=\"https:\/\/ibf.org\/knowledge\/glossary\/holt-winters-exponential-smoothing-model-141\">Holt-Winters<\/a> filtering to filter the time series which indeed confirmed the existence of seasonality.<\/p>\n<h2><strong>Holt-Winters Filtering<\/strong><\/h2>\n<p>The results of the <a href=\"https:\/\/ibf.org\/knowledge\/glossary\/holt-winters-exponential-smoothing-model-141\">Holt-Winters<\/a> filtering were quite different than standard time series decomposition. Because of the noise in the time series, the default time series decomposition in R did not adequately identify seasonality &#8211; but <a href=\"https:\/\/ibf.org\/knowledge\/glossary\/holt-winters-exponential-smoothing-model-141\">Holt-Winters<\/a> filtering did (see Figure 1).<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_8962\" style=\"width: 604px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8962\" class=\"wp-image-8962 size-full\" src=\"https:\/\/demand-planning.com\/wp-content\/uploads\/2021\/02\/Holt-Winters.jpg\" alt=\"\" width=\"594\" height=\"370\" srcset=\"https:\/\/demand-planning.com\/wp-content\/uploads\/2021\/02\/Holt-Winters.jpg 594w, https:\/\/demand-planning.com\/wp-content\/uploads\/2021\/02\/Holt-Winters-300x187.jpg 300w\" sizes=\"(max-width: 594px) 100vw, 594px\" \/><p id=\"caption-attachment-8962\" class=\"wp-caption-text\">Figure 1. Identifying seasonality with Holt-Winters Filtering<\/p><\/div>\n<p>Filtering is also a powerful tool for optimizing a time series. <a href=\"https:\/\/ibf.org\/knowledge\/glossary\/holt-winters-exponential-smoothing-model-141\">Holt-Winters<\/a> filtering also allowed for the determination of coefficients across various periods. The goal of this was to look for coefficients that repeated over time at the same (or nearly the same) periodicity with roughly the same value. This would support my theory that seasonality was present in the dataset as coefficients should roughly change at the same interval if seasonality were present &#8211; values could change but the pattern of repeating was a strong indication of seasonality. Given this was a test for seasonality, the specific values were not extremely important at this stage but rather the pattern of coefficients and the intervals. See Figure 2 for the fitted plot and for a plot of the coefficients.<\/p>\n<div id=\"attachment_8963\" style=\"width: 506px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8963\" class=\"size-full wp-image-8963\" src=\"https:\/\/demand-planning.com\/wp-content\/uploads\/2021\/02\/Holt-Winters-2.jpg\" alt=\"\" width=\"496\" height=\"309\" srcset=\"https:\/\/demand-planning.com\/wp-content\/uploads\/2021\/02\/Holt-Winters-2.jpg 496w, https:\/\/demand-planning.com\/wp-content\/uploads\/2021\/02\/Holt-Winters-2-300x187.jpg 300w\" sizes=\"(max-width: 496px) 100vw, 496px\" \/><p id=\"caption-attachment-8963\" class=\"wp-caption-text\">Figure 2. A plot of the coefficients using Holt-Winters Filtering<\/p><\/div>\n<p>Another important aspect of this project was to perform \u201cwhat if\u201d analysis, i.e., what seasonal demand might look via a simulation. In most instances, a uniform distribution was used, employing a minimum and maximum based on historical demand. In <a href=\"https:\/\/demand-planning.com\/2018\/01\/15\/forecast-excel\/\">Excel<\/a> and R, this was performed with a randomized uniform distribution.<\/p>\n<p>At some combinations at higher levels of product hierarchy, discrete distributions were used but later analysis revealed little to no seasonality at lower levels. This led me to use uniform distribution for the combinations, which show seasonal behavior.<\/p>\n<p>Results show that demand does follow a seasonal pattern with a roughly consistent cycle over the 36 months of demand history. The simulations were run first based on an interval for 1 year and then for an interval over the entire 3 years of demand history with little to no change in results.<\/p>\n<div id=\"attachment_8964\" style=\"width: 481px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8964\" class=\"size-full wp-image-8964\" src=\"https:\/\/demand-planning.com\/wp-content\/uploads\/2021\/02\/Graph-showing-seasonality.jpg\" alt=\"\" width=\"471\" height=\"293\" srcset=\"https:\/\/demand-planning.com\/wp-content\/uploads\/2021\/02\/Graph-showing-seasonality.jpg 471w, https:\/\/demand-planning.com\/wp-content\/uploads\/2021\/02\/Graph-showing-seasonality-300x187.jpg 300w\" sizes=\"(max-width: 471px) 100vw, 471px\" \/><p id=\"caption-attachment-8964\" class=\"wp-caption-text\">Figure 3. Demand showing a seasonal pattern.<\/p><\/div>\n<p>Given this project was done as part of a demand planning and forecasting team, the natural progression was to determine how to deliver a better forecast for seasonal items. Utilizing averages will often lead to over smoothing on seasonal items unless the seasonality occurs on the same cycle or line as the average. Rather than attempt to tune the moving average, I utilized a 6-month moving average for comparison purposes and my baseline.<\/p>\n<p>Harnessing the power of R forecasting package, I was able to perform a triple exponential smoothing forecast. The forecast is based on the original time series with 36 points which results in a forecast for 36 months. The package fits the forecast to the time series and provides the resulting coefficients for each of the periods as well. These coefficients allowed for forecast comparison on demand and the six month moving average as well. See below (Figure 4) for comparisons between demand (actuals) and triple exponential smoothing and 6 month moving average.<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_8965\" style=\"width: 1976px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8965\" class=\"size-full wp-image-8965\" src=\"https:\/\/demand-planning.com\/wp-content\/uploads\/2021\/02\/Forecast-vs-actuals.png\" alt=\"\" width=\"1966\" height=\"921\" srcset=\"https:\/\/demand-planning.com\/wp-content\/uploads\/2021\/02\/Forecast-vs-actuals.png 1966w, https:\/\/demand-planning.com\/wp-content\/uploads\/2021\/02\/Forecast-vs-actuals-300x141.png 300w, https:\/\/demand-planning.com\/wp-content\/uploads\/2021\/02\/Forecast-vs-actuals-1024x480.png 1024w, https:\/\/demand-planning.com\/wp-content\/uploads\/2021\/02\/Forecast-vs-actuals-768x360.png 768w, https:\/\/demand-planning.com\/wp-content\/uploads\/2021\/02\/Forecast-vs-actuals-1536x720.png 1536w\" sizes=\"(max-width: 1966px) 100vw, 1966px\" \/><p id=\"caption-attachment-8965\" class=\"wp-caption-text\">Figure 4. Forecast vs. actual demand<\/p><\/div>\n<p>At the end of this project, 6 out of 30 product groups showed seasonality which is approximately thirty percent of the entire product portfolio. Statistical and quantitative analysis allows for comparison of time series and determination of seasonal coefficients and simulation. But just as important are consideration of non\u2013quantitative factors as well. These may include customer, markets and perhaps other external factors such as structural shifts or product advancements.<\/p>\n<p>Hopefully this will provide a simple yet useful means to identify seasonality and ultimately assist in developing a robust forecast.<\/p>\n<p>&nbsp;<\/p>\n<\/span>","protected":false},"excerpt":{"rendered":"<p>At my former company, Bendix Commercial Vehicle Systems, an Ohio-based manufacturer of brakes and safety systems, I was asked to come up with a list of seasonal items across multiple levels of product hierarchy. The product hierarchy was part \u2192 plant \u2192 device code \u2192 main family, and was spread across several plants, focusing exclusively [&hellip;]<\/p>\n","protected":false},"author":40314,"featured_media":8957,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[386,387],"tags":[426,474,539],"class_list":{"0":"post-8956","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-analytics","8":"category-models-and-methods","9":"tag-holt-winters","10":"tag-seasonality","11":"tag-time-series-decomposition"},"_links":{"self":[{"href":"https:\/\/demand-planning.com\/wp-json\/wp\/v2\/posts\/8956"}],"collection":[{"href":"https:\/\/demand-planning.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/demand-planning.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/demand-planning.com\/wp-json\/wp\/v2\/users\/40314"}],"replies":[{"embeddable":true,"href":"https:\/\/demand-planning.com\/wp-json\/wp\/v2\/comments?post=8956"}],"version-history":[{"count":0,"href":"https:\/\/demand-planning.com\/wp-json\/wp\/v2\/posts\/8956\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/demand-planning.com\/wp-json\/wp\/v2\/media\/8957"}],"wp:attachment":[{"href":"https:\/\/demand-planning.com\/wp-json\/wp\/v2\/media?parent=8956"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/demand-planning.com\/wp-json\/wp\/v2\/categories?post=8956"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/demand-planning.com\/wp-json\/wp\/v2\/tags?post=8956"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}