Time-Series Analysis and ForecastingIntroduction and ContextA time series is a sequence of observations recorded in chronological order, such as daily sales, monthly demand, quarterly revenue, hourly website traffic, or annual employment. Time-series analysis differs from ordinary cross-sectional analysis because the order of observations matters. Values close together in time are often related, and the data-generating process may change through trend, seasonality, economic cycles, interventions, or structural breaks. Forecasting uses historical and contextual information to estimate future values. It supports inventory decisions, workforce scheduling, cash-flow planning, production capacity, budgeting, pricing, and financial risk management. A forecast is not a guaranteed prediction; it is an estimate conditional on the information, assumptions, and model available at the forecasting time. This chapter develops a practical framework for analysing time-series structure and selecting forecasting methods. It covers decomposition, smoothing, autocorrelation, regression, ARIMA, forecast evaluation, implementation, and managerial interpretation. Learning ObjectivesBy the end of this chapter, you should be able to: - Distinguish trend, seasonality, cycles, irregular variation, and autocorrelation.
- Prepare and visualise time-series data appropriately.
- Apply moving averages, exponential smoothing, and decomposition.
- Explain stationarity and use differencing appropriately.
- Interpret autocorrelation and partial autocorrelation.
- Build and interpret regression-based and ARIMA forecasts.
- Evaluate forecasts using suitable accuracy measures and validation designs.
- Translate forecasts into decisions about demand, sales, finance, and capacity.
- Recognise limitations, ethical risks, and governance requirements.
1. The Structure of a Time SeriesLet yt denote the observed value at time t, where t = 1, 2, ..., n. The time index may represent days, weeks, months, quarters, or years. Observations should normally be equally spaced for standard time-series models. A useful conceptual decomposition is: yt = Tt + St + Ct + It where Tt is the trend, St is the seasonal component, Ct is the cyclical component, and It is irregular or residual variation. This is an additive decomposition and is appropriate when the size of seasonal fluctuations is approximately constant over time. A multiplicative decomposition is: yt = Tt × St × Ct × It It is more suitable when fluctuations increase in proportion to the level of the series. Taking logarithms converts a multiplicative relationship into an additive one, provided all observations are positive: ln(yt) = ln(Tt) + ln(St) + ln(Ct) + ln(It) TrendTrend is the long-term direction of a series. It may be linear, nonlinear, increasing, decreasing, or temporarily interrupted. A trend does not imply that every observation rises or falls; short-term deviations are expected. SeasonalitySeasonality is a systematic and calendar-related pattern that repeats at a known frequency, such as higher retail sales every December or increased electricity demand on weekdays. If monthly data have annual seasonality, the seasonal period is m = 12. For quarterly data, it is commonly m = 4. CyclesCyclical movements are medium- or long-term fluctuations associated with economic, industry, or business conditions. Unlike seasonality, cycles do not necessarily have a fixed length or amplitude. A recession and subsequent recovery may form a cycle, but its timing cannot be assumed to repeat exactly. Irregular variation and outliersIrregular variation includes random shocks, measurement error, unusual events, and one-off interventions. An outlier may reflect a data error, or it may be a genuine event such as a strike, pandemic, promotion, or regulatory change. Removing an observation without investigation can damage the forecast. AutocorrelationAutocorrelation measures association between a series and its lagged values. The lag-k autocorrelation is: ρk = Cov(yt, yt-k) ÷ Var(yt) where Cov is covariance and Var is variance. In sample data, the sample autocorrelation is usually calculated after subtracting the sample mean. Positive autocorrelation means high values tend to follow high values and low values tend to follow low values. Negative autocorrelation indicates alternating behaviour. Autocorrelation is not automatically a problem. It is evidence of temporal structure that can be modelled. However, ignoring it in regression errors can produce unreliable standard errors and inefficient forecasts. 2. Preparing and Exploring Time-Series DataGood forecasting begins with data preparation rather than model selection. A professional workflow should include the following steps: - Define the forecasting variable, unit, time zone, and time granularity.
- Sort records chronologically and verify that timestamps are unique and equally spaced.
- Identify missing observations, duplicated records, impossible values, and changes in measurement definitions.
- Record events such as promotions, closures, price changes, strikes, and policy interventions.
- Plot the raw series and, where relevant, seasonal subseries or rolling summaries.
- Examine whether variance changes with the level and whether a transformation is justified.
- Separate the information available at the forecast origin from information that became available later.
A time plot often reveals more than a table. Analysts should look for level changes, trend reversals, seasonal peaks, changing variance, clusters of volatility, and isolated shocks. Aggregating daily data into monthly data can reduce noise, but it may also hide useful operational patterns. StationarityA weakly stationary series has a constant mean, constant variance, and autocovariance that depends on the lag rather than on calendar time. Many ARIMA procedures assume stationarity after suitable transformation. A trending or strongly seasonal series is usually not stationary in its original form. Differencing can remove a stochastic trend: ∆yt = yt − yt−1 Seasonal differencing with seasonal period m is: ∆m yt = yt − yt−m Differencing should be used only when needed. Over-differencing can create unnecessary noise and induce negative autocorrelation. Stationarity should be assessed using plots, domain knowledge, autocorrelation patterns, and formal tests such as the augmented Dickey–Fuller test. Formal tests are not decisive on their own because their results depend on sample size, specification, and structural breaks. 3. Smoothing and Baseline ForecastsSmoothing methods reduce short-term noise and provide forecasts based on recent information. They are valuable as operational tools and as benchmarks against which complex models should be compared. Naïve methodsThe naïve forecast uses the latest observation: ŷt+h|t = yt where ŷt+h|t is the forecast for h periods ahead using information through time t. It is appropriate for a random-walk-like series and is a powerful baseline. The seasonal naïve forecast uses the observation from the same season in the previous cycle: ŷt+h|t = yt+h−m This is useful for strongly seasonal demand with little change in level. Simple moving averageFor a moving average of window length k, the smoothed value is: MAt = (yt + yt−1 + ... + yt−k+1) ÷ k All observations receive equal weight. A larger k produces greater smoothing but responds more slowly to changes. A moving average is mainly a smoothing device; using it as a forecast requires careful alignment and produces lag when a trend exists. Simple exponential smoothingSimple exponential smoothing is appropriate for data with no systematic trend or seasonality: ℓt = αyt + (1−α)ℓt−1 and the forecast is: ŷt+h|t = ℓt Here ℓt is the estimated level and 0 < α < 1 is the smoothing parameter. A high α responds quickly to recent changes; a low α produces greater smoothing. Initial level selection must be specified, for example ℓ1 = y1. Holt’s method for trendHolt’s linear method estimates both level and trend: ℓt = αyt + (1−α)(ℓt−1 + bt−1) bt = β(ℓt − ℓt−1) + (1−β)bt−1 ŷt+h|t = ℓt + hbt where bt is the trend estimate, 0 < β < 1 is the trend smoothing parameter, and h is the forecast horizon. Forecasts may become unrealistic when a linear trend is extrapolated far beyond the observed data. Holt–Winters seasonal methodFor additive seasonality, a standard Holt–Winters formulation is: ℓt = α(yt − st−m) + (1−α)(ℓt−1+bt−1) bt = β(ℓt−ℓt−1) + (1−β)bt−1 st = γ(yt−ℓt) + (1−γ)st−m ŷt+h|t = ℓt + hbt + st−m+((h−1) mod m)+1 Here st is the seasonal component and 0 < γ < 1 is the seasonal smoothing parameter. Multiplicative versions use ratios rather than differences and require positive observations. Software implementations may use slightly different indexing and initialisation conventions, so documentation must be checked. 4. DecompositionDecomposition separates a series into interpretable components. Classical decomposition estimates moving averages to identify trend-cycle, derives seasonal indices, and calculates residuals. A practical additive representation is: Residualt = yt − Trendt − Seasonalt Seasonal indices in an additive model should sum approximately to zero over a complete seasonal cycle. In a multiplicative model, seasonal indices should average approximately one. Modern methods such as STL—Seasonal-Trend decomposition using Loess—use local regression and can be more robust to changing trends and unusual observations. Decomposition is useful for explanation, visualisation, and feature construction, but it is not necessarily the best forecasting model. Components estimated using the full dataset may also create leakage when evaluating historical forecasts. For honest evaluation, decomposition must be fitted using only data available at each forecast origin. 5. Regression-Based ForecastingRegression forecasting relates the target to time, seasonal indicators, interventions, and external drivers. A trend regression may be written as: yt = β0 + β1t + εt where β0 is the intercept, β1 is the average change per time unit, and εt is the error. A positive β1 indicates an upward linear trend, subject to model adequacy. Seasonality can be represented with dummy variables: yt = β0 + β1t + δ2D2t + ... + δmDmt + εt One season is omitted as the reference category to avoid perfect multicollinearity. Each δj measures the expected difference from the reference season, holding other terms constant. External predictors may include price, advertising, weather, population, economic indicators, or capacity constraints: yt = β0 + β1t + β2x1t + ... + βpxpt + εt Forecasting requires future values of the predictors. If those values are unknown, they must themselves be forecast or supplied through scenarios. This is a major distinction between explanatory modelling and forecasting. Time-series regression errors may be autocorrelated. A dynamic regression may include lagged predictors or an ARIMA model for the errors. Analysts should inspect residual plots and residual autocorrelation rather than relying only on coefficient significance. 6. ARIMA ModelsARIMA stands for AutoRegressive Integrated Moving Average. An ARIMA(p,d,q) model uses p autoregressive terms, d differences, and q moving-average error terms. An AR(p) model expresses a stationary series as: yt = c + φ1yt−1 + ... + φpyt−p + εt where c is a constant, φi are autoregressive coefficients, and εt is an innovation or error. An MA(q) model is: yt = μ + εt + θ1εt−1 + ... + θqεt−q where μ is a mean or location term and θj are moving-average coefficients. The term “moving average” here refers to lagged errors, not a moving-average smoother. For a nonstationary series, ARIMA applies differencing before modelling. Seasonal ARIMA, written SARIMA, adds seasonal autoregressive, differencing, and moving-average terms with seasonal period m, often represented as SARIMA(p,d,q)(P,D,Q)_m. Model identification commonly uses: - the time plot to assess trend and seasonality;
- the autocorrelation function (ACF) to identify dependence across lags;
- the partial autocorrelation function (PACF) to assess dependence after controlling for shorter lags;
- information criteria such as AIC or BIC to compare candidate models.
A model should not be selected solely because it has the lowest information criterion. It must also produce sensible forecasts, interpretable residuals, and acceptable out-of-sample performance. Residual diagnosticsAfter fitting a model, residuals should have approximately zero mean, stable variance, and little remaining autocorrelation. A residual ACF and a Ljung–Box test can help detect serial dependence. The Ljung–Box test examines whether a group of autocorrelations is jointly different from zero; it is not proof that a model is correct. Residual normality is less important for point forecasts than for small-sample prediction intervals, but extreme non-normality should be investigated. 7. Forecast Accuracy and ValidationForecast accuracy must be measured on observations that were not used to estimate the model. Random train-test splitting is inappropriate for most time series because it can place future observations in the training set. Use a chronological holdout or rolling-origin evaluation. For forecast errors et = yt − ŷt, common measures include: MAE = (1/n)∑|et| RMSE = √[(1/n)∑et²] MAPE = (100/n)∑|et ÷ yt| MAE is expressed in the units of the target and is easy to interpret. RMSE penalises large errors more heavily. MAPE is scale-free but is undefined when yt = 0 and unstable when actual values are close to zero. For intermittent or low-volume demand, MAE, RMSE, weighted measures, or scaled measures such as MASE are usually preferable. A scaled error can be compared with a naïve benchmark. For seasonal data, the scaling denominator should reflect errors from an appropriate seasonal naïve method. Forecast bias can be monitored using: Mean Error = (1/n)∑et A positive mean error under the definition above means forecasts tend to be too low; a negative value means they tend to be too high. Prediction intervals quantify uncertainty. A 95% prediction interval is intended to contain a future observation with approximately 95% probability under the model and assumptions. It is wider than a confidence interval for the mean because it includes both parameter uncertainty and future random variation. Intervals generally widen as the forecast horizon increases. Rolling-origin evaluationIn rolling-origin evaluation, a model is fitted using data through time t, forecasts one or more future periods, records the errors, then moves the origin forward. This procedure resembles actual deployment and tests stability across different business conditions. Accuracy should be reported by horizon where possible, because a model that is best one month ahead may not be best twelve months ahead. 8. Worked Example: Monthly Product DemandAn illustrative retailer records monthly demand for a product. Demand is higher in November and December, and the level has gradually increased. The analyst compares seasonal naïve, Holt–Winters, and SARIMA models. First, the analyst verifies that months are complete, checks whether stock-outs caused observed sales to understate demand, and records promotion dates. A plot indicates annual seasonality and a rising level. Because seasonal variation appears proportional to demand, a logarithmic transformation is considered, but only after checking that all demand values are positive. The last twelve months are held out for evaluation. Each candidate is fitted only to earlier observations. Suppose the holdout results are: | Model | MAE (units) | RMSE (units) | MAPE |
|---|
| Seasonal naïve | 118 | 171 | 12.8% | | Holt–Winters additive | 96 | 139 | 10.4% | | SARIMA with seasonal terms | 91 | 133 | 9.9% |
The SARIMA model has the lowest reported errors, but the difference from Holt–Winters is modest. Residual diagnostics show no substantial remaining seasonal autocorrelation. The analyst therefore selects SARIMA for the statistical forecast but presents a model comparison and prediction interval to management. A promotion calendar suggests that next March will include an unusually large campaign; the final planning forecast is adjusted through an explicit intervention variable or scenario rather than by silently changing the historical data. The forecast is then translated into inventory requirements. If expected demand is 1,000 units, lead-time demand uncertainty is material, and the supplier has a fixed replenishment delay, the purchasing team uses the forecast distribution—not only the point forecast—to set a service-level-based safety stock. The forecast itself does not determine the order quantity; costs, lead times, service objectives, and storage constraints also matter. 9. Applied Case: Capacity Planning in a Service CentreThis is an illustrative case. A customer service centre receives hourly contacts. Management must schedule agents while maintaining a response-time target. Background and problemHistorical data show strong weekday and intraday patterns. A simple average understates Monday morning demand and overstates overnight demand. Occasional marketing campaigns create sharp peaks. AnalysisThe analytics team plots contacts by hour and weekday, identifies missing intervals, and distinguishes contact demand from answered contacts. The latter is affected by staffing and therefore may be censored by capacity. A seasonal naïve model is established as a benchmark. A dynamic regression includes hour-of-day indicators, weekday indicators, campaign flags, and lagged contact volumes. Residual autocorrelation is modelled with ARIMA errors. Approach and solutionThe team uses rolling-origin validation over several campaign and non-campaign periods. Accuracy is assessed separately for ordinary days and campaign days. Prediction intervals are converted into staffing scenarios: expected demand, high-demand demand, and an extreme but plausible demand level. Managers review campaign assumptions and approve the scenario used for the roster. OutcomeThe resulting schedule reduces understaffing during predictable peaks without assigning excessive staff during low-demand periods. Performance is monitored weekly. When a new self-service channel changes the volume pattern, the model is re-estimated rather than allowed to drift indefinitely. Learning points- The correct target may be demand, not observed fulfilled volume.
- Calendar variables can be as important as sophisticated algorithms.
- Forecast uncertainty should be connected to operational decisions.
- Evaluation must include exceptional periods if those periods affect capacity risk.
- Forecast systems require monitoring for structural change.
10. Technology, AI, and GovernanceForecasting software can automatically estimate exponential-smoothing and ARIMA models, perform cross-validation, and generate prediction intervals. Machine-learning methods such as gradient boosting, random forests, and recurrent neural networks can model nonlinear relationships and large sets of predictors. However, greater algorithmic complexity does not guarantee superior forecasting. Strong baselines, leakage-free validation, interpretability, and operational usefulness remain essential. AI forecasting systems should document data sources, forecast origin, transformations, feature availability, model version, hyperparameters, and override decisions. Human overrides should be logged and evaluated rather than treated as automatically correct. Automated forecasts can reproduce historical discrimination if demand reflects unequal access or biased measurement. Privacy controls are required when forecasts use customer, employee, location, or transaction data. Governance should include role ownership, approval thresholds, monitoring rules, retraining criteria, access controls, and an audit trail. Financial forecasts require particular care because optimistic forecasts can influence budgets, performance targets, lending decisions, or investor communication. Forecasts should be communicated with assumptions and uncertainty, not as certain facts. 11. Challenges and LimitationsTime-series forecasting faces several recurring limitations: - Structural breaks: A new competitor, regulation, technology, or pandemic can invalidate historical relationships.
- Data revisions: Economic and financial data may be revised after the original forecast was made.
- Intermittent demand: Many zero observations make percentage metrics and standard models unsuitable.
- Censoring: Sales may reflect stock availability rather than true demand.
- Changing seasonality: Calendar effects and customer behaviour can evolve.
- Forecast horizon: Long-horizon forecasts accumulate uncertainty and depend strongly on assumptions.
- Feedback effects: A forecast may change behaviour, making the original relationship less stable.
- External predictors: Future values of explanatory variables may be unknown.
- Model risk: A model can fit historical data well while failing under new conditions.
Best practice is to combine statistical evidence with domain knowledge, compare against simple benchmarks, validate chronologically, inspect residuals, quantify uncertainty, and review the forecast process regularly. Chapter SummaryTime-series analysis studies observations ordered through time and focuses on dependence, trend, seasonality, cycles, and irregular variation. Additive and multiplicative decompositions provide useful conceptual frameworks, while plots and data-quality checks are essential before modelling. Naïve forecasts establish important baselines. Moving averages smooth noise; exponential smoothing estimates level, trend, and seasonality; regression incorporates time, calendar effects, interventions, and external drivers; and ARIMA models autocorrelation after differencing where necessary. Forecast quality must be assessed using out-of-sample, chronological validation. MAE, RMSE, percentage measures, bias, and prediction intervals answer different questions and should be selected according to the data and decision. Forecasts become valuable when translated into inventory, sales, financial, workforce, and capacity decisions. Responsible forecasting also requires transparency, monitoring, privacy protection, documentation, and recognition that structural change can make historical patterns unreliable. Key TermsTime series: Chronologically ordered observations. Forecast origin: The last time point whose information is available when a forecast is produced. Trend: The long-term direction of a series. Seasonality: A repeating pattern linked to a known calendar frequency. Cycle: A medium- or long-term fluctuation without a fixed repeating period. Irregular component: Unsystematic variation, shocks, or measurement noise. Autocorrelation: Correlation between observations and their lagged values. Lag: The number of time periods separating two observations. Stationarity: A property in which key distributional characteristics remain stable over time. Differencing: Subtracting a previous observation to reduce nonstationarity. Smoothing: Reducing short-term variation to reveal level, trend, or seasonality. Exponential smoothing: A method that assigns declining weights to older observations. Decomposition: Separating a series into components such as trend and seasonality. ARIMA: AutoRegressive Integrated Moving Average model. SARIMA: ARIMA extended with seasonal terms. Residual: The difference between an observed value and its fitted or forecast value. MAE: Mean absolute error, expressed in the target’s units. RMSE: Root mean squared error, which penalises large errors more strongly. Prediction interval: A range intended to contain a future observation with a stated probability. Forecast bias: Systematic tendency for forecasts to be too high or too low. Review QuestionsShort Answer Questions- What is the difference between trend and seasonality?
- Why is a seasonal naïve forecast useful as a benchmark?
- What does positive autocorrelation imply?
- State one limitation of MAPE.
- Why should time-series validation preserve chronological order?
Long Answer Questions- Explain additive and multiplicative decomposition and identify circumstances in which each is appropriate.
- Compare simple exponential smoothing, Holt’s method, and Holt–Winters methods.
- Explain stationarity, differencing, and the risks of over-differencing.
- Describe how ACF, PACF, information criteria, and residual diagnostics contribute to ARIMA modelling.
- Discuss how forecast uncertainty should influence inventory or capacity decisions.
Analytical / Application Questions- A retailer has monthly demand with strong annual seasonality and increasing variance. Recommend a forecasting workflow, including transformation, benchmark, validation, and accuracy measures.
- A call centre’s observed answered calls fall during periods of staff shortage. Explain why answered calls may be an unsuitable forecasting target and propose a better analytical approach.
- A model has lower RMSE but larger bias than a competing model. Discuss which model should be selected for a capacity-planning decision and what additional evidence is required.
Multiple Choice Questions with AnswersQuestion 1Which component represents a pattern that repeats at a known calendar frequency? A. Trend B. Seasonality C. Irregular variation D. Structural break Correct Answer: B. Seasonality Question 2A seasonal naïve forecast for monthly data with annual seasonality normally uses which observation? A. The immediately preceding month B. The average of all months C. The observation twelve months earlier D. The observation six months earlier Correct Answer: C. The observation twelve months earlier Question 3Which metric is expressed in the same units as the forecast variable? A. MAE B. MAPE C. AIC D. Autocorrelation Correct Answer: A. MAE Question 4What is a major limitation of MAPE? A. It cannot compare forecasts at different horizons B. It is undefined when actual values are zero C. It always penalises large errors more than RMSE D. It requires normally distributed residuals Correct Answer: B. It is undefined when actual values are zero Question 5In simple exponential smoothing, a larger α generally makes the estimate: A. Less responsive to recent observations B. More responsive to recent observations C. Automatically seasonal D. Independent of the latest observation Correct Answer: B. More responsive to recent observations Question 6What is the purpose of differencing in ARIMA modelling? A. To remove all random variation B. To increase the seasonal period C. To help make a nonstationary series stationary D. To guarantee normally distributed data Correct Answer: C. To help make a nonstationary series stationary Question 7Why is random train-test splitting usually inappropriate for time-series forecasting? A. It prevents calculation of MAE B. It can allow future information into the training data C. It always produces too few observations D. It removes seasonality from the data Correct Answer: B. It can allow future information into the training data Question 8Under the definition et = yt − ŷt, a positive mean error indicates that forecasts tend to be: A. Too high B. Too low C. Perfectly unbiased D. Seasonally adjusted Correct Answer: B. Too low Question 9Which diagnostic is specifically used to identify remaining serial dependence in model residuals? A. Residual ACF B. Histogram of the raw timestamps C. Price index D. Sample maximum Correct Answer: A. Residual ACF Question 10Why are prediction intervals generally wider for longer forecast horizons? A. The target variable changes units B. Uncertainty accumulates as the horizon increases C. The training sample becomes larger D. Seasonality disappears automatically Correct Answer: B. Uncertainty accumulates as the horizon increases
|