Time-Series Data, Structure, and VisualizationIntroductionA time series is a sequence of observations recorded in chronological order. Examples include daily online orders, monthly inflation, hourly electricity demand, quarterly revenue, annual employment, and minute-by-minute website traffic. Unlike ordinary cross-sectional data, time-series observations are usually not independent: yesterday’s demand may influence today’s demand, and a shock may affect many subsequent observations. Understanding the structure of a time series is the foundation of forecasting. Before selecting a forecasting model, an analyst should determine what systematic information is present, what variation is unexplained, whether the measurement process has changed, and whether the data are suitable for the intended decision. Visualization and exploratory analysis are therefore not preliminary decoration; they are essential analytical activities. This chapter develops a practical framework for identifying trend, seasonality, cycles, irregular variation, structural breaks, outliers, calendar effects, autocorrelation, stationarity, and data-generating processes. Learning ObjectivesBy the end of this chapter, you should be able to: - Describe the structure and purpose of time-series data.
- Distinguish trend, seasonality, cycles, irregular variation, calendar effects, outliers, and structural breaks.
- Use appropriate plots and summary statistics to explore a time series.
- Explain autocorrelation and stationarity and recognize their forecasting implications.
- Formulate a basic data-generating-process perspective.
- Diagnose common data-quality and interpretation problems.
- Communicate exploratory findings responsibly in a business setting.
1. The Nature of Time-Series DataA time series may be represented as yt, where t denotes the observation time and y is the measured variable. The time index may be an integer, date, timestamp, or business-period label. A dataset can be written as: y1, y2, y3, …, yT Here, T is the number of observations. The interval between observations should be known and, for many analyses, reasonably consistent. A monthly series should not silently mix calendar months with four-week accounting periods. Time-series data have several distinctive features: - Temporal ordering: the order of observations carries information.
- Dependence: observations may be related across time.
- Dynamic response: effects may occur with delays.
- Changing conditions: institutions, markets, technologies, and policies may evolve.
- Frequency and aggregation: daily, weekly, monthly, and quarterly measurements may reveal different patterns.
A time series is not automatically a forecastable series. Forecastability depends on whether past information contains useful information about future values and whether the measurement process remains sufficiently stable. Levels, changes, and ratesAnalysts often study both the level and the change in a variable. The first difference is: Δyt = yt − yt−1 where Δyt is the change from period t−1 to period t. A percentage change is commonly calculated as: gt = 100 × (yt − yt−1) / yt−1 This percentage formula requires yt−1 ≠ 0 and is most interpretable when the denominator is meaningful and not extremely close to zero. For strictly positive data, the log difference provides an alternative approximation to percentage growth: 100 × [ln(yt) − ln(yt−1)] The log transformation requires yt > 0. Analysts must distinguish changes in levels from changes in growth rates; a stable growth rate can coexist with a rising level. 2. Components of a Time SeriesA useful exploratory framework decomposes an observed series into systematic and unsystematic components. An additive representation is: yt = Tt + St + Ct + It where Tt is trend, St is seasonal variation, Ct is cyclical variation, and It is irregular variation. This is a conceptual decomposition, not necessarily a uniquely identifiable statistical model. When seasonal fluctuations increase with the level of the series, a multiplicative representation may be more appropriate: yt = Tt × St × Ct × It The multiplicative form requires components for which multiplication is meaningful, usually positive data. Taking logarithms converts it into an additive form: ln(yt) = ln(Tt) + ln(St) + ln(Ct) + ln(It) In practice, trend and cycles can be difficult to separate, and decomposition methods impose assumptions about smoothness, seasonality, and endpoint behavior. TrendA trend is a persistent long-term movement in the level or average of a series. It may be upward, downward, nonlinear, or interrupted. Examples include the long-run growth of e-commerce transactions or a gradual decline in demand for a legacy product. Trend should not be confused with a straight line. A linear trend can be represented by: yt = β0 + β1 t + εt where β0 is an intercept, β1 is the average change per time unit, and εt is the remaining variation. This regression form is useful only when a linear trend is a reasonable approximation and residual assumptions are examined. A moving average can help reveal trend by smoothing short-term variation. A centered moving average of odd window length k is: MAt = (1/k) × ∑j=−mm yt+j, where k = 2m + 1 It is unavailable or modified near the series endpoints. Smoothing can clarify broad movement but can also hide meaningful shocks. SeasonalitySeasonality is a systematic pattern that repeats at a known and calendar-related frequency. Examples include higher retail sales in December, weekday patterns in ride demand, and electricity peaks during particular hours. Seasonal period depends on the observation frequency. A monthly series may have a 12-month seasonal period; a daily series may have a seven-day weekly pattern, though holidays and trading schedules may complicate it. Seasonality should be identified from repeated patterns across multiple cycles rather than from one unusual period. CyclesA cycle is a fluctuation around the long-term trend whose duration and amplitude are not fixed. Business cycles are a common example. Unlike seasonality, cycles do not necessarily repeat at a known calendar interval. A two-year expansion followed by a one-year contraction is cyclical, not necessarily seasonal. Irregular variationIrregular variation is the unpredictable component remaining after systematic structure is accounted for. It may reflect accidents, sudden weather events, measurement noise, or unanticipated competitor actions. “Irregular” does not mean unimportant; an irregular shock can have major operational consequences. 3. Calendar Effects, Outliers, and Structural BreaksCalendar effectsCalendar effects arise because the composition or length of periods differs. Monthly revenue may vary because months have different numbers of days. Retail sales may be affected by weekends, public holidays, paydays, school terms, or promotional calendars. A February observation is not directly comparable with a 31-day month unless exposure is considered. Common adjustments include: - trading-day or business-day adjustment;
- holiday indicators;
- day-of-week variables;
- month or quarter indicators;
- school-term or fiscal-period indicators;
- exposure measures such as operating hours or number of active stores.
Calendar adjustment must be documented. Removing a legitimate business effect can make a forecast less useful if the business actually needs the unadjusted outcome. OutliersAn outlier is an observation unusually distant from the pattern expected under a provisional model. Types include: - Additive outlier: a one-period abnormal value;
- Innovation outlier: an unusual shock that propagates through later observations;
- Level shift: a persistent change in the mean;
- Temporary change: a shock that decays over time.
Outliers should not be deleted automatically. They may represent data errors, genuine events, fraud, promotions, strikes, or policy interventions. A useful workflow is to flag, investigate, classify, document, and then decide whether to correct, model, retain, or exclude the observation. Structural breaksA structural break occurs when the data-generating process changes. The change may affect the mean, trend, seasonal pattern, variance, relationships among variables, or autocorrelation. Examples include a new pricing policy, a merger, a regulatory change, a pandemic, or a change in data-collection software. A break is different from an outlier. An outlier is often temporary; a structural break changes the process that generates subsequent observations. Treating a post-break regime as if it belonged to the old regime can produce misleading forecasts. Exploratory indicators of a break include a sudden and persistent level change, changed variability, altered seasonal amplitude, and different relationships with explanatory variables. Formal tests can assist later, but no statistical test replaces knowledge of the business process. 4. Visualization as Exploratory AnalysisThe time plotThe first plot should usually be the time plot: time on the horizontal axis and the measured variable on the vertical axis. It should show units, frequency, time zone where relevant, missing values, and any important intervention dates. A time plot can reveal trend, seasonality, changing variance, gaps, outliers, and possible breaks. Plotting points in chronological order is essential; sorting by value destroys the temporal structure. Seasonal plots and subseries plotsA seasonal plot overlays observations from corresponding seasons, such as all Januaries, all Mondays, or all 9:00 a.m. readings. It helps compare the same seasonal position across years. A seasonal subseries plot groups observations by season and displays their distributions or trajectories. These plots are especially useful for distinguishing fixed seasonality from a changing seasonal pattern. If December is consistently high but its elevation increases over time, a multiplicative or interaction-based seasonal effect may be appropriate. Scatterplots and lag plotsA lag plot compares yt with a previous observation, such as yt−1. A positive relationship may indicate persistence. A curved pattern may indicate nonlinear dynamics. A lag plot alone does not establish causality. When two variables are measured over time, a scatterplot can show association, but a high correlation may be caused by common trends rather than a meaningful relationship. Differencing, detrending, or examining residuals may be necessary. Autocorrelation plotsThe autocorrelation at lag k measures linear dependence between observations separated by k periods. The sample autocorrelation is commonly estimated by: rk = [∑t=k+1T(yt − ȳ)(yt−k − ȳ)] / [∑t=1T(yt − ȳ)2] where ȳ is the sample mean and k ≥ 0. The numerator and denominator have squared units, so rk is unit-free. This measure is descriptive and depends on the sample and on whether the mean is stable. An autocorrelation function (ACF) plot displays rk across lags. A slowly decaying ACF may indicate trend or nonstationarity; spikes at seasonal lags may indicate seasonality; alternating signs may indicate oscillation. A partial autocorrelation function can help examine the relationship at a lag after accounting for shorter lags, but interpretation should be linked to a specified model. Distributional and variability plotsHistograms, density plots, boxplots by month or weekday, and rolling mean–standard-deviation plots supplement the time plot. A rolling mean over window w is: ȳt(w) = (1/w) × ∑j=0w−1 yt−j A rolling standard deviation can reveal changing variability. Rolling statistics are descriptive and can be unstable when the window is short. 5. Autocorrelation and StationarityAutocorrelationAutocorrelation means dependence between a series and its lagged values. Positive autocorrelation means high values tend to follow high values and low values tend to follow low values. Negative autocorrelation means high values tend to follow low values, or vice versa. A simple data-generating process illustrating persistence is: yt = c + φyt−1 + εt where c is a constant, φ is an autoregressive coefficient, and εt is a random innovation. In the basic stationary AR(1) case, innovations have constant variance, are uncorrelated over time, and |φ| < 1. Under these conditions, shocks gradually decay rather than permanently accumulating. When φ is close to 1, persistence is strong and forecasts may be sensitive to recent observations. StationarityA weakly stationary series has a constant finite mean, constant finite variance, and autocovariance that depends only on the lag between observations, not on calendar time. Formally, for a series yt: E(yt) = μ Var(yt) = σ² Cov(yt, yt−k) = γk where μ and σ² are constant over time and γk depends only on k. Stationarity is a modeling concept, not a claim that every individual observation is stable. A series with trend, changing variance, evolving seasonality, or a level shift is generally nonstationary. Differencing can sometimes produce a more stable series, but unnecessary differencing can remove meaningful information and create artificial dependence. A stationarity test should be interpreted alongside plots, subject-matter knowledge, and model diagnostics; tests have limited power and can disagree. Spurious relationshipsTwo unrelated trending series may exhibit a high correlation simply because both increase over time. This is a classic spurious-regression risk. Analysts should examine levels and changes, include relevant time structure, and validate relationships out of sample. Correlation is not evidence that one time series causes another. 6. The Data-Generating Process PerspectiveA data-generating process (DGP) is a conceptual or mathematical description of how observations arise. For a business series, it may include demand drivers, pricing, promotions, weather, calendar structure, competitor actions, operational constraints, and random shocks. One general representation is: yt = f(yt−1, yt−2, …, xt, xt−1, …, θ) + εt Here, xt denotes explanatory variables, θ denotes unknown parameters, f is a systematic relationship, and εt is an innovation or unexplained component. The equation is deliberately general. It does not assert linearity, stationarity, or causality. Thinking in DGP terms encourages analysts to ask: - What process generated the measurement?
- Which variables were known at the forecast origin?
- Are the same definitions and systems used throughout the sample?
- Do interventions change the process?
- Is the objective prediction, explanation, monitoring, or causal evaluation?
A forecasting model is an approximation to the DGP. A model can forecast well without providing a causal explanation, and a causally meaningful model may not be the most accurate short-term forecasting tool. 7. Worked Example: Exploring Monthly Service DemandSuppose a customer-service center records monthly ticket volumes for four years. The analyst observes the following exploratory findings: - Ticket volume rises from approximately 8,000 to 13,000 over the period.
- July and December are repeatedly above the annual average.
- Variability is larger in the later years.
- A sharp spike occurs in March of year three.
- From April of year three onward, the mean level is persistently higher.
- The ACF is large at short lags and has peaks near lag 12.
The appropriate interpretation is not simply “the series has seasonality.” The evidence suggests multiple features: - The gradual increase indicates trend.
- Repeated July and December behavior suggests seasonality or calendar effects.
- Larger later variability suggests nonconstant variance, possibly proportional to the level.
- The March spike may be an additive outlier, a system event, or the beginning of a structural change.
- The persistent increase after March suggests a level shift or intervention effect.
- Short-lag autocorrelation indicates persistence; peaks near lag 12 support annual seasonality.
A responsible analytical sequence would be: - Verify whether March’s value is a data-entry error.
- Check whether a new service channel, product, or reporting rule began at that date.
- Add intervention and calendar information to the data dictionary.
- Plot the series on its original scale and, if all values are positive, on a logarithmic scale.
- Compare seasonal behavior before and after the suspected break.
- Examine differences or growth rates to assess whether the trend and persistence become more stable.
- Reserve the latest observations for genuine out-of-sample evaluation.
The analyst should not mechanically remove March. If it represents a real system shock, removing it would conceal information needed for operational planning. 8. Illustrative Case: Retail Demand After a Pricing ChangeThis is a fictional illustrative case. BackgroundA regional retailer forecasts weekly demand for a household product across 80 stores. The historical series covers three years. Management reports that a permanent price reduction began in week 105. ProblemA basic seasonal chart shows strong demand near holidays, but forecast errors become unusually large after week 105. A model trained on the full history underpredicts demand in the post-change period. AnalysisThe time plot shows a level increase immediately after the price reduction, while the weekly seasonal pattern remains broadly similar. A pre-change and post-change boxplot shows that the median demand increased and the variance also rose. A lag plot indicates strong week-to-week persistence. The ACF has a seasonal peak at lag 52, consistent with annual weekly seasonality. The event is better classified as a structural break or intervention than as an isolated outlier. The price variable is also a potential explanatory variable, but its effect cannot be interpreted causally without considering promotions, competitor prices, stock availability, and other confounders. Approach and solutionThe analytics team documents the intervention date, creates a price-change indicator, separates pre- and post-change diagnostics, and evaluates models using rolling-origin validation. They compare: - a seasonal-naive benchmark;
- a model estimated primarily on post-change data;
- a model including price and calendar variables;
- a model with an intervention indicator and seasonal terms.
The model is assessed using an error measure appropriate to the business objective and monitored separately by store. Forecast intervals are reported because uncertainty is greater around regime changes. OutcomeThe intervention-aware approach reduces systematic underprediction after week 105. It also reveals that some stores had insufficient stock, so observed sales understated underlying demand. The final forecasting process therefore distinguishes sales from lost-demand indicators where possible. Learning points- A break in the process can matter more than a sophisticated algorithm.
- Calendar repetition does not eliminate the need to model interventions.
- Observed transactions may be constrained outcomes rather than true demand.
- Validation must reflect the time order and the regime in which forecasts will be used.
- Forecasting claims should not be presented as causal claims without an appropriate research design.
9. Practical Workflow and Best PracticesA robust exploratory workflow is: - Define the target: specify the variable, unit, population, and forecast horizon.
- Audit the time index: check duplicates, gaps, time zones, frequency, and ordering.
- Inspect data quality: identify missing values, impossible values, revisions, and changes in definitions.
- Plot the original series: annotate known events and interventions.
- Examine transformations: compare levels, logs where valid, differences, and percentage changes.
- Inspect seasonal structure: use seasonal plots and calendar summaries.
- Inspect dependence: use lag plots and ACF/PACF diagnostics.
- Investigate unusual observations: classify outliers and possible breaks.
- Formulate a DGP hypothesis: describe plausible drivers and information availability.
- Document decisions: record exclusions, adjustments, assumptions, and limitations.
Ethical and governance considerationsTime-series forecasts influence staffing, inventory, credit decisions, pricing, and public services. Poorly documented adjustments can conceal failures or shift risk to vulnerable groups. Analysts should preserve an audit trail, distinguish measured facts from assumptions, protect confidential timestamps and customer identifiers, and communicate uncertainty. Automated anomaly detection should support investigation rather than make irreversible decisions without human review. Data leakage is a major governance and technical risk. A variable may appear predictive but become available only after the forecast period. For example, a finalized monthly return rate cannot be used to forecast sales at the start of that month. All features must be aligned with the information set available at the forecast origin. Modern software can generate interactive plots, decomposition displays, anomaly alerts, and automated model suggestions. These tools improve speed but do not determine whether a pattern is causal, whether a break is genuine, or whether a forecast is ethically appropriate. Reproducible code, versioned data, clear metadata, and human review remain essential. Chapter SummaryTime-series analysis begins with understanding how observations are ordered and generated. Trend represents persistent long-term movement; seasonality repeats at a known calendar frequency; cycles fluctuate with less regular duration; irregular variation is not systematically predictable. Calendar effects arise from differing days, holidays, and operating schedules. Outliers may be errors, genuine shocks, or signs of a changing process. Structural breaks alter the data-generating mechanism and require special attention. Time plots, seasonal plots, lag plots, distributional displays, rolling statistics, and autocorrelation plots provide complementary evidence. Autocorrelation describes dependence across lags, while stationarity concerns the stability of the statistical properties of the process. A data-generating-process perspective links observed patterns to business mechanisms, information availability, interventions, and uncertainty. Effective exploratory analysis combines visualization, quantitative diagnostics, domain knowledge, careful documentation, and time-respecting validation. Key TermsTime series: Chronologically ordered observations of a variable. Time index: The date, timestamp, or ordered label identifying an observation. Trend: Persistent long-term movement in a series. Seasonality: A repeating pattern tied to a known calendar frequency. Cycle: Fluctuation with variable duration around a trend. Irregular variation: Unsystematic variation remaining after systematic structure. Calendar effect: Variation caused by calendar composition, holidays, or operating schedules. Outlier: An observation unusually inconsistent with an expected pattern. Additive outlier: A temporary one-period abnormal observation. Innovation outlier: An unusual shock that affects subsequent observations. Level shift: A persistent change in the mean level. Structural break: A change in the process generating the observations. Autocorrelation: Dependence between observations separated by a specified lag. Lag: The number of time periods separating two observations. Stationarity: Stability of key distributional properties over time. Differencing: Subtracting a previous observation from the current observation. Data-generating process: A conceptual or mathematical mechanism producing the data. Information set: Information available at the time a forecast is made. Spurious relationship: An apparent association produced by shared trends or other noncausal features. Rolling statistic: A statistic calculated repeatedly over a moving time window. Review QuestionsShort Answer Questions- What distinguishes a time series from cross-sectional data?
- Explain the difference between trend and seasonality.
- What is a structural break, and why is it not necessarily an outlier?
- What information does an autocorrelation plot provide?
- State the main conditions of weak stationarity.
Long Answer Questions- Explain the additive and multiplicative views of time-series decomposition. When might a logarithmic transformation be useful?
- Describe a complete exploratory workflow for a newly acquired monthly business time series.
- Discuss how calendar effects can create misleading comparisons across time.
- Explain how a data-generating-process perspective improves forecasting analysis.
- Compare the roles of time plots, seasonal plots, lag plots, and ACF plots.
Analytical / Application Questions- A monthly series rises steadily, has increasingly large seasonal peaks, and shows an ACF that decays slowly. Identify the likely features and recommend exploratory transformations or diagnostics.
- A sudden sales spike is followed by a permanently higher sales level. Develop competing explanations and specify how you would distinguish an outlier, intervention, and structural break.
- Two unrelated economic series both rise over ten years and have a correlation of 0.92. Explain why this may be spurious and propose an appropriate investigation.
Multiple Choice Questions with AnswersQuestion 1Which feature is defined as a pattern that repeats at a known calendar frequency? A. Trend B. Seasonality C. Structural break D. Irregular variation Correct Answer: B. Seasonality Question 2In the additive decomposition y_t = T_t + S_t + C_t + I_t, what does S_t represent? A. Seasonal variation B. Sampling variance C. A structural break D. The forecast horizon Correct Answer: A. Seasonal variation Question 3What is the main purpose of a time plot? A. To remove all autocorrelation B. To reveal temporal movement and unusual observations C. To prove causality D. To guarantee stationarity Correct Answer: B. To reveal temporal movement and unusual observations Question 4A persistent change in the level of a series after a policy intervention is most appropriately investigated as a possible: A. Level shift or structural break B. Random sampling error only C. Seasonal period D. Percentage denominator Correct Answer: A. Level shift or structural break Question 5Which condition is associated with a basic stationary AR(1) process y_t = c + φy_{t−1} + ε_t? A. φ = 2 B. |φ| < 1 C. φ must be negative D. The series must have a deterministic trend Correct Answer: B. |φ| < 1 Question 6What does a lag plot compare? A. A series with a previous value of itself B. Two unrelated populations only C. Forecast errors with calendar dates only D. Seasonal indexes with sample size Correct Answer: A. A series with a previous value of itself Question 7Which formula represents the first difference of a series? A. Δy_t = y_t + y_{t−1} B. Δy_t = y_t × y_{t−1} C. Δy_t = y_t − y_{t−1} D. Δy_t = y_t / t Correct Answer: C. Δy_t = y_t − y_{t−1} Question 8Why should an analyst avoid automatically deleting an outlier? A. Every outlier is always a data-entry error B. It may represent a genuine event or process change C. Deleting it always increases bias D. Outliers cannot affect forecasts Correct Answer: B. It may represent a genuine event or process change Question 9A peak in the ACF at lag 12 for monthly data may indicate: A. Annual seasonality B. A missing time index C. A guaranteed causal effect D. Zero variance Correct Answer: A. Annual seasonality Question 10What is data leakage in time-series forecasting? A. A missing observation at the series endpoint B. Using information unavailable at the forecast origin C. A seasonal peak in December D. A valid transformation of positive data Correct Answer: B. Using information unavailable at the forecast origin
|