Time-series analysis studies observations ordered through time. The order matters: today may depend on yesterday, seasonal patterns may repeat, and structural changes can alter both the mean and variance. A sound forecast separates pattern from noise, tests the assumptions, and measures performance on data the model did not see.
1Time-Series Foundations
A time series is a sequence \(y_1,y_2,\ldots,y_T\) observed at ordered intervals. Unlike cross-sectional data, observations cannot usually be shuffled because temporal dependence carries information.
Frequency
Daily, monthly or quarterly spacing determines meaningful seasonal periods and forecast horizons.
Stock versus flow
A stock is measured at a point in time. A flow accumulates across an interval.
Univariate versus multivariate
Univariate models use the series history. Multivariate models also use related variables.
2Components and Observable Patterns
| Component | Meaning | Example |
|---|---|---|
| Level | Typical magnitude around which observations vary | Average monthly sales |
| Trend \(T_t\) | Persistent long-run direction | Gradual revenue growth |
| Seasonality \(S_t\) | Pattern repeating at a fixed calendar frequency | Quarter-end deposits |
| Cycle \(C_t\) | Longer fluctuations without a fixed period | Business cycle |
| Irregular \(I_t\) | Unpredictable residual variation | One-off disruption |
3Centred Moving Averages
A moving average smooths short-run variation to reveal the trend-cycle. For an odd window of width \(m=2k+1\), the centred moving average is:
For an even seasonal period, such as quarterly \(m=4\), a four-term average lies between observations. Centre it by averaging two adjacent moving averages. This produces a 2×4 centred moving average.
4Additive Decomposition
The additive model assumes seasonal effects have roughly constant absolute size. A ₹10 increase in the festive quarter remains about ₹10 whether the series level is ₹100 or ₹300.
Deseasonalise by subtraction: \(y_t-S_t\). Forecast by extending the trend and adding the appropriate seasonal component.
5Multiplicative Decomposition
The multiplicative model assumes seasonal amplitude grows or shrinks with the level. A seasonal index of 1.20 means 20% above trend; 0.85 means 15% below trend.
Deseasonalise by division and forecast by multiplying:
6Stationarity
A weakly stationary series has a constant mean, constant finite variance and autocovariance that depends only on lag, not calendar time:
ARIMA modelling typically requires stationarity after suitable transformations and differencing. A trend, changing seasonal pattern, variance growth or structural break can violate this condition.
| Problem | Common treatment | Caution |
|---|---|---|
| Deterministic trend | Regression on time or detrending | Do not difference automatically if trend-stationary |
| Stochastic trend / unit root | First difference | Over-differencing creates unnecessary negative autocorrelation |
| Seasonal unit root | Seasonal difference \((1-B^m)y_t\) | Verify seasonal period and residual pattern |
| Changing variance | Log or Box–Cox transform | Transform before differencing |
| Structural break | Intervention variables or regime model | Tests may mistake a break for a unit root |
7Stationarity Tests
| Test | Null hypothesis | Evidence for stationarity |
|---|---|---|
| ADF | Unit root exists | Reject the null with a sufficiently small p-value |
| Phillips–Perron | Unit root exists | Reject the null; PP uses nonparametric correction for serial correlation and heteroskedasticity |
| KPSS | Level or trend stationarity | Fail to reject the null |
ADF regression choices
The Augmented Dickey–Fuller regression may include no constant, a constant, or a constant plus trend. The specification must match the plotted series. Lagged differences absorb residual autocorrelation:
The unit-root null is \(\gamma=0\). Standard t critical values do not apply; use Dickey–Fuller critical values.
8Autocorrelation Function
The ACF at lag \(k\) measures linear association between \(y_t\) and \(y_{t-k}\):
The sample ACF is read as a correlogram. Approximate 95% white-noise bounds are \(\pm1.96/\sqrt{T}\), though individual-spike bounds do not replace a joint residual test.
Slow decay
Often indicates nonstationarity or a strongly persistent process.
Seasonal spikes
Large values at \(m,2m,3m\) signal a repeating seasonal structure.
Sharp cutoff
An MA(q) process has a theoretical ACF that cuts off after lag q.
9Partial Autocorrelation Function
The PACF at lag \(k\) measures the association between \(y_t\) and \(y_{t-k}\) after removing the linear influence of intervening lags \(1,\ldots,k-1\). It isolates the direct lag relationship.
AR(p)
Theoretical PACF cuts off after lag p, while the ACF tails off.
MA(q)
Theoretical ACF cuts off after lag q, while the PACF tails off.
ARMA(p,q)
Both ACF and PACF generally tail off; use information criteria and diagnostics.
10ARIMA Models
ARIMA(p,d,q) combines autoregressive lags, differencing and moving-average error terms. Here \(B y_t=y_{t-1}\).
| Order | Role | Interpretation |
|---|---|---|
| p | AR order | Number of lagged series values after differencing |
| d | Integration order | Number of ordinary differences used for stationarity |
| q | MA order | Number of lagged forecast errors |
Seasonal ARIMA
SARIMA extends the model with seasonal orders \((P,D,Q)_m\):
The seasonal difference is \((1-B^m)y_t=y_t-y_{t-m}\). Use it when seasonal dependence remains after ordinary differencing.
11Model Identification and Estimation
Choose \(d\) using plots, domain knowledge and unit-root evidence. Then propose parsimonious \(p,q\) values from ACF/PACF. Estimate by maximum likelihood and compare candidates using AIC, AICc or BIC.
Lower values indicate a better fit-complexity trade-off among models estimated on the same response data. BIC penalises complexity more strongly as sample size grows.
12Residual Diagnostics
A fitted model should leave innovations that resemble white noise: zero mean, stable variance and no remaining autocorrelation.
| Diagnostic | Question | Desired result |
|---|---|---|
| Residual time plot | Are breaks, outliers or changing variance visible? | No systematic pattern |
| Residual ACF | Does temporal dependence remain? | No material spikes |
| Ljung–Box test | Are autocorrelations jointly zero through lag h? | Fail to reject the null |
| Histogram / QQ plot | Are residual tails compatible with the assumed intervals? | No severe unexplained departures |
| Squared-residual ACF / ARCH test | Does conditional variance remain? | No volatility clustering |
When applying Ljung–Box to fitted ARIMA residuals, account for parameters already estimated and select lags meaningful for the seasonal frequency.
13Forecasts and Accuracy
A point forecast should be accompanied by an interval that widens as uncertainty accumulates. ARIMA intervals are conditional on the fitted model and estimated parameters; structural breaks can make them overconfident.
| Metric | Formula | Caution |
|---|---|---|
| MAE | \(n^{-1}\sum|e_t|\) | Scale dependent but easy to interpret |
| RMSE | \(\sqrt{n^{-1}\sum e_t^2}\) | Penalises large misses strongly |
| MAPE | \(100n^{-1}\sum|e_t/y_t|\) | Undefined or unstable near zero |
| MASE | MAE divided by naïve in-sample MAE | Comparable across scales when denominator is suitable |
14Interactive Decomposition Lab
Use the controls to see when additive or multiplicative seasonality is appropriate. The example has a trend level and a seasonal effect.
Explore ARIMA interactively
Basic ARIMA Model Lab
Build intuition for ARIMA parameters, differencing and forecasts through a focused introductory modelling exercise.
Open Basic ARIMA Lab ↗ARIMA Forecasting Dashboard
Work through time-series preparation, ARIMA model fitting and forecast output in an interactive dashboard.
Open Forecasting Dashboard ↗ARIMA Modelling Flow Chart
Follow the modelling sequence from visual inspection and stationarity testing through identification, diagnostics and forecasting.
Open ARIMA Flow Chart ↗- Define frequency, horizon and business loss from forecast errors.
- Plot the series and investigate missing data, outliers and breaks.
- Choose a decomposition or stochastic model appropriate to the pattern.
- Transform and difference only as needed.
- Fit parsimonious candidates and diagnose residuals.
- Backtest against simple benchmarks using rolling origins.
- Monitor forecast errors and refit when the data-generating process changes.