CINXE.COM

6.6 STL decomposition | Forecasting: Principles and Practice (2nd ed)

<!DOCTYPE html> <html lang="" xml:lang=""> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <title>6.6 STL decomposition | Forecasting: Principles and Practice (2nd ed)</title> <meta name="description" content="2nd edition" /> <meta name="generator" content="bookdown 0.41 and GitBook 2.6.7" /> <meta property="og:title" content="6.6 STL decomposition | Forecasting: Principles and Practice (2nd ed)" /> <meta property="og:type" content="book" /> <meta property="og:image" content="https://Otexts.com/fpp2//fpp2_cover.jpg" /> <meta property="og:description" content="2nd edition" /> <meta name="twitter:card" content="summary" /> <meta name="twitter:title" content="6.6 STL decomposition | Forecasting: Principles and Practice (2nd ed)" /> <meta name="twitter:site" content="@robjhyndman" /> <meta name="twitter:description" content="2nd edition" /> <meta name="twitter:image" content="https://Otexts.com/fpp2//fpp2_cover.jpg" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <link rel="prev" href="seats.html"/> <link rel="next" href="seasonal-strength.html"/> <script src="libs/jquery-3.6.0/jquery-3.6.0.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/fuse.js@6.4.6/dist/fuse.min.js"></script> <link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" /> <link href="libs/gitbook-2.6.7/css/plugin-table.css" rel="stylesheet" /> <link href="libs/gitbook-2.6.7/css/plugin-bookdown.css" rel="stylesheet" /> <link href="libs/gitbook-2.6.7/css/plugin-highlight.css" rel="stylesheet" /> <link href="libs/gitbook-2.6.7/css/plugin-search.css" rel="stylesheet" /> <link href="libs/gitbook-2.6.7/css/plugin-fontsettings.css" rel="stylesheet" /> <link href="libs/gitbook-2.6.7/css/plugin-clipboard.css" rel="stylesheet" /> <link href="libs/anchor-sections-1.1.0/anchor-sections.css" rel="stylesheet" /> <link href="libs/anchor-sections-1.1.0/anchor-sections-hash.css" rel="stylesheet" /> <script src="libs/anchor-sections-1.1.0/anchor-sections.js"></script> <script src="libs/kePrint-0.0.1/kePrint.js"></script> <link href="libs/lightable-0.0.1/lightable.css" rel="stylesheet" /> <link href="libs/bsTable-3.3.7/bootstrapTable.min.css" rel="stylesheet" /> <script src="libs/bsTable-3.3.7/bootstrapTable.js"></script> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ TeX: { equationNumbers: { autoNumber: "AMS" } , Macros: { bm: ["\\boldsymbol{#1}",1], y: ["y_{\\text{#1},#2}",2], yhat: ["\\hat{y}_{\\text{#1},#2}",2], ytilde: ["\\tilde{y}_{\\text{#1},#2}",2], Shat: ["\\hat{S}_{\\text{#1},#2}^{(#3)}",3] } } }); </script> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-27933797-2"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-27933797-2'); gtag('config', 'G-JKBLG3XQGY'); </script> <link href="https://fonts.googleapis.com/css?family=Fira+Sans|Merriweather" rel="stylesheet"> <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/hack-font@3/build/web/hack-subset.css"> <style type="text/css"> pre > code.sourceCode { white-space: pre; position: relative; } pre > code.sourceCode > span { line-height: 1.25; } pre > code.sourceCode > span:empty { height: 1.2em; } .sourceCode { overflow: visible; } code.sourceCode > span { color: inherit; text-decoration: inherit; } pre.sourceCode { margin: 0; } @media screen { div.sourceCode { overflow: auto; } } @media print { pre > code.sourceCode { white-space: pre-wrap; } pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; } } pre.numberSource code { counter-reset: source-line 0; } pre.numberSource code > span { position: relative; left: -4em; counter-increment: source-line; } pre.numberSource code > span > a:first-child::before { content: counter(source-line); position: relative; left: -1em; text-align: right; vertical-align: baseline; border: none; display: inline-block; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; padding: 0 4px; width: 4em; color: #aaaaaa; } pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } div.sourceCode { } @media screen { pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } } code span.al { color: #ff0000; font-weight: bold; } /* Alert */ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ code span.at { color: #7d9029; } /* Attribute */ code span.bn { color: #40a070; } /* BaseN */ code span.bu { color: #008000; } /* BuiltIn */ code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ code span.ch { color: #4070a0; } /* Char */ code span.cn { color: #880000; } /* Constant */ code span.co { color: #60a0b0; font-style: italic; } /* Comment */ code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ code span.do { color: #ba2121; font-style: italic; } /* Documentation */ code span.dt { color: #902000; } /* DataType */ code span.dv { color: #40a070; } /* DecVal */ code span.er { color: #ff0000; font-weight: bold; } /* Error */ code span.ex { } /* Extension */ code span.fl { color: #40a070; } /* Float */ code span.fu { color: #06287e; } /* Function */ code span.im { color: #008000; font-weight: bold; } /* Import */ code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ code span.kw { color: #007020; font-weight: bold; } /* Keyword */ code span.op { color: #666666; } /* Operator */ code span.ot { color: #007020; } /* Other */ code span.pp { color: #bc7a00; } /* Preprocessor */ code span.sc { color: #4070a0; } /* SpecialChar */ code span.ss { color: #bb6688; } /* SpecialString */ code span.st { color: #4070a0; } /* String */ code span.va { color: #19177c; } /* Variable */ code span.vs { color: #4070a0; } /* VerbatimString */ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ </style> <style type="text/css"> div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} </style> <style type="text/css"> /* Used with Pandoc 2.11+ new --citeproc when CSL is used */ div.csl-bib-body { } div.csl-entry { clear: both; margin-bottom: 0em; } .hanging div.csl-entry { margin-left:2em; text-indent:-2em; } div.csl-left-margin { min-width:2em; float:left; } div.csl-right-inline { margin-left:2em; padding-left:1em; } div.csl-indent { margin-left: 2em; } </style> <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body> <div class="book without-animation with-summary font-size-2 font-family-1" data-basepath="."> <div class="book-summary"> <nav role="navigation"> <ul class="summary"> <li><a href="./">Forecasting: Principles and Practice</a></li> <li class="divider"></li> <li class="chapter" data-level="" data-path="index.html"><a href="index.html"><i class="fa fa-check"></i>Preface</a></li> <li class="chapter" data-level="1" data-path="intro.html"><a href="intro.html"><i class="fa fa-check"></i><b>1</b> Getting started</a> <ul> <li class="chapter" data-level="1.1" data-path="what-can-be-forecast.html"><a href="what-can-be-forecast.html"><i class="fa fa-check"></i><b>1.1</b> What can be forecast?</a></li> <li class="chapter" data-level="1.2" data-path="planning.html"><a href="planning.html"><i class="fa fa-check"></i><b>1.2</b> Forecasting, planning and goals</a></li> <li class="chapter" data-level="1.3" data-path="determining-what-to-forecast.html"><a href="determining-what-to-forecast.html"><i class="fa fa-check"></i><b>1.3</b> Determining what to forecast</a></li> <li class="chapter" data-level="1.4" data-path="data-methods.html"><a href="data-methods.html"><i class="fa fa-check"></i><b>1.4</b> Forecasting data and methods</a></li> <li class="chapter" data-level="1.5" data-path="case-studies.html"><a href="case-studies.html"><i class="fa fa-check"></i><b>1.5</b> Some case studies</a></li> <li class="chapter" data-level="1.6" data-path="basic-steps.html"><a href="basic-steps.html"><i class="fa fa-check"></i><b>1.6</b> The basic steps in a forecasting task</a></li> <li class="chapter" data-level="1.7" data-path="perspective.html"><a href="perspective.html"><i class="fa fa-check"></i><b>1.7</b> The statistical forecasting perspective</a></li> <li class="chapter" data-level="1.8" data-path="intro-exercises.html"><a href="intro-exercises.html"><i class="fa fa-check"></i><b>1.8</b> Exercises</a></li> <li class="chapter" data-level="1.9" data-path="intro-reading.html"><a href="intro-reading.html"><i class="fa fa-check"></i><b>1.9</b> Further reading</a></li> </ul></li> <li class="chapter" data-level="2" data-path="graphics.html"><a href="graphics.html"><i class="fa fa-check"></i><b>2</b> Time series graphics</a> <ul> <li class="chapter" data-level="2.1" data-path="ts-objects.html"><a href="ts-objects.html"><i class="fa fa-check"></i><b>2.1</b> <code>ts</code> objects</a></li> <li class="chapter" data-level="2.2" data-path="time-plots.html"><a href="time-plots.html"><i class="fa fa-check"></i><b>2.2</b> Time plots</a></li> <li class="chapter" data-level="2.3" data-path="tspatterns.html"><a href="tspatterns.html"><i class="fa fa-check"></i><b>2.3</b> Time series patterns</a></li> <li class="chapter" data-level="2.4" data-path="seasonal-plots.html"><a href="seasonal-plots.html"><i class="fa fa-check"></i><b>2.4</b> Seasonal plots</a></li> <li class="chapter" data-level="2.5" data-path="seasonal-subseries-plots.html"><a href="seasonal-subseries-plots.html"><i class="fa fa-check"></i><b>2.5</b> Seasonal subseries plots</a></li> <li class="chapter" data-level="2.6" data-path="scatterplots.html"><a href="scatterplots.html"><i class="fa fa-check"></i><b>2.6</b> Scatterplots</a></li> <li class="chapter" data-level="2.7" data-path="lag-plots.html"><a href="lag-plots.html"><i class="fa fa-check"></i><b>2.7</b> Lag plots</a></li> <li class="chapter" data-level="2.8" data-path="autocorrelation.html"><a href="autocorrelation.html"><i class="fa fa-check"></i><b>2.8</b> Autocorrelation</a></li> <li class="chapter" data-level="2.9" data-path="wn.html"><a href="wn.html"><i class="fa fa-check"></i><b>2.9</b> White noise</a></li> <li class="chapter" data-level="2.10" data-path="graphics-exercises.html"><a href="graphics-exercises.html"><i class="fa fa-check"></i><b>2.10</b> Exercises</a></li> <li class="chapter" data-level="2.11" data-path="graphics-reading.html"><a href="graphics-reading.html"><i class="fa fa-check"></i><b>2.11</b> Further reading</a></li> </ul></li> <li class="chapter" data-level="3" data-path="toolbox.html"><a href="toolbox.html"><i class="fa fa-check"></i><b>3</b> The forecaster’s toolbox</a> <ul> <li class="chapter" data-level="3.1" data-path="simple-methods.html"><a href="simple-methods.html"><i class="fa fa-check"></i><b>3.1</b> Some simple forecasting methods</a></li> <li class="chapter" data-level="3.2" data-path="transformations.html"><a href="transformations.html"><i class="fa fa-check"></i><b>3.2</b> Transformations and adjustments</a></li> <li class="chapter" data-level="3.3" data-path="residuals.html"><a href="residuals.html"><i class="fa fa-check"></i><b>3.3</b> Residual diagnostics</a></li> <li class="chapter" data-level="3.4" data-path="accuracy.html"><a href="accuracy.html"><i class="fa fa-check"></i><b>3.4</b> Evaluating forecast accuracy</a></li> <li class="chapter" data-level="3.5" data-path="prediction-intervals.html"><a href="prediction-intervals.html"><i class="fa fa-check"></i><b>3.5</b> Prediction intervals</a></li> <li class="chapter" data-level="3.6" data-path="the-forecast-package-in-r.html"><a href="the-forecast-package-in-r.html"><i class="fa fa-check"></i><b>3.6</b> The forecast package in R</a></li> <li class="chapter" data-level="3.7" data-path="toolbox-exercises.html"><a href="toolbox-exercises.html"><i class="fa fa-check"></i><b>3.7</b> Exercises</a></li> <li class="chapter" data-level="3.8" data-path="toolbox-reading.html"><a href="toolbox-reading.html"><i class="fa fa-check"></i><b>3.8</b> Further reading</a></li> </ul></li> <li class="chapter" data-level="4" data-path="judgmental.html"><a href="judgmental.html"><i class="fa fa-check"></i><b>4</b> Judgmental forecasts</a> <ul> <li class="chapter" data-level="4.1" data-path="judgmental-limitations.html"><a href="judgmental-limitations.html"><i class="fa fa-check"></i><b>4.1</b> Beware of limitations</a></li> <li class="chapter" data-level="4.2" data-path="judgmental-principles.html"><a href="judgmental-principles.html"><i class="fa fa-check"></i><b>4.2</b> Key principles</a></li> <li class="chapter" data-level="4.3" data-path="delphimethod.html"><a href="delphimethod.html"><i class="fa fa-check"></i><b>4.3</b> The Delphi method</a></li> <li class="chapter" data-level="4.4" data-path="analogies.html"><a href="analogies.html"><i class="fa fa-check"></i><b>4.4</b> Forecasting by analogy</a></li> <li class="chapter" data-level="4.5" data-path="scenarios.html"><a href="scenarios.html"><i class="fa fa-check"></i><b>4.5</b> Scenario forecasting</a></li> <li class="chapter" data-level="4.6" data-path="new-products.html"><a href="new-products.html"><i class="fa fa-check"></i><b>4.6</b> New product forecasting</a></li> <li class="chapter" data-level="4.7" data-path="judgmental-adjustments.html"><a href="judgmental-adjustments.html"><i class="fa fa-check"></i><b>4.7</b> Judgmental adjustments</a></li> <li class="chapter" data-level="4.8" data-path="judgmental-reading.html"><a href="judgmental-reading.html"><i class="fa fa-check"></i><b>4.8</b> Further reading</a></li> </ul></li> <li class="chapter" data-level="5" data-path="regression.html"><a href="regression.html"><i class="fa fa-check"></i><b>5</b> Time series regression models</a> <ul> <li class="chapter" data-level="5.1" data-path="regression-intro.html"><a href="regression-intro.html"><i class="fa fa-check"></i><b>5.1</b> The linear model</a></li> <li class="chapter" data-level="5.2" data-path="least-squares.html"><a href="least-squares.html"><i class="fa fa-check"></i><b>5.2</b> Least squares estimation</a></li> <li class="chapter" data-level="5.3" data-path="regression-evaluation.html"><a href="regression-evaluation.html"><i class="fa fa-check"></i><b>5.3</b> Evaluating the regression model</a></li> <li class="chapter" data-level="5.4" data-path="useful-predictors.html"><a href="useful-predictors.html"><i class="fa fa-check"></i><b>5.4</b> Some useful predictors</a></li> <li class="chapter" data-level="5.5" data-path="selecting-predictors.html"><a href="selecting-predictors.html"><i class="fa fa-check"></i><b>5.5</b> Selecting predictors</a></li> <li class="chapter" data-level="5.6" data-path="forecasting-regression.html"><a href="forecasting-regression.html"><i class="fa fa-check"></i><b>5.6</b> Forecasting with regression</a></li> <li class="chapter" data-level="5.7" data-path="regression-matrices.html"><a href="regression-matrices.html"><i class="fa fa-check"></i><b>5.7</b> Matrix formulation</a></li> <li class="chapter" data-level="5.8" data-path="nonlinear-regression.html"><a href="nonlinear-regression.html"><i class="fa fa-check"></i><b>5.8</b> Nonlinear regression</a></li> <li class="chapter" data-level="5.9" data-path="causality.html"><a href="causality.html"><i class="fa fa-check"></i><b>5.9</b> Correlation, causation and forecasting</a></li> <li class="chapter" data-level="5.10" data-path="regression-exercises.html"><a href="regression-exercises.html"><i class="fa fa-check"></i><b>5.10</b> Exercises</a></li> <li class="chapter" data-level="5.11" data-path="regression-reading.html"><a href="regression-reading.html"><i class="fa fa-check"></i><b>5.11</b> Further reading</a></li> </ul></li> <li class="chapter" data-level="6" data-path="decomposition.html"><a href="decomposition.html"><i class="fa fa-check"></i><b>6</b> Time series decomposition</a> <ul> <li class="chapter" data-level="6.1" data-path="components.html"><a href="components.html"><i class="fa fa-check"></i><b>6.1</b> Time series components</a></li> <li class="chapter" data-level="6.2" data-path="moving-averages.html"><a href="moving-averages.html"><i class="fa fa-check"></i><b>6.2</b> Moving averages</a></li> <li class="chapter" data-level="6.3" data-path="classical-decomposition.html"><a href="classical-decomposition.html"><i class="fa fa-check"></i><b>6.3</b> Classical decomposition</a></li> <li class="chapter" data-level="6.4" data-path="x11.html"><a href="x11.html"><i class="fa fa-check"></i><b>6.4</b> X11 decomposition</a></li> <li class="chapter" data-level="6.5" data-path="seats.html"><a href="seats.html"><i class="fa fa-check"></i><b>6.5</b> SEATS decomposition</a></li> <li class="chapter" data-level="6.6" data-path="stl.html"><a href="stl.html"><i class="fa fa-check"></i><b>6.6</b> STL decomposition</a></li> <li class="chapter" data-level="6.7" data-path="seasonal-strength.html"><a href="seasonal-strength.html"><i class="fa fa-check"></i><b>6.7</b> Measuring strength of trend and seasonality</a></li> <li class="chapter" data-level="6.8" data-path="forecasting-decomposition.html"><a href="forecasting-decomposition.html"><i class="fa fa-check"></i><b>6.8</b> Forecasting with decomposition</a></li> <li class="chapter" data-level="6.9" data-path="decomposition-exercises.html"><a href="decomposition-exercises.html"><i class="fa fa-check"></i><b>6.9</b> Exercises</a></li> <li class="chapter" data-level="6.10" data-path="decomposition-reading.html"><a href="decomposition-reading.html"><i class="fa fa-check"></i><b>6.10</b> Further reading</a></li> </ul></li> <li class="chapter" data-level="7" data-path="expsmooth.html"><a href="expsmooth.html"><i class="fa fa-check"></i><b>7</b> Exponential smoothing</a> <ul> <li class="chapter" data-level="7.1" data-path="ses.html"><a href="ses.html"><i class="fa fa-check"></i><b>7.1</b> Simple exponential smoothing</a></li> <li class="chapter" data-level="7.2" data-path="holt.html"><a href="holt.html"><i class="fa fa-check"></i><b>7.2</b> Trend methods</a></li> <li class="chapter" data-level="7.3" data-path="holt-winters.html"><a href="holt-winters.html"><i class="fa fa-check"></i><b>7.3</b> Holt-Winters’ seasonal method</a></li> <li class="chapter" data-level="7.4" data-path="taxonomy.html"><a href="taxonomy.html"><i class="fa fa-check"></i><b>7.4</b> A taxonomy of exponential smoothing methods</a></li> <li class="chapter" data-level="7.5" data-path="ets.html"><a href="ets.html"><i class="fa fa-check"></i><b>7.5</b> Innovations state space models for exponential smoothing</a></li> <li class="chapter" data-level="7.6" data-path="estimation-and-model-selection.html"><a href="estimation-and-model-selection.html"><i class="fa fa-check"></i><b>7.6</b> Estimation and model selection</a></li> <li class="chapter" data-level="7.7" data-path="ets-forecasting.html"><a href="ets-forecasting.html"><i class="fa fa-check"></i><b>7.7</b> Forecasting with ETS models</a></li> <li class="chapter" data-level="7.8" data-path="expsmooth-exercises.html"><a href="expsmooth-exercises.html"><i class="fa fa-check"></i><b>7.8</b> Exercises</a></li> <li class="chapter" data-level="7.9" data-path="expsmooth-reading.html"><a href="expsmooth-reading.html"><i class="fa fa-check"></i><b>7.9</b> Further reading</a></li> </ul></li> <li class="chapter" data-level="8" data-path="arima.html"><a href="arima.html"><i class="fa fa-check"></i><b>8</b> ARIMA models</a> <ul> <li class="chapter" data-level="8.1" data-path="stationarity.html"><a href="stationarity.html"><i class="fa fa-check"></i><b>8.1</b> Stationarity and differencing</a></li> <li class="chapter" data-level="8.2" data-path="backshift.html"><a href="backshift.html"><i class="fa fa-check"></i><b>8.2</b> Backshift notation</a></li> <li class="chapter" data-level="8.3" data-path="AR.html"><a href="AR.html"><i class="fa fa-check"></i><b>8.3</b> Autoregressive models</a></li> <li class="chapter" data-level="8.4" data-path="MA.html"><a href="MA.html"><i class="fa fa-check"></i><b>8.4</b> Moving average models</a></li> <li class="chapter" data-level="8.5" data-path="non-seasonal-arima.html"><a href="non-seasonal-arima.html"><i class="fa fa-check"></i><b>8.5</b> Non-seasonal ARIMA models</a></li> <li class="chapter" data-level="8.6" data-path="arima-estimation.html"><a href="arima-estimation.html"><i class="fa fa-check"></i><b>8.6</b> Estimation and order selection</a></li> <li class="chapter" data-level="8.7" data-path="arima-r.html"><a href="arima-r.html"><i class="fa fa-check"></i><b>8.7</b> ARIMA modelling in R</a></li> <li class="chapter" data-level="8.8" data-path="arima-forecasting.html"><a href="arima-forecasting.html"><i class="fa fa-check"></i><b>8.8</b> Forecasting</a></li> <li class="chapter" data-level="8.9" data-path="seasonal-arima.html"><a href="seasonal-arima.html"><i class="fa fa-check"></i><b>8.9</b> Seasonal ARIMA models</a></li> <li class="chapter" data-level="8.10" data-path="arima-ets.html"><a href="arima-ets.html"><i class="fa fa-check"></i><b>8.10</b> ARIMA vs ETS</a></li> <li class="chapter" data-level="8.11" data-path="arima-exercises.html"><a href="arima-exercises.html"><i class="fa fa-check"></i><b>8.11</b> Exercises</a></li> <li class="chapter" data-level="8.12" data-path="arima-reading.html"><a href="arima-reading.html"><i class="fa fa-check"></i><b>8.12</b> Further reading</a></li> </ul></li> <li class="chapter" data-level="9" data-path="dynamic.html"><a href="dynamic.html"><i class="fa fa-check"></i><b>9</b> Dynamic regression models</a> <ul> <li class="chapter" data-level="9.1" data-path="estimation.html"><a href="estimation.html"><i class="fa fa-check"></i><b>9.1</b> Estimation</a></li> <li class="chapter" data-level="9.2" data-path="regarima.html"><a href="regarima.html"><i class="fa fa-check"></i><b>9.2</b> Regression with ARIMA errors in R</a></li> <li class="chapter" data-level="9.3" data-path="forecasting.html"><a href="forecasting.html"><i class="fa fa-check"></i><b>9.3</b> Forecasting</a></li> <li class="chapter" data-level="9.4" data-path="stochastic-and-deterministic-trends.html"><a href="stochastic-and-deterministic-trends.html"><i class="fa fa-check"></i><b>9.4</b> Stochastic and deterministic trends</a></li> <li class="chapter" data-level="9.5" data-path="dhr.html"><a href="dhr.html"><i class="fa fa-check"></i><b>9.5</b> Dynamic harmonic regression</a></li> <li class="chapter" data-level="9.6" data-path="lagged-predictors.html"><a href="lagged-predictors.html"><i class="fa fa-check"></i><b>9.6</b> Lagged predictors</a></li> <li class="chapter" data-level="9.7" data-path="dynamic-exercises.html"><a href="dynamic-exercises.html"><i class="fa fa-check"></i><b>9.7</b> Exercises</a></li> <li class="chapter" data-level="9.8" data-path="dynamic-reading.html"><a href="dynamic-reading.html"><i class="fa fa-check"></i><b>9.8</b> Further reading</a></li> </ul></li> <li class="chapter" data-level="10" data-path="hierarchical.html"><a href="hierarchical.html"><i class="fa fa-check"></i><b>10</b> Forecasting hierarchical or grouped time series</a> <ul> <li class="chapter" data-level="10.1" data-path="hts.html"><a href="hts.html"><i class="fa fa-check"></i><b>10.1</b> Hierarchical time series</a></li> <li class="chapter" data-level="10.2" data-path="gts.html"><a href="gts.html"><i class="fa fa-check"></i><b>10.2</b> Grouped time series</a></li> <li class="chapter" data-level="10.3" data-path="bottom-up.html"><a href="bottom-up.html"><i class="fa fa-check"></i><b>10.3</b> The bottom-up approach</a></li> <li class="chapter" data-level="10.4" data-path="top-down.html"><a href="top-down.html"><i class="fa fa-check"></i><b>10.4</b> Top-down approaches</a></li> <li class="chapter" data-level="10.5" data-path="middle-out.html"><a href="middle-out.html"><i class="fa fa-check"></i><b>10.5</b> Middle-out approach</a></li> <li class="chapter" data-level="10.6" data-path="mapping-matrices.html"><a href="mapping-matrices.html"><i class="fa fa-check"></i><b>10.6</b> Mapping matrices</a></li> <li class="chapter" data-level="10.7" data-path="reconciliation.html"><a href="reconciliation.html"><i class="fa fa-check"></i><b>10.7</b> The optimal reconciliation approach</a></li> <li class="chapter" data-level="10.8" data-path="hierarchical-exercises.html"><a href="hierarchical-exercises.html"><i class="fa fa-check"></i><b>10.8</b> Exercises</a></li> <li class="chapter" data-level="10.9" data-path="hierarchical-reading.html"><a href="hierarchical-reading.html"><i class="fa fa-check"></i><b>10.9</b> Further reading</a></li> </ul></li> <li class="chapter" data-level="11" data-path="advanced.html"><a href="advanced.html"><i class="fa fa-check"></i><b>11</b> Advanced forecasting methods</a> <ul> <li class="chapter" data-level="11.1" data-path="complexseasonality.html"><a href="complexseasonality.html"><i class="fa fa-check"></i><b>11.1</b> Complex seasonality</a></li> <li class="chapter" data-level="11.2" data-path="VAR.html"><a href="VAR.html"><i class="fa fa-check"></i><b>11.2</b> Vector autoregressions</a></li> <li class="chapter" data-level="11.3" data-path="nnetar.html"><a href="nnetar.html"><i class="fa fa-check"></i><b>11.3</b> Neural network models</a></li> <li class="chapter" data-level="11.4" data-path="bootstrap.html"><a href="bootstrap.html"><i class="fa fa-check"></i><b>11.4</b> Bootstrapping and bagging</a></li> <li class="chapter" data-level="11.5" data-path="advanced-exercises.html"><a href="advanced-exercises.html"><i class="fa fa-check"></i><b>11.5</b> Exercises</a></li> <li class="chapter" data-level="11.6" data-path="advanced-reading.html"><a href="advanced-reading.html"><i class="fa fa-check"></i><b>11.6</b> Further reading</a></li> </ul></li> <li class="chapter" data-level="12" data-path="practical.html"><a href="practical.html"><i class="fa fa-check"></i><b>12</b> Some practical forecasting issues</a> <ul> <li class="chapter" data-level="12.1" data-path="weekly.html"><a href="weekly.html"><i class="fa fa-check"></i><b>12.1</b> Weekly, daily and sub-daily data</a></li> <li class="chapter" data-level="12.2" data-path="counts.html"><a href="counts.html"><i class="fa fa-check"></i><b>12.2</b> Time series of counts</a></li> <li class="chapter" data-level="12.3" data-path="limits.html"><a href="limits.html"><i class="fa fa-check"></i><b>12.3</b> Ensuring forecasts stay within limits</a></li> <li class="chapter" data-level="12.4" data-path="combinations.html"><a href="combinations.html"><i class="fa fa-check"></i><b>12.4</b> Forecast combinations</a></li> <li class="chapter" data-level="12.5" data-path="aggregates.html"><a href="aggregates.html"><i class="fa fa-check"></i><b>12.5</b> Prediction intervals for aggregates</a></li> <li class="chapter" data-level="12.6" data-path="backcasting.html"><a href="backcasting.html"><i class="fa fa-check"></i><b>12.6</b> Backcasting</a></li> <li class="chapter" data-level="12.7" data-path="long-short-ts.html"><a href="long-short-ts.html"><i class="fa fa-check"></i><b>12.7</b> Very long and very short time series</a></li> <li class="chapter" data-level="12.8" data-path="forecasting-on-training-and-test-sets.html"><a href="forecasting-on-training-and-test-sets.html"><i class="fa fa-check"></i><b>12.8</b> Forecasting on training and test sets</a></li> <li class="chapter" data-level="12.9" data-path="missing-outliers.html"><a href="missing-outliers.html"><i class="fa fa-check"></i><b>12.9</b> Dealing with missing values and outliers</a></li> <li class="chapter" data-level="12.10" data-path="further-reading.html"><a href="further-reading.html"><i class="fa fa-check"></i><b>12.10</b> Further reading</a></li> </ul></li> <li class="chapter" data-level="" data-path="appendix-using-r.html"><a href="appendix-using-r.html"><i class="fa fa-check"></i>Appendix: Using R</a></li> <li class="chapter" data-level="" data-path="appendix-for-instructors.html"><a href="appendix-for-instructors.html"><i class="fa fa-check"></i>Appendix: For instructors</a></li> <li class="chapter" data-level="" data-path="appendix-reviews.html"><a href="appendix-reviews.html"><i class="fa fa-check"></i>Appendix: Reviews</a></li> <li class="chapter" data-level="" data-path="translations.html"><a href="translations.html"><i class="fa fa-check"></i>Translations</a></li> <li class="chapter" data-level="" data-path="about-the-authors.html"><a href="about-the-authors.html"><i class="fa fa-check"></i>About the authors</a></li> <li class="chapter" data-level="" data-path="buy-a-print-or-downloadable-version.html"><a href="buy-a-print-or-downloadable-version.html"><i class="fa fa-check"></i>Buy a print or downloadable version</a></li> <li class="chapter" data-level="" data-path="report-an-error.html"><a href="report-an-error.html"><i class="fa fa-check"></i>Report an error</a></li> <li class="chapter" data-level="" data-path="bibliography.html"><a href="bibliography.html"><i class="fa fa-check"></i>Bibliography</a></li> <li class="divider"></li> <li><a href="https://OTexts.com" target="blank">Published by OTexts™ with bookdown</a></li> </ul> </nav> </div> <div class="book-body"> <div class="body-inner"> <div class="book-header" role="navigation"> <h1> <i class="fa fa-circle-o-notch fa-spin"></i><a href="./">Forecasting: Principles and Practice <font size=-1>(2nd ed)</font></a> </h1> </div> <div class="page-wrapper" tabindex="-1" role="main"> <div class="page-inner"> <section class="normal" id="section-"> <div id="stl" class="section level2 hasAnchor" number="6.6"> <h2><span class="header-section-number">6.6</span> STL decomposition<a href="stl.html#stl" class="anchor-section" aria-label="Anchor link to header"></a></h2> <p>STL is a versatile and robust method for decomposing time series. STL is an acronym for “Seasonal and Trend decomposition using Loess”, while Loess is a method for estimating nonlinear relationships. The STL method was developed by <span class="citation">R. B. Cleveland, Cleveland, McRae, &amp; Terpenning (<a href="#ref-Cleveland1990">1990</a>)</span>.</p> <p>STL has several advantages over the classical, SEATS and X11 decomposition methods:</p> <ul> <li><p>Unlike SEATS and X11, STL will handle any type of seasonality, not only monthly and quarterly data.</p></li> <li><p>The seasonal component is allowed to change over time, and the rate of change can be controlled by the user.</p></li> <li><p>The smoothness of the trend-cycle can also be controlled by the user.</p></li> <li><p>It can be robust to outliers (i.e., the user can specify a robust decomposition), so that occasional unusual observations will not affect the estimates of the trend-cycle and seasonal components. They will, however, affect the remainder component.</p></li> </ul> <p>On the other hand, STL has some disadvantages. In particular, it does not handle trading day or calendar variation automatically, and it only provides facilities for additive decompositions.</p> <p>It is possible to obtain a multiplicative decomposition by first taking logs of the data, then back-transforming the components. Decompositions between additive and multiplicative can be obtained using a Box-Cox transformation of the data with <span class="math inline">\(0&lt;\lambda&lt;1\)</span>. A value of <span class="math inline">\(\lambda=0\)</span> corresponds to the multiplicative decomposition while <span class="math inline">\(\lambda=1\)</span> is equivalent to an additive decomposition.</p> <p>The best way to begin learning how to use STL is to see some examples and experiment with the settings. Figure <a href="components.html#fig:elecequip-stl">6.2</a> showed an example of STL applied to the electrical equipment orders data. Figure <a href="stl.html#fig:elecequip-stl2">6.13</a> shows an alternative STL decomposition where the trend-cycle is more flexible, the seasonal component does not change over time, and the robust option has been used. Here, it is more obvious that there has been a down-turn at the end of the series, and that the orders in 2009 were unusually low (corresponding to some large negative values in the remainder component).</p> <div class="sourceCode" id="cb102"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb102-1"><a href="stl.html#cb102-1" tabindex="-1"></a>elecequip <span class="sc">%&gt;%</span></span> <span id="cb102-2"><a href="stl.html#cb102-2" tabindex="-1"></a> <span class="fu">stl</span>(<span class="at">t.window=</span><span class="dv">13</span>, <span class="at">s.window=</span><span class="st">&quot;periodic&quot;</span>, <span class="at">robust=</span><span class="cn">TRUE</span>) <span class="sc">%&gt;%</span></span> <span id="cb102-3"><a href="stl.html#cb102-3" tabindex="-1"></a> <span class="fu">autoplot</span>()</span></code></pre></div> <div class="figure" style="text-align: center"><span style="display:block;" id="fig:elecequip-stl2"></span> <img src="fpp_files/figure-html/elecequip-stl2-1.png" alt="The electrical equipment orders (top) and its three additive components obtained from a robust STL decomposition with flexible trend-cycle and fixed seasonality." width="100%" /> <p class="caption"> Figure 6.13: The electrical equipment orders (top) and its three additive components obtained from a robust STL decomposition with flexible trend-cycle and fixed seasonality. </p> </div> <p>The two main parameters to be chosen when using STL are the trend-cycle window (<code>t.window</code>) and the seasonal window (<code>s.window</code>). These control how rapidly the trend-cycle and seasonal components can change. Smaller values allow for more rapid changes. Both <code>t.window</code> and <code>s.window</code> should be odd numbers; <code>t.window</code> is the number of consecutive observations to be used when estimating the trend-cycle; <code>s.window</code> is the number of consecutive years to be used in estimating each value in the seasonal component. The user must specify <code>s.window</code> as there is no default. Setting it to be infinite is equivalent to forcing the seasonal component to be periodic (i.e., identical across years). Specifying <code>t.window</code> is optional, and a default value will be used if it is omitted.</p> <p>The <code>mstl()</code> function provides a convenient automated STL decomposition using <code>s.window=13</code>, and <code>t.window</code> also chosen automatically. This usually gives a good balance between overfitting the seasonality and allowing it to slowly change over time. But, as with any automated procedure, the default settings will need adjusting for some time series.</p> <p>As with the other decomposition methods discussed in this book, to obtain the separate components plotted in Figure <a href="classical-decomposition.html#fig:classical-elecequip">6.8</a>, use the <code>seasonal()</code> function for the seasonal component, the <code>trendcycle()</code> function for trend-cycle component, and the <code>remainder()</code> function for the remainder component. The <code>seasadj()</code> function can be used to compute the seasonally adjusted series.</p> </div> <h3>Bibliography<a href="bibliography.html#bibliography" class="anchor-section" aria-label="Anchor link to header"></a></h3> <div id="refs" class="references csl-bib-body hanging-indent" entry-spacing="0"> <div id="ref-Cleveland1990" class="csl-entry"> Cleveland, R. B., Cleveland, W. S., McRae, J. E., &amp; Terpenning, I. J. (1990). <span>STL</span>: A seasonal-trend decomposition procedure based on loess. <em>Journal of Official Statistics</em>, <em>6</em>(1), 3–33. <a href="http://bit.ly/stl1990">http://bit.ly/stl1990</a> </div> </div> </section> </div> </div> </div> <a href="seats.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a> <a href="seasonal-strength.html" class="navigation navigation-next " aria-label="Next page"><i class="fa fa-angle-right"></i></a> </div> </div> <script src="libs/gitbook-2.6.7/js/app.min.js"></script> <script src="libs/gitbook-2.6.7/js/clipboard.min.js"></script> <script src="libs/gitbook-2.6.7/js/plugin-search.js"></script> <script src="libs/gitbook-2.6.7/js/plugin-sharing.js"></script> <script src="libs/gitbook-2.6.7/js/plugin-fontsettings.js"></script> <script src="libs/gitbook-2.6.7/js/plugin-bookdown.js"></script> <script src="libs/gitbook-2.6.7/js/jquery.highlight.js"></script> <script src="libs/gitbook-2.6.7/js/plugin-clipboard.js"></script> <script> gitbook.require(["gitbook"], function(gitbook) { gitbook.start({ "sharing": { "github": false, "facebook": true, "twitter": true, "linkedin": false, "weibo": false, "instapaper": false, "vk": false, "whatsapp": false, "all": ["facebook", "twitter", "linkedin", "weibo", "instapaper"] }, "fontsettings": { "theme": "white", "family": "sans", "size": 2 }, "edit": { "link": null, "text": null }, "history": { "link": null, "text": null }, "view": { "link": null, "text": null }, "download": null, "search": { "engine": "fuse", "options": null }, "toc": { "collapse": "section" } }); }); </script> <!-- dynamically load mathjax for compatibility with self-contained --> <script> (function () { var script = document.createElement("script"); script.type = "text/javascript"; var src = "true"; if (src === "" || src === "true") src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/latest.js?config=TeX-MML-AM_CHTML"; if (location.protocol !== "file:") if (/^https?:/.test(src)) src = src.replace(/^https?:/, ''); script.src = src; document.getElementsByTagName("head")[0].appendChild(script); })(); </script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10