Time Series Data and Forecasting FoundationsIntroductionMany business measurements are recorded in time order: daily sales, monthly revenue, hourly website traffic, quarterly employment, inventory levels, energy consumption and customer complaints. Such data are called time series. Their defining feature is not merely that observations have dates, but that the order of observations may contain information. Today’s demand may depend on yesterday’s demand; sales in December may resemble sales in the previous December; and a sudden policy change may permanently alter the level of a series. Predictive analytics for time series therefore differs from ordinary cross-sectional prediction. Randomly mixing observations between training and testing can allow information from the future to influence the past. A sound forecasting process begins by understanding temporal dependence, identifying the major components of a series, visualizing the data, assessing stationarity and structural change, and establishing simple benchmark forecasts. This chapter develops those foundations. It emphasizes practical interpretation rather than advanced model estimation. The methods introduced here—naïve, seasonal-naïve and moving-average benchmarks—are simple, transparent and essential for evaluating more complex models later. Learning objectivesBy the end of this chapter, you should be able to: - Explain why time order and temporal dependence matter in forecasting.
- Distinguish trend, seasonality, cycles, irregular variation and structural breaks.
- Explain stationarity and autocorrelation in practical terms.
- Select suitable visualizations for time series data.
- Construct naïve, seasonal-naïve and moving-average forecasts.
- Recognize common data-quality, validation and governance risks.
- Interpret benchmark results in a business context.
1. What makes time series data different?A time series consists of observations indexed by time. Let yt denote the observed value at time t, where t = 1, 2, ..., T and T is the number of observations. The interval between observations should be clearly defined: hourly, daily, weekly, monthly or quarterly, for example. The time index is meaningful. If a retailer records sales of 120 units on Monday, 135 on Tuesday and 150 on Wednesday, the sequence is not equivalent to the same values in a different order. The later observations may be influenced by earlier observations, promotions, weather or operational constraints. This dependence creates both opportunity and risk. It creates opportunity because past values can help predict future values. It creates risk because standard statistical procedures that assume independent observations may be inappropriate. It also means that a model can appear accurate if it accidentally uses future information, even though it would fail in production. Temporal dependenceTemporal dependence exists when observations close in time are systematically related. Positive dependence occurs when high values tend to follow high values and low values follow low values. Negative dependence occurs when high values tend to be followed by low values, or vice versa. Dependence may arise from: - customer habits and repeat purchasing;
- production and inventory adjustment delays;
- contractual or subscription arrangements;
- weather and other slowly changing conditions;
- calendar effects;
- persistence in economic or operational processes.
A useful operational question is: If I know the recent history, does it improve my prediction of the next observation? If the answer is yes, the order of the data should be preserved in analysis and validation. Time-index integrityBefore modelling, verify: - that timestamps use a consistent time zone;
- that observations are sorted chronologically;
- that the sampling interval is understood;
- that duplicate timestamps are resolved;
- that missing periods are identified;
- that units and definitions remain consistent;
- that business closures, holidays and calendar changes are recorded.
A monthly series can be misinterpreted if one month is missing. A daily series can be distorted if weekends are absent in some periods but represented as zero in others. Missing data and genuine zero demand are not interchangeable. 2. Components of a time seriesA time series is often interpreted through several components. A common additive representation is: yt = Tt + St + Ct + It Here, yt is the observation at time t, Tt is the trend component, St is the seasonal component, Ct is the cyclical component and It is the irregular component. All components must be measured in the same units as yt. This decomposition is conceptual unless a specific decomposition method is used. An alternative is the multiplicative representation: yt = Tt × St × Ct × It The multiplicative form is useful when seasonal fluctuations grow as the level of the series grows. For example, a store may have seasonal sales variation of approximately 10,000 units when annual sales are high but only 5,000 units when annual sales are low. A logarithmic transformation can convert multiplication into addition when all values are positive: ln(yt) = ln(Tt) + ln(St) + ln(Ct) + ln(It) The choice between additive and multiplicative thinking should be guided by the plotted data and domain knowledge. Neither decomposition should be treated as proof that the underlying business process literally consists of four separately generated quantities. TrendA trend is a persistent long-term direction in the level of a series. It may be upward, downward or nonlinear. Examples include growth in online orders as a business expands, declining demand for an obsolete product and increasing productivity following process improvement. Trend is not the same as a straight line. A series may have a changing growth rate, temporary plateaus or periods of decline. Analysts should avoid extrapolating a trend mechanically without considering market capacity, competition and business strategy. SeasonalitySeasonality is a systematic pattern that repeats at a known and fixed calendar frequency. Examples include: - higher retail sales every December;
- lower electricity demand on weekends;
- increased hotel occupancy during holiday periods;
- monthly payroll patterns caused by pay schedules.
If data are monthly and the annual seasonal cycle is stable, the seasonal period is m = 12. For weekly observations with a daily cycle, m = 7 may be appropriate, although working-day and holiday effects may complicate the pattern. Seasonality is predictable in timing, but its size may change. A seasonal effect can be additive, where the difference between peak and trough is approximately constant, or multiplicative, where the relative difference is approximately constant. CyclesA cycle is a longer-term fluctuation that does not have a fixed, known period. Business cycles linked to economic expansion and contraction are a common example. Unlike seasonality, cycles may vary in length and amplitude. A cycle should not be labelled seasonal merely because it looks repetitive in a short sample. Irregular variationIrregular variation includes short-lived, difficult-to-predict effects such as supply disruptions, unusual weather, data errors or one-off events. Irregular does not necessarily mean meaningless: an apparent outlier may reveal a process failure or a permanent change. Structural breaksA structural break occurs when the data-generating process changes. The change may affect the level, trend, variance, seasonal pattern or relationships between variables. Examples include: - a new pricing policy;
- a merger or store closure;
- a pandemic or natural disaster;
- a change in measurement systems;
- a regulatory intervention;
- a major product launch.
A break is not simply an extreme observation. An extreme observation is often temporary; a structural break changes the future behaviour of the series. Forecasting models trained on pre-break data may be unreliable after the break. 3. Visualizing time seriesVisualization is a diagnostic activity, not merely a presentation step. A time plot places time on the horizontal axis and the measured variable on the vertical axis. It can reveal trend, seasonality, outliers, missing intervals, changing variability and possible breaks. A basic time plot should include: - a clear title and variable name;
- time units and an appropriately scaled axis;
- measurement units;
- observations connected in chronological order;
- annotations for known interventions or unusual events where useful.
Additional useful plotsA seasonal plot overlays observations from comparable seasons—for example, all January-to-December paths across several years. It helps distinguish a stable seasonal pattern from a changing one. A seasonal subseries plot groups observations by season, such as all January values together, all February values together and so on. It can show whether one month consistently differs from another and whether the seasonal effect changes over time. A lag plot compares yt with a previous value yt-k. A strong pattern can indicate dependence at lag k. A scatterplot of yt against yt-1 is especially useful for detecting persistence. A rolling mean and rolling standard deviation can show changing location and variability. For a window of width w, the trailing moving average is: MAt = (yt + yt-1 + ... + yt-w+1) ÷ w Here, MAt is the average of the most recent w observations. The observations must be equally spaced, and the calculation is unavailable until w observations exist. A centred moving average uses observations before and after time t and is useful for descriptive smoothing, but it cannot be used directly for real-time forecasting when future observations are unavailable. A correlogram or autocorrelation function plot displays correlation at different lags. It can suggest persistence, seasonality and the need for transformation, but it should be interpreted alongside the time plot and business knowledge. 4. StationarityA stationary series has statistical properties that are stable over time. In the strict sense, the joint probability behaviour is unchanged by shifting the time origin. In practical forecasting, analysts often use the weaker concept of weak stationarity: a constant mean, constant variance and autocovariance that depends on the lag rather than the calendar time. For weak stationarity, the following conditions are commonly expressed as: E(yt) = μ Var(yt) = σ² Cov(yt, yt-k) = γk Here, E(yt) is the expected value, μ is a constant mean, Var(yt) is the variance, σ² is a constant finite variance, Cov(·) is covariance, k is a lag and γk depends only on k. These conditions apply to a stochastic process under the stated assumptions; a finite observed sample cannot prove stationarity. A strong trend, changing variance or evolving seasonal pattern suggests non-stationarity. Non-stationarity matters because correlations and model parameters estimated from one period may not apply in another. It can also produce misleading relationships between unrelated trending series. Practical approaches to non-stationarityPossible responses include: - modelling the trend explicitly;
- subtracting consecutive observations, called first differencing:
∆yt = yt − yt-1 - applying seasonal differencing:
∆m yt = yt − yt-m - using a logarithm or another variance-stabilizing transformation when values are positive;
- incorporating seasonal indicators or seasonal models;
- separating periods before and after a structural break;
- using models designed to represent changing levels.
Differencing should not be automatic. It can remove meaningful long-term information and may create unnecessary noise. The transformed series must be interpreted carefully, and forecasts may need to be converted back to the original scale. 5. AutocorrelationAutocorrelation measures the association between a series and its lagged values. The autocorrelation at lag k is commonly defined as: ρk = γk ÷ γ0 where γk = Cov(yt, yt-k) is the lag-k autocovariance and γ0 = Var(yt) is the variance. Because covariance and variance have the same squared units, ρk is dimensionless and generally lies between −1 and 1. In a finite sample, the sample autocorrelation is estimated rather than known. A simple sample version uses deviations from the sample mean ȳ: rk = [∑ from t=k+1 to T (yt − ȳ)(yt-k − ȳ)] ÷ [∑ from t=1 to T (yt − ȳ)²] The exact small-sample properties depend on assumptions and the estimation convention. The practical interpretation is more important at this level: large positive autocorrelation at short lags indicates persistence, while peaks at seasonal lags can indicate seasonality. Autocorrelation does not establish causation. It may arise from trend, seasonality, omitted variables or a shared external shock. Analysts should avoid describing autocorrelation as a causal effect. 6. Forecasting benchmarksA benchmark is a simple forecasting method against which more sophisticated methods are compared. A complex model is useful only if it improves on an appropriate benchmark under a fair evaluation design. Naïve forecastThe naïve forecast uses the most recent observation as the forecast for every future period: ŷT+h|T = yT Here, ŷT+h|T is the forecast made at time T for horizon h, and yT is the latest observed value. The method is appropriate as a strong baseline for series that behave like a random walk or have substantial level persistence. It does not explicitly model trend or seasonality. Seasonal-naïve forecastFor a series with seasonal period m, the seasonal-naïve forecast repeats the observation from the same season in the previous cycle: ŷT+h|T = yT+h−m This formula is applied when the referenced historical observation exists. For example, with monthly data and m = 12, the forecast for March next year equals the observed March value this year. The method assumes that the most recent seasonal cycle is a useful representation of the next cycle. Moving-average forecastA trailing moving-average forecast uses the average of the latest w observations: ŷT+1|T = (yT + yT−1 + ... + yT−w+1) ÷ w For multi-step forecasts, an implementation must specify whether actual observations are used when they become available or whether previous forecasts are recursively included. A simple recursive version replaces unavailable future observations with their forecasts. Moving averages smooth short-term noise, but they can lag behind turning points and can perform poorly when strong trend or seasonality is present. Worked example: three benchmarksSuppose weekly demand for the last six weeks is 100, 110, 105, 115, 120 and 125 units. The latest observation is week 6, so the one-week-ahead naïve forecast is: ŷ7|6 = 125 units. Using a three-week moving average: ŷ7|6 = (115 + 120 + 125) ÷ 3 = 360 ÷ 3 = 120 units. If the series had a seasonal period of 4 weeks and demand in week 3 was 105 units, the seasonal-naïve forecast for week 7 would be: ŷ7|6 = y3 = 105 units. The forecasts differ because they encode different assumptions. The naïve method emphasizes the latest level; the moving average emphasizes recent history equally; the seasonal-naïve method emphasizes the corresponding seasonal position. 7. Forecast evaluation and leakage controlForecast evaluation must reproduce the information available at the time a forecast would have been made. A chronological split is therefore preferable to a random split. For example, earlier observations can be used for training and later observations for testing. A rolling-origin evaluation repeatedly trains on an expanding or moving historical window and forecasts a future period. This reveals whether performance is stable across time and whether a method fails after a regime change. Common error measures include mean absolute error: MAE = (1/n) × ∑ from i=1 to n |yi − ŷi| and root mean squared error: RMSE = √[(1/n) × ∑ from i=1 to n (yi − ŷi)²] Here, n is the number of evaluated forecasts, yi is the actual value and ŷi is the forecast. Both measures have the same units as the target. RMSE penalizes large errors more heavily than MAE because errors are squared before averaging. Percentage-based measures can be problematic when actual values are zero or close to zero. No single metric is universally best. The business cost of under-forecasting may differ from the cost of over-forecasting, so operational consequences should influence metric selection. Data leakage occurs when information unavailable at forecast time enters model training or feature construction. Examples include using a centred moving average that includes future values, scaling the entire dataset before a chronological split, and using a revised historical value that was not available at the decision date. Leakage produces overly optimistic results. 8. Applied case: forecasting weekly pharmacy demandThis is an illustrative case. BackgroundA regional pharmacy chain wants to forecast weekly demand for a common respiratory product. The supply team needs a preliminary forecast before adopting more advanced models. ProblemThe data contain two years of weekly unit sales. A time plot shows a gradual increase in demand, sharp peaks during winter and occasional unusually high weeks. One store changed its opening hours halfway through the period. Several weeks contain missing records because of a system migration. AnalysisThe analyst first confirms that weeks are correctly ordered and distinguishes missing observations from zero sales. The opening-hours change is recorded as a possible structural break. A seasonal plot suggests an annual pattern, but only two annual cycles are available, so the seasonal estimate is uncertain. A lag plot and autocorrelation plot indicate persistence at lag 1 and a possible peak near lag 52. The analyst compares three benchmarks: - naïve forecast, using the latest week;
- seasonal-naïve forecast, using the same week in the previous year;
- four-week moving average.
The evaluation uses the final twelve weeks as a chronological test period. No centred smoothing is used for forecasting because it would use future information. Results are reported with MAE and RMSE, and errors are examined separately for ordinary weeks and winter peak weeks. Approach and solutionThe seasonal-naïve method performs best on ordinary winter weeks because the previous year provides useful seasonal information. However, it misses the demand increase following the opening-hours change. The naïve method responds more quickly to the new level but is unstable after isolated spikes. The moving average is smoother but lags during the rapid rise in winter demand. The supply team therefore adopts the seasonal-naïve forecast as the initial baseline, supplemented by a documented manual adjustment when current operational information indicates a level change. The team also plans to collect promotion, weather and opening-hours variables before developing a richer model. OutcomeThe company gains a transparent reference forecast and a reproducible evaluation process. More importantly, the analysis identifies that forecast performance depends on regime: a method that works during stable seasonal periods may fail after a structural break. Learning points- Data cleaning and time-index verification precede modelling.
- Seasonal-naïve forecasting is powerful when seasonal repetition is stable.
- Structural breaks require contextual investigation rather than automatic treatment as outliers.
- A benchmark should be evaluated at the horizons and periods relevant to decisions.
- Human adjustments must be documented so that they can be audited and assessed.
9. Professional practice, governance and limitationsTime series forecasting can affect staffing, inventory, credit decisions, public services and healthcare access. Forecasts should therefore be treated as decision-support evidence, not unquestionable truth. Important governance practices include: - documenting data sources, definitions and revisions;
- preserving an audit trail of forecast versions;
- reporting uncertainty and known limitations;
- monitoring performance after deployment;
- checking whether errors are systematically larger for particular regions, customers or communities;
- protecting personal and commercially sensitive information;
- obtaining appropriate authorization before using external data.
Forecasts may reproduce historical inequities. For example, a service with historically lower recorded demand may receive fewer resources even when low demand reflects poor access rather than low need. Analysts should distinguish observed demand from unmet demand where possible. Modern forecasting platforms can automate decomposition, backtesting and model comparison. Automation does not remove the need for judgment: a system may silently mishandle missing periods, calendar changes or structural breaks. Artificial intelligence methods may improve accuracy in some settings, but they should still be compared with transparent benchmarks and evaluated using leakage-resistant procedures. 10. Best-practice workflowA practical foundation workflow is: - Define the forecasting target, horizon, frequency and decision use.
- Validate timestamps, units, duplicates, missing periods and revisions.
- Plot the series and annotate known events.
- Investigate trend, seasonality, cycles, outliers and structural breaks.
- Examine lag relationships and assess whether stationarity is plausible.
- Establish naïve, seasonal-naïve and moving-average benchmarks.
- Use chronological or rolling-origin evaluation.
- Select error measures that reflect the business cost of errors.
- Document assumptions, interventions and limitations.
- Monitor performance and data quality after implementation.
The central professional principle is simple: understand the time structure before selecting an algorithm. Chapter SummaryTime series data are ordered observations whose temporal dependence can provide predictive information. Their analysis requires attention to time-index integrity, missing periods, calendar effects and information leakage. Important components include trend, fixed-period seasonality, less regular cycles, irregular variation and structural breaks. Visualization through time plots, seasonal plots, lag plots, rolling summaries and autocorrelation displays helps reveal these features. Stationarity describes stability in statistical properties; non-stationarity may arise from trend, seasonality, changing variance or structural change. Autocorrelation measures association between observations separated by a lag, but it does not establish causation. Naïve, seasonal-naïve and moving-average methods provide transparent forecasting benchmarks. Their value lies not only in simplicity but also in creating a fair standard for evaluating advanced models. Chronological testing, rolling-origin evaluation and leakage control are essential. Finally, professional forecasting requires documentation, monitoring, ethical awareness and interpretation in the context of real decisions. Key TermsTime series: Observations recorded in temporal order. Temporal dependence: Statistical dependence between observations at different times. Trend: A persistent long-term direction in a series. Seasonality: A pattern that repeats at a known calendar frequency. Cycle: A longer-term fluctuation with a variable or uncertain duration. Irregular variation: Short-lived or unpredictable movement not explained by systematic components. Structural break: A change in the process generating the observations. Additive decomposition: A representation in which components are summed. Multiplicative decomposition: A representation in which components are multiplied. Stationarity: Stability of relevant statistical properties over time. Autocorrelation: Correlation between a series and a lagged version of itself. Lag: The number of time intervals separating two observations. Naïve forecast: A forecast equal to the latest observed value. Seasonal-naïve forecast: A forecast equal to the observation from the corresponding previous season. Moving average: An average calculated over a fixed number of recent observations. Rolling-origin evaluation: Repeated chronological forecast testing using successive forecast origins. Data leakage: Use of information in model development that would not be available at forecast time. MAE: Mean absolute error, the average absolute forecast error. RMSE: Root mean squared error, which penalizes large errors more strongly than MAE. Review QuestionsShort Answer Questions- Why must time series observations generally be kept in chronological order during analysis and validation?
- Distinguish seasonality from a cycle.
- What is a structural break? Give one business example.
- State the practical meaning of stationarity.
- Why is a seasonal-naïve forecast useful as a benchmark?
Long Answer Questions- Explain the components of a time series and compare additive and multiplicative representations.
- Discuss how time plots, seasonal plots, lag plots and autocorrelation plots support time series diagnosis.
- Explain autocorrelation, including its interpretation and limitations.
- Compare naïve, seasonal-naïve and moving-average forecasting methods.
- Describe a leakage-resistant process for evaluating time series forecasts.
Analytical / Application Questions- A monthly retailer has strong December sales, a rising long-term trend and a major pricing change in July. Explain which features should be investigated and how they could affect benchmark selection.
- Weekly demand for the last three weeks is 240, 260 and 250 units. Calculate the one-week-ahead naïve forecast and the three-week moving-average forecast, then explain why they differ.
- A forecasting model performs well before a company merger but poorly afterward. Diagnose possible causes and recommend an evaluation and monitoring approach.
Multiple Choice Questions with AnswersQuestion 1Which feature most directly distinguishes time series data from ordinary unordered observations? A. The observations are always numerical B. The observations are recorded in a meaningful temporal order C. The observations contain no missing values D. The observations always have a constant mean Correct Answer: B. The observations are recorded in a meaningful temporal order Question 2A pattern that repeats every December is best classified as: A. A structural break B. A cycle C. Seasonality D. Irregular variation Correct Answer: C. Seasonality Question 3For a seasonal period of 12, the seasonal-naïve forecast for next March uses: A. The latest observed month B. The average of all observations C. The observed March value from the previous annual cycle D. The observed February value from the current year Correct Answer: C. The observed March value from the previous annual cycle Question 4Which condition is associated with weak stationarity? A. A mean that increases each year B. A variance that changes after every observation C. A constant mean and variance with covariance depending on lag D. A seasonal pattern whose period changes randomly Correct Answer: C. A constant mean and variance with covariance depending on lag Question 5A three-week moving-average forecast based on observations 240, 260 and 250 is: A. 240 units B. 250 units C. 260 units D. 750 units Correct Answer: B. 250 units Question 6What does a structural break represent? A. A random rounding error B. A permanent or regime-changing alteration in the data-generating process C. A normal seasonal peak D. A missing label on a chart Correct Answer: B. A permanent or regime-changing alteration in the data-generating process Question 7Which practice creates a risk of forecast leakage? A. Using a chronological test set B. Using only information available at the forecast date C. Using a centred moving average containing future observations D. Evaluating a benchmark before a complex model Correct Answer: C. Using a centred moving average containing future observations Question 8Compared with MAE, RMSE generally: A. Ignores large errors B. Penalizes large errors more strongly C. Has no measurement units D. Can only be used for seasonal data Correct Answer: B. Penalizes large errors more strongly Question 9A high positive autocorrelation at lag 1 suggests that: A. Adjacent observations tend to move together B. The series has no temporal dependence C. The series must contain a causal relationship D. All observations are identical Correct Answer: A. Adjacent observations tend to move together Question 10Why should a benchmark be used when developing a sophisticated forecasting model? A. To guarantee that the complex model is correct B. To provide a transparent reference for judging improvement C. To eliminate the need for validation D. To replace business knowledge Correct Answer: B. To provide a transparent reference for judging improvement
|