Time Series Analysis
A time series is a sequence of data points collected or recorded at specific time intervals. These intervals can be regular (e.g., hourly, daily, monthly, yearly) or irregular. The key characteristic of a time series is that the order of the observations matters, as it reflects a temporal ordering. Time series analysis is a statistical method that deals with the analysis of time series data. Its primary goal is to understand the underlying structure of the data, identify patterns, and use this understanding to make forecasts or predictions about future values.
In economics, time series data is ubiquitous. We analyze GDP growth over quarters, inflation rates over months, stock prices over days, and unemployment figures over years. Understanding the temporal dynamics of these economic variables is crucial for policy-making, business strategy, and academic research.
Components of a Time Series
A typical time series can be decomposed into several components that, when combined, explain the observed variations. These components are:
1. Trend (T)
The trend represents the long-term movement or direction of the data. It indicates whether the series is generally increasing, decreasing, or remaining stable over an extended period. For instance, the steadily increasing global population over centuries represents a long-term trend. In economics, a rising trend in GDP per capita might indicate economic growth and development.
2. Seasonal Component (S)
The seasonal component captures regular, predictable fluctuations that occur within a specific period, usually a year. These fluctuations are often related to the calendar, such as seasons, holidays, or specific times of the day. For example, retail sales often show a seasonal peak during the holiday season (e.g., Christmas) and a dip in the post-holiday period. Ice cream sales tend to be higher in summer months.
3. Cyclical Component (C)
The cyclical component refers to longer-term fluctuations that are not necessarily of a fixed period, typically associated with business cycles. These cycles often span several years and represent periods of economic expansion and contraction (booms and recessions). While seasonal patterns repeat annually, business cycles are more irregular and their duration can vary significantly.
4. Irregular or Random Component (I)
The irregular component, also known as residual or random noise, represents the unpredictable, erratic variations in the data that cannot be explained by the trend, seasonal, or cyclical components. These are often due to unforeseen events, random shocks, or measurement errors. For example, a sudden geopolitical event could cause an unpredictable spike or dip in stock prices.
These components can be combined in two main ways to model a time series:
- Additive Model: Yt = Tt + St + Ct + It. This model is appropriate when the magnitude of the seasonal or cyclical fluctuations does not depend on the level of the series. For example, if sales increase by a fixed amount each December, regardless of the overall sales level.
- Multiplicative Model: Yt = Tt × St × Ct × It. This model is more common in economics and is used when the magnitude of seasonal or cyclical fluctuations is proportional to the level of the series. For example, if sales increase by a certain percentage each December. To analyze a multiplicative model using additive techniques, we often take the logarithm of the data: log(Yt) = log(Tt) + log(St) + log(Ct) + log(It).
Stationarity in Time Series
A crucial concept in time series analysis is stationarity. A time series is said to be stationary if its statistical properties, such as mean, variance, and autocorrelation, do not change over time.
- Strict Stationarity: The joint probability distribution of any set of observations is invariant under shifts in time. This is a very strong condition and rarely met in practice.
- Weak Stationarity (or Covariance Stationarity): A time series is weakly stationary if:
- The expected value (mean) is constant over time: E(Yt) = μ for all t.
- The variance is constant over time: Var(Yt) = σ2 for all t.
- The autocovariance between Yt and Yt+k depends only on the lag k, not on time t: Cov(Yt, Yt+k) = γk for all t and k.
Why is stationarity important? Many standard time series models, particularly those based on autoregression and moving averages, assume stationarity. Non-stationary data can lead to spurious regressions, where a statistical relationship appears to exist between two variables purely due to their common trends, even if there is no true underlying economic connection. For instance, if both electricity consumption and the number of people owning televisions increase over time due to population growth (a trend), regressing one on the other might yield a statistically significant result, but it would be misleading.
Testing for Stationarity: Common methods include visual inspection of plots (time series plot, ACF, PACF) and formal statistical tests. The most common test is the Augmented Dickey-Fuller (ADF) test.
Augmented Dickey-Fuller (ADF) Test Shortcut
Null Hypothesis (H0): The time series has a unit root (is non-stationary). Alternative Hypothesis (H1): The time series is stationary. If the test statistic is more negative than the critical value (or if the p-value is less than the significance level, e.g., 0.05), we reject H0 and conclude the series is stationary.
Autocorrelation Function (ACF) and Partial Autocorrelation Function (PACF)
The Autocorrelation Function (ACF) measures the linear relationship between observations in a time series at different lags. The ACF at lag k, denoted by ρk, is the correlation between Yt and Yt-k.
The Partial Autocorrelation Function (PACF) measures the linear relationship between observations at lag k after removing the effect of intermediate lags (lags 1, 2, ..., k-1). The PACF at lag k, denoted by φk, is the correlation between Yt and Yt-k conditional on Yt-1, ..., Yt-k+1.
ACF and PACF plots are essential tools for identifying the structure of a time series and selecting appropriate models, particularly for ARIMA models. The pattern of decay in the ACF and PACF plots can help distinguish between different types of stationary processes.
ACF/PACF Pattern Recognition (for stationary series)
- White Noise: ACF and PACF show no significant spikes beyond lag 0.
- Autoregressive (AR(p)) Model: ACF decays exponentially or linearly; PACF cuts off after lag p.
- Moving Average (MA(q)) Model: ACF cuts off after lag q; PACF decays exponentially or linearly.
- ARMA(p,q) Model: Both ACF and PACF decay gradually.
Time Series Models
Several models are used to analyze and forecast time series data.
1. Moving Average (MA) Models
An MA model of order q, denoted MA(q), expresses the current value of the series as a linear combination of past error terms (shocks) plus a constant. The equation for an MA(q) model is: Yt = μ + εt + θ1εt-1 + θ2εt-2 + ... + θqεt-q where:
- Yt is the value of the series at time t.
- μ is the mean of the series.
- εt is the white noise error term at time t, with E(εt) = 0 and Var(εt) = σ2.
- θ1, ..., θq are the parameters of the model.
2. Autoregressive (AR) Models
An AR model of order p, denoted AR(p), expresses the current value of the series as a linear combination of past values of the series plus an error term. The equation for an AR(p) model is: Yt = c + φ1Yt-1 + φ2Yt-2 + ... + φpYt-p + εt where:
- c is a constant (related to the mean).
- φ1, ..., φp are the autoregressive coefficients.
- εt is the white noise error term.
3. Autoregressive Moving Average (ARMA) Models
An ARMA model combines both AR and MA components. An ARMA model of order (p, q), denoted ARMA(p, q), is stationary and is defined as: Yt = c + φ1Yt-1 + ... + φpYt-p + εt + θ1εt-1 + ... + θqεt-q ARMA models are useful when both past values of the series and past errors help explain the current value. The ACF and PACF for ARMA models decay gradually.
4. Autoregressive Integrated Moving Average (ARIMA) Models
ARIMA models are used for non-stationary time series. They extend ARMA models by including a differencing component to make the series stationary. An ARIMA model is denoted as ARIMA(p, d, q), where:
- p is the order of the autoregressive (AR) part.
- d is the degree of differencing required to make the series stationary.
- q is the order of the moving average (MA) part.
- Differencing: If the series is non-stationary, we difference it d times until it becomes stationary. First differencing involves calculating ΔYt = Yt - Yt-1. Second differencing involves differencing the already differenced series: Δ2Yt = ΔYt - ΔYt-1.
- Model Fitting: Once stationarity is achieved (let the stationary series be Wt), an ARMA(p, q) model is fitted to Wt.
ARIMA Model Identification (Box-Jenkins Methodology)
- Identification: Determine the orders p, d, q.
- Plot the data to visually assess trend and seasonality.
- Use the ADF test to determine the order of differencing (d). If ADF rejects non-stationarity, d=0. If non-stationary, difference once and re-test. Repeat until stationary.
- Once stationary, examine the ACF and PACF plots of the differenced series to determine p and q.
- If ACF decays and PACF cuts off at lag p, consider AR(p).
- If PACF decays and ACF cuts off at lag q, consider MA(q).
- If both decay, consider ARMA(p, q).
- Estimation: Estimate the model parameters (φ's and θ's) using methods like Maximum Likelihood Estimation (MLE).
- Diagnostic Checking: Verify if the model assumptions are met, particularly if the residuals are white noise. Plot residuals, ACF/PACF of residuals, and perform statistical tests (e.g., Ljung-Box test). If residuals are not white noise, return to the identification stage.
- Forecasting: Use the estimated model to generate forecasts for future values.
5. Seasonal ARIMA (SARIMA) Models
For time series with strong seasonal patterns, SARIMA models are used. They extend ARIMA by adding seasonal components. A SARIMA model is denoted as SARIMA(p, d, q)(P, D, Q)m, where:
- (p, d, q) are the non-seasonal orders.
- (P, D, Q) are the seasonal orders (seasonal AR, seasonal differencing, seasonal MA).
- m is the number of periods in a season (e.g., 12 for monthly data, 4 for quarterly data).
6. Vector Autoregression (VAR) Models
VAR models are used when analyzing multiple time series variables that are interdependent. Instead of modeling each variable separately, VAR models capture the dynamic interrelationships among a set of variables. A VAR(p) model includes p lags of all variables on the right-hand side of the equation for each variable. For example, a VAR(1) system with two variables, Yt and Xt: Yt = c1 + φ11,1Yt-1 + φ12,1Xt-1 + ε1t Xt = c2 + φ21,1Yt-1 + φ22,1Xt-1 + ε2t VAR models are particularly useful in macroeconomics for analyzing the impact of policy changes or shocks on multiple economic variables simultaneously.
Cointegration and Error Correction Models (ECM)
When dealing with non-stationary time series (specifically, those that are integrated of order 1, denoted I(1)), we often encounter the issue of spurious regression. However, if two or more non-stationary series are cointegrated, it means they have a long-run equilibrium relationship, and their deviations from this equilibrium are stationary.
Cointegration: A set of I(1) variables are cointegrated if a linear combination of them is stationary (I(0)). This implies that although the individual series wander randomly, they tend to move together in the long run and do not drift arbitrarily far apart.
Engle-Granger Two-Step Method: A common method to test for cointegration.
- Regress one variable on the other(s) (e.g., Yt = β0 + β1Xt + ut).
- Test the residuals (ut) from this regression for stationarity using a unit root test (like ADF). If the residuals are stationary, then Yt and Xt are cointegrated.
Error Correction Model (ECM): Once cointegration is established, an ECM can be used to model the short-run dynamics of the variables while ensuring they converge to their long-run equilibrium. An ECM incorporates the deviations from the long-run equilibrium (the error correction term) into a model of short-run adjustments. A simple ECM for two cointegrated variables Yt and Xt might look like: ΔYt = α(Yt-1 - (β0 + β1Xt-1)) + γ1ΔYt-1 + γ2ΔXt-1 + εt Here, (Yt-1 - (β0 + β1Xt-1)) is the error correction term (the lagged deviation from equilibrium). The coefficient α (the error correction coefficient) is expected to be negative, indicating that the system adjusts to correct the previous period's disequilibrium.
Forecasting with Time Series Models
The ultimate goal of much time series analysis is forecasting. Once a model is fitted and validated, it can be used to predict future values.
Point Forecasts: Provide a single value as the best prediction for a future period.
Interval Forecasts: Provide a range of values within which the future value is expected to lie with a certain probability (e.g., a 95% confidence interval). Interval forecasts become wider as the forecast horizon increases, reflecting greater uncertainty.
Model Selection Criteria: When choosing among competing models, criteria like AIC (Akaike Information Criterion) and BIC (Bayesian Information Criterion) are used. These criteria balance model fit (how well the model explains the data) with model complexity (number of parameters), penalizing models that are overly complex for the data they explain. Lower AIC/BIC values generally indicate a preferred model.
Forecasting in economics is challenging due to the inherent complexity and often unpredictable nature of economic systems. Models provide a systematic framework, but their predictions should always be interpreted with caution, considering potential structural breaks, policy changes, and unforeseen events.