π Lecture 41 β Forecasting-I
π Overview: This lecture introduces the concept of forecasting in econometrics, distinguishing it from mere prediction. It covers the meaning, types, and methods of forecasting, including various time series techniques. Understanding these fundamentals is critical for using econometric models to make informed statements about future events.
ποΈ Topics Covered
The lecture begins by defining forecasting and differentiating it from prediction, then outlines the requirements for good forecasting and common methods. It categorizes forecasts into types: ex-ante vs. ex-post, mean vs. individual, conditional vs. unconditional, and qualitative vs. quantitative. The lecture then explores patterns in time series data (trend, seasonal, cyclical, irregular) and presents several time series forecasting models: last period, simple/weighted average, moving averages, seasonal indices, exponential smoothing, and trend methods. Finally, it introduces associative or causal forecasting.
π Lecture Summary
Meaning and Types of Forecasting
Forecasting is a probabilistic statement about the future based on a systematic procedure. In econometrics, it is defined as βPredicting a known or unknown value of a dependent variable based on known or unknown values of the independent variables by using an econometric model.β Good forecasting requires that there are patterns or regularities to capture, that these patterns provide information about the future, and that the econometric model can capture them. However, irregular variations and shocks cannot be predicted.
π Definition β Prediction vs. Forecasting: Prediction is an inference from laws of nature, while Forecasting is more probabilistic. π‘ Why this matters: Forecasting acknowledges uncertainty and uses systematic models, unlike deterministic predictions.
Methods of forecasting include guesswork, leading indicators, extrapolation, time series models, and econometric forecasting models. Forecasts are never 100% accurate due to unknown factors (both known unknowns and unknown unknowns) and the problem of using static models for a dynamic world.
Types of Forecast
- Ex Ante and Ex Post Forecasts: Ex post forecasts are always unconditional. Ex ante forecasts may or may not be unconditional.
- Example: (Y_t = f(X_{t-3}, X_{t-4}))
- Mean Forecast and Individual Forecast: Individual Forecast predicts the individual value of the dependent variable; Mean Forecast predicts the expected value.
- Conditional and Unconditional Forecast: Unconditional Forecast uses known values of explanatory variables; Conditional Forecast uses unknown values of explanatory variables.
- Qualitative and Quantitative Forecast: Qualitative Forecast is subjective (opinion, surveys); Quantitative Forecast is based on mathematical models.
Patterns in Time Series Data
- Trend: Steady growth or decline over time in the long run.
- Seasonal Variations: Variations in different parts of the year (short run).
- Cyclical Variation: Upward or downward movement over the medium term (e.g., business cycle).
- Irregular or Random Variations or Shocks: Unpredictable variation without any pattern (e.g., war, natural disasters).
Time Series Models for Forecasting
The lecture uses hypothetical demand data from 2006 to 2013, converted to annual data.
a) Last Period Method: Uses the value of the previous time period as a forecast. π Example: For 2014, forecast = 85 (the demand of 2013).
b) Simple or Weighted Average Method: Uses the average of previous demands as a forecast.
- Simple Average: For 2008, forecast = (61+62)/2 = 61.5. For 2009, forecast = (61+62+66)/3 = 63.
- Weighted Average: Weights are assigned (e.g., 0.6 for the previous year and 0.4 for two years back). For 2008, forecast = 0.662 + 0.461 = 61.6.
c) Simple or Weighted Moving Averages: Uses the moving average of a fixed number of previous periods (e.g., 2 years). For 2008, forecast = (61+62)/2 = 61.5. For 2009, forecast = (62+66)/2 = 64.
d) Seasonal Indices: Uses seasonal patterns in the data. (Not elaborated with example here.)
e) Exponential Smoothing: A weighted technique where more weight is given to recent observations. The forecast is: (F_{t+1} = F_t + \alpha (A_t - F_t)), where (\alpha) is a smoothing coefficient (0 to 1). π Formula: (F_{t+1} = F_t + \alpha (A_t - F_t)) β The new forecast is the old forecast plus a fraction of the previous forecast error. π Example: With (\alpha = 0.1), forecast for 2007 = 61 + 0.1(62-61) = 61.1. For 2008, forecast = 61.1 + 0.1(66-61.1) = 61.4. π‘ Why this matters: This method smooths random fluctuations and is adaptive to recent changes.
f) Trends: Uses least squares to fit a regression line to forecast. The equation is (Y = a + bT). π Example: (Y = 55.393 + 3.607 * T). For 2014 (T=9), forecast = 55.393 + 3.607*(9) = 87.857.
Associative or Causal Forecast
This depends on associated variables, not time. For example, demand may depend on price. A regression line like (Demand = a + b * Price) is used. π Example: (Demand = 500.49 - 44.84 * Price). For 2014 with a forecasted price of 9.3, forecast = 500.49 - 44.84*(9.3) = 83.47.
β Key Takeaways
Forecasting is a probabilistic, systematic procedure for predicting future events; it is never 100% accurate. Forecasts are categorized as ex-ante/ex-post, mean/individual, unconditional/conditional, and qualitative/quantitative. Time series data exhibit trend, seasonal, cyclical, and irregular patterns which inform model choice. Common forecasting models include last period, simple/weighted average, moving average, exponential smoothing, and trend methods. Finally, associative causal forecasts use regression on explanatory variables like price, rather than time.
π§ Quick Revision Questions
- What is the difference between a prediction and a forecast in econometrics?
- What are the three requirements for a good forecasting model?
- Explain the difference between an unconditional forecast and a conditional forecast. Provide an example.
- Describe the exponential smoothing forecasting method. What is the role of the smoothing constant (alpha)?
- How does an associative/causal forecast differ from a trend-based forecast? Give an example of a variable that might be used in an associative forecast.
π Lecture 42 β Forecasting-II
π Overview: This lecture focuses on advanced forecasting techniques, specifically how to handle seasonal variation in time series data and how to evaluate the performance of different forecasting models. It is critical for ensuring forecasts are accurate and reliable for business decision-making, and introduces key metrics to compare model efficacy.
ποΈ Topics Covered
This lecture covers the calculation of seasonal indices to adjust forecasts for quarterly patterns. It then introduces several forecasting performance measures like Mean Absolute Error (MAE) and Root Mean Square Error (RMSE) to evaluate model accuracy. The concept of tracking signals is explained for monitoring forecast bias over time. Finally, it discusses the variance of forecast error, breaking it down into model variance and estimation variance, and how to compute it, for instance in Stata.
π Lecture Summary
Seasonal Variation and forecasting
The lecture begins by demonstrating seasonal variation in data, where values show a recurring pattern within a year. In the example, values are generally high in the second quarter and lowest in the first quarter. To make accurate forecasts, these seasonal effects must be accounted for.
Calculating Seasonal Index
A seasonal index is a multiplier that adjusts forecasts to reflect typical seasonal patterns. The index is calculated by first reshaping data into quarterly columns and computing the average for each quarter across all years. The grand average (average of all quarterly averages) is then found.
π Definition β Seasonal Index: A factor used to adjust a forecast for a specific season (e.g., quarter) so that it reflects the typical pattern of variation within a year.
π Formula: Seasonal Index for a quarter = (Quarterly Average of that quarter) / (Grand Average of all quarterly averages).
π Example: From the data, quarterly averages for Q1-Q4 are 16.25, 20, 18.5, and 16.75. The grand average is (16.25 + 20 + 18.5 + 16.75) / 4 = 17.90625. The seasonal index for Q1 is 16.25 / 17.90625 = 0.9075. The sum of all seasonal indices always equals 4 (for quarterly data).
π‘ Why this matters: To produce a seasonally adjusted forecast, you first make a forecast using any method (like a trend projection), then multiply that forecast by the relevant seasonal index.
π Example: A regression on time gives the formula: Demand = 14.24395 + 0.221957 (Time). For the four quarters of 2014, Time values are 33, 34, 35, and 36, yielding unadjusted forecasts (e.g., 21.57, 21.79, 22.01, 22.23). These are adjusted by multiplying by the seasonal indices (0.9075, 1.1239, 1.0332, 0.9354), giving the final adjusted forecasts (e.g., 19.57, 24.49, 22.74, 20.80).
Measuring Forecasting Performance
To compare different forecasting methods, we use performance measures based on the forecast error, which is the difference between the actual value and the forecasted value (Y_t - F_t). These measures are used on Ex Post Forecasts, where actual values are known.
π Definition β Forecast Error: The difference between the actual value of a variable and its forecasted value (Y_t - F_t).
The lecture lists several key performance measures:
- Mean Forecast Error (MFE): The arithmetic mean of forecast errors. Its weakness is that positive and negative errors can cancel each other, giving a misleadingly low error.
- Mean Absolute Error (MAE) or Mean Absolute Deviation (MAD): The mean of the absolute values of forecast errors. This solves the cancellation problem.
- Mean Absolute Percent Error (MAPE): The mean of the absolute errors expressed as a percentage of the actual values.
- Root Mean Square Error (RMSE): The square root of the mean of squared errors. It gives more weight to large errors.
- Root Mean Square Percent Error (RMSPE): The square root of the mean of squared percent errors. Useful when the variable's scale is large.
- Theilβs Inequality Coefficient (TIC): A scale-invariant measure that always falls between 0 and 1, where 0 indicates a perfect fit.
Tracking Signals in Forecasting
A tracking signal is used to monitor whether a forecasting model is consistently biased over time.
π Definition β Tracking Signal (TS): A measure used to detect bias in a forecasting model by comparing the cumulative forecast error to the Mean Absolute Deviation (MAD).
π Formula: TS = Cumulative Error / MAD
π Example: With data from 2008-2013, forecast errors are calculated. The cumulative error builds over time. For instance, in 2008, the cumulative error is -0.21, and the MAD is 0.21, giving a TS of -1.0. A safe range (e.g., -5 to 5) is selected, and the TS is plotted over time. If it stays within the channel, the model is considered unbiased.
Variance of Forecast Error
The variance of the forecast error Var(e_t+h) has two components: the model variance (ΟΒ²) and the estimated variance Var(YΜ_t+h).
π Definition β Variance of Forecast Error: The total uncertainty associated with a forecast, composed of the inherent random error of the model and the error from estimating the model's parameters.
π Formula: Var(e_t+h) = ΟΒ² + Var(YΜ_t+h)
The standard error of the forecast se(e_t+h) is sqrt(ΟΒ² + se(YΜ_t+h)Β²).
π‘ Why this matters: In practice, the standard error of the forecast (se_forecast or stdf in Stata) is larger than the standard error of the prediction (se_prediction or stdp in Stata) because it includes the model's irreducible error.
π Example: In the Stata output, the stdf value (e.g., 0.9105) is consistently larger than the stdp value (e.g., 0.5003) because stdf includes the additional model variance component.
β Key Takeaways
A student must remember that seasonal indices are multipliers derived from historical quarterly averages and must sum to 4 for quarterly data, used to adjust any base forecast. The six forecast error measuresβMFE, MAE/MAD, MAPE, RMSE, RMSPE, and TICβeach have specific strengths, and RMSE is particularly common. A tracking signal (Cumulative Error / MAD) is crucial for monitoring forecast bias, with a standard acceptable range of -5 to 5. Finally, the standard error of a forecast (stdf) is always larger than the standard error of prediction (stdp) because it includes the modelβs inherent variance.
π§ Quick Revision Questions
- Why is the Mean Forecast Error (MFE) considered a potentially misleading measure of forecasting performance?
- What is the formula for calculating a Seasonal Index, and why must the sum of indices for quarterly data equal 4?
- How is a Tracking Signal calculated, and what does a value consistently outside the range of -5 to 5 indicate?
- A regression forecast yields a standard error of prediction (stdp) of 0.5, and the model's RMSE is 0.8. What is the approximate standard error of the forecast (stdf)?
- What is the primary difference between Root Mean Square Error (RMSE) and Mean Absolute Error (MAE)?
π Lecture 43 β Time Series, Cointegration and Error Correction-I
π Overview: This lecture introduces the fundamental concepts of time series analysis, distinguishing between stationary and nonstationary processes. It explains why testing for non-stationarity is critical in econometrics to avoid spurious regressions and presents the two most common unit root tests: the Augmented Dickey-Fuller test and the Phillips-Perron test, including their implementation in Stata.
ποΈ Topics Covered
The lecture begins by defining time series analysis (univariate vs. multivariate) and the historical divergence between time-series analysts and econometricians. It then defines moments, explains strict and weak stationarity, and contrasts these with non-stationarity. The two main types of non-stationarity (random walk with drift and deterministic trend) are introduced along with their required treatments (differencing vs. detrending). The concept of integration order (I(d)) is presented, followed by a detailed explanation of unit root testing: why it matters, and how to perform both the Augmented Dickey-Fuller (dfuller) and Phillips-Perron (pperron) tests in Stata, with examples using the sunspot and dow1 datasets.
π Lecture Summary
What is a time series?
An analysis of a single sequence of data is called univariate time-series analysis. An analysis of several sets of data for the same sequence of time periods is called multivariate time-series analysis. Historically, econometricians emphasized economic theory and contemporaneous relationships, while time-series analysts preferred to let the data determine the model. Since the mid-1970s, these two approaches have been converging.
Stationary and Nonstationary time series
Moments are specific quantitative measures of the shape of a set of points. The first raw moment (βX/n) is the mean. The first moment about mean is zero. The second moment about mean is the variance.
The joint distribution of X(tβ), X(tβ), X(tβ)...X(tβ) is complicated, so we define:
- Mean = ΞΌ(X) = E(Xβ)
- Variance = ΟΒ²(t) = E(XΒ²)
- Autocovariance = Ξ³(tβ, tβ) = Cov(Xββ, Xββ)
The autocovariance is the covariance of the variable against a time-shifted version of itself (it is the variance if tβ=tβ=t).
Strict or Strong Stationary
A series is called strict stationary if the joint distribution of any set of n observations X(tβ), X(tβ), X(tβ)...X(tβ) is the same as the joint distribution of X(tβ+h), X(tβ+h), X(tβ+h)...X(tβ+h) for all n and h.
All moments are independent of t. The mean, variance, and all higher order moments of the joint distribution of any combination of variables X(tβ), X(tβ), X(tβ)...X(tβ) are constant and independent of t. This is a very strong assumption. Statistical properties do not change over time.
Define h = tβ - tβ and call it a lag. The autocovariance function Ξ³(tβ, tβ) = Ξ³(h) = Cov(Xβ, Xβββ) is the autocovariance function (acvf) at lag h. Var(Xβ) = Var(Xβββ) = ΟΒ² = Ξ³(0). The autocorrelation function at lag h is defined as Ο(h) = Ξ³(h)/Ξ³(0). A plot of Ο(h) is called a correlogram.
Second Order or Weak Stationary (covariance stationarity)
A series is called weakly stationary if its mean and variance do not depend on t (are constant) and the acvf depends only on the lag h. Stationary series revert in the long run to their mean.
Non-Stationarity
In real life, most of the data is non-stationary. Variables that increase over time are non-stationary. Mean and variance are not constant over time. We need differencing and/or detrending. We can define a non-stationary model as Xβ = ΞΌβ + eβ where mean ΞΌβ is a function of time (linear or non-linear) and eβ is a second order stationary series.
An Autoregressive Model specifies that the output variable depends linearly on its own previous values. Time series models include ARMA, ARIMA, etc. (not discussed in this lecture). OLS should not be used on non-stationary data (e.g., problem of spurious regression). We usually can transform variables by taking differences or using lags if the data becomes stationary at difference or lag.
Types of Non-Stationarity
- Random Walk with Drift: Yβ = ΞΌ + Yβββ + eβ
- Deterministic Trend Process: Yβ = Ξ²β + Ξ²βt + eβ
To induce stationarity, both will require different treatment: differencing for the random walk and detrending for the deterministic trend.
If a non-stationary series Yβ is differenced d times in order to become stationary, it is said to be integrated of order d. If Yβ ~ I(d) then Ξα΅Yβ ~ I(0). I(0) is a stationary series; it will cross the mean frequently. I(1) is a series containing one unit root. Most economic and financial series contain a single unit root (some may be stationary). However, prices have been seen in various researches to have 2 unit roots.
UNIT ROOT TEST
A unit root test tests whether a time series variable is non-stationary using an autoregressive model. The famous tests include the Augmented DickeyβFuller test and the Phillips-Perron test. The null hypothesis for these tests is the existence of a unit root.
Why do we need to test for Non-Stationarity?
- The stationarity or non-stationarity of a series can strongly influence its behavior and properties.
- Spurious regressions: If two variables are trending over time, a regression of one on the other could have a high R-square even if the two are totally unrelated.
- The parameters are misleading.
- If variables in the model are not stationary, the usual βt-ratiosβ will not follow a t-distribution, so various tests will not be valid.
Augmented Dickey-Fuller unit-root test (dfuller)
dfuller performs the augmented Dickey-Fuller test that a variable follows a unit-root process. It adds lagged differences to the model. The null hypothesis is that the variable contains a unit root, and the alternative is that the variable was generated by a stationary process. You may optionally exclude the constant, include a trend term, and include lagged values of the difference of the variable in the regression.
Syntax: dfuller varname [if] [in] [, options]
Menu: Statistics > Time series > Tests > Augmented Dickey-Fuller unit-root test
π Definition β Augmented Dickey-Fuller test: A unit root test that adds lagged differences of the dependent variable to the regression to account for serial correlation in the error term.
π Formula β The Dickey-Fuller regression models are:
- No constant, no time trend: ΞYβ = Ξ³Yβββ + uβ
- Constant, without time trend: ΞYβ = Ξ± + Ξ³Yβββ + uβ
- Constant and time trend: ΞYβ = Ξ± + Ξ³Yβββ + Ξ³t + uβ
Use constant (drift) when the series fluctuates against a non-zero mean.
Phillips-Perron unit-root test (pperron)
pperron performs the Phillips-Perron test that a variable has a unit root. The null hypothesis is that the variable contains a unit root, and the alternative is that the variable was generated by a stationary process. pperron uses Newey-West standard errors to account for serial correlation (so it allows for autocorrelated residuals), whereas the augmented Dickey-Fuller test implemented in dfuller uses additional lags of the first-difference variable.
Syntax: pperron varname [if] [in] [, options]
Menu: Statistics > Time series > Tests > Phillips-Perron unit-root test
π‘ Why this matters: The Phillips-Perron test is more robust than the ADF test to unspecified autocorrelation in the errors, as it uses non-parametric corrections.
Examples (from Stata output)
- Sunspot data: The
tsline spotgraph appears stationary. Thedfuller spottest output is shown but without explicit p-values in the text. - Dow Jones data: The
tsline dowclosegraph shows a random walk with non-zero drift. Thedfuller dowclosetest output indicates the coefficient of L1 is not significant, suggesting a unit root. Thedfuller D.dowclosetest is used after differencing. - Key options explained:
trend: Includes a trend term in the regression; the null hypothesis is a random walk, perhaps with drift. Cannot be used withnoconstantordrift.drift: Indicates the process under the null hypothesis is a random walk with nonzero drift. Cannot be used withnoconstantortrend.regress: Specifies that the associated regression table appear in the output.lags(#): Specifies the number of lagged difference terms to include.
- Phillips-Perron example: The
pperron dowcloseoutput is provided, testing for a unit root in the Dow Jones series.
β Key Takeaways
The most critical concepts from this lecture are: (1) A stationary series has constant mean, variance, and autocovariance that depends only on lag, while non-stationary series have time-dependent moments and require differencing or detrending. (2) Spurious regression occurs when unrelated trending variables yield high R-squared values, making unit root testing essential before any regression. (3) The Augmented Dickey-Fuller test adds lagged differences to correct for autocorrelation, while the Phillips-Perron test uses Newey-West standard errors for the same purpose. (4) Both tests have a null hypothesis of a unit root (non-stationarity), and the alternative is stationarity. (5) In Stata, the dfuller and pperron commands implement these tests, with options for including a constant (drift), a trend, or neither, depending on the characteristics of the series.
π§ Quick Revision Questions
- What is the difference between strict stationarity and weak (covariance) stationarity?
- Why is it problematic to run OLS regression on two independent non-stationary time series?
- What are the two main types of non-stationarity discussed in the lecture, and what is the appropriate treatment for each?
- What is the null hypothesis in both the Augmented Dickey-Fuller and Phillips-Perron unit root tests?
- How do the Augmented Dickey-Fuller test and the Phillips-Perron test differ in their approach to handling autocorrelation in the residuals?
π Lecture 44 β Time Series, Cointegration and Error Correction-II
π Overview: This lecture addresses what to do when time series data are non-stationary. It introduces cointegration as a method to preserve long-run relationships between integrated variables and presents the Error Correction Model (ECM) to model short-run dynamics while maintaining long-run equilibrium. The lecture provides a step-by-step procedure for the Engle-Granger cointegration test and ECM estimation using Stata.
ποΈ Topics Covered
The lecture covers the problem of non-stationarity in time series and two approaches: differencing (short-term) and cointegration (long-term). It explains the concept of cointegration, the Engle-Granger cointegration test procedure, the Granger Representation Theorem linking cointegration to error correction, and the specification and estimation of the Error Correction Model. A detailed example using Pakistani data on GFCF and imports from the ECM.dta file illustrates the entire process.
π Lecture Summary
What to do in case of non-stationarity?
Two main approaches are discussed. Differencing throws out long-term properties of the series and is good for short-term modeling only. Cointegration, introduced by Granger, preserves the long-run relationship between variables.
Cointegration
Two series of variables may be integrated, but their difference (or any linear combination) may be stationary. This means that each variable wanders quite far from its mean, but the two series wander very near each other. The value/location of one variable could be told by looking at the other variable. They have an equilibrium relationship (never expected to drift too far). Deviations from this equilibrium will be corrected over time.
Cointegration & Error Correction Model Using Stata
Engle-Granger Cointegration Analysis: STEPS
- Test individual variables for unit root
- Estimate the static regression
- Test for unit roots in the error of the static regression; if residuals are stationary, series are cointegrated.
- Finally, we can use Error Correction Model
Granger Representation Theorem: Two or more integrated time series that are cointegrated have an error correction representation. If x and y are cointegrated, we can model y and x as being in an error correcting relationship. It has y and x being in an equilibrium relationship, with the short-run behavior of y being a function of the short-run behavior of x and an equilibrating factor. It estimates the speed at which a dependent variable Y returns to equilibrium after a change in an independent variable X.
π Definition β Error Correction Model (ECM): A model that captures both the short-run dynamics and the long-run equilibrium relationship between cointegrated variables.
π Formula: βYβ = Ξ²βXβ + Ο(Yβββ β Ξ³Xβββ) + Ξ΅β Where Yβββ β Ξ³Xβββ is the predicted error generated from a basic regression Y on X. Ξ΅β is stationary (test for this with Dickey-Fuller). Ξ² is the short-run effect of x on y and Ο is the speed of equilibration, with Ξ³ giving the long-run relation between y and x.
π‘ Why this matters: ECM is normally used on non-stationary data but can be used for stationary data.
Cointegration and Error Correction Model in Detail
Stationary Data means that data has a finite mean and variance that do not depend on time. Data reverts to mean in the long run. It crossed the mean quite often.
Integrated time series data:
- Does not revert to the mean
- Usually moves in a random walk
- Previous changes are reflected in the current value
- May have infinite variance and no appropriate mean
- Shocks are permanently incorporated
If a non-stationary series Yβ is difference d times in order to become stationary, it is said to be integrated of order d β denoted I(d).
Two series are cointegrated if:
- They are integrated of the same order
- There is a linear combination of the two series that is stationary i.e. integrated of order zero I(0)
- Cointegrated data do not drift very far from each other.
- Deviation from equilibrium will be corrected over time
Critical Values and Power
For the Engle-Granger test, special critical values are used instead of standard t-distribution values:
| Statistics Name | 1% | 5% | 10% |
|---|---|---|---|
| DF | 4.07 | 3.37 | 3.03 |
| ADF | 3.77 | 3.17 | 2.84 |
Example: GFCF and IMPORTS (Pakistan, 1983-2012)
Using the file ECM.dta containing Pakistani data (GDP, GFCF, imports) from WDI for years 1983 to 2012, the lecture examines whether GFCF and IMPORTS are cointegrated.
Both GFCF and Imports are integrated at first difference β they are both I(1), meaning they are integrated at the same level.
Engle-Granger Test Steps Applied:
- Run a basic regression (long run): regress GFCF on imports
- Predict the errors: generate residuals
- Run the regression of first difference of residuals on lag of residuals and on lag of first difference of residuals
If the coefficient of lag of residuals is significant, the series are cointegrated. IMPORTANT: the t-values reported in simple regression are not appropriate; we use the EG critical values.
π Example β Test Results: The coefficient of first lag of residuals is -0.5926 and the t-value is -3.42. The critical value at 5% is -3.37. Our value, -3.42 < -3.37, so the hypothesis of no cointegration is rejected. The series are cointegrated. If the test statistic < critical value, we reject the null hypothesis that the least square residuals are non-stationary (no cointegration).
ECM Estimation Results from ECM.dta: Using Stata commands:
tsset year
regress gfcf imports
predict rhat, residual
Then running the ECM with residuals: The short-run effect of imports on GFCF is positive and significant (Ξ²). The long-term relation is established by the coefficient -0.3765 (Ο) which is also significant. The speed shows that the deviations from equilibrium are corrected at 37.5% in one time period.
π‘ Why this matters: Additional or alternative lags and deterministic terms may be added to the ECM specification.
β Key Takeaways
The most critical message is that when two non-stationary series are integrated of the same order and their linear combination is stationary, they are cointegrated, meaning they share a long-run equilibrium relationship. The Engle-Granger two-step procedure involves testing unit roots individually, running a static regression, and testing residuals for stationarity using special critical values. Once cointegration is established, the Error Correction Model (ECM) must be used, which includes both short-run dynamics (Ξ²ΞX) and an error correction term (Ο * lagged residual) that captures the speed of adjustment back to equilibrium. In the example, GFCF and imports were found to be cointegrated, and deviations from equilibrium were corrected at 37.5% per time period. Always remember to use EG critical values (not standard t-tables) when testing cointegration.
π§ Quick Revision Questions
- What is the fundamental difference between using differencing versus cointegration when dealing with non-stationary time series?
- List the three conditions that must be satisfied for two time series to be cointegrated.
- What is the Granger Representation Theorem and what does it imply about cointegrated variables?
- In the Error Correction Model βYβ = Ξ²βXβ + Ο(Yβββ β Ξ³Xβββ) + Ξ΅β, what do each of the parameters Ξ², Ο, and Ξ³ represent economically?
- Why can't we use standard t-distribution critical values when testing for cointegration using the Engle-Granger method, and what critical values should be used instead?
π Lecture 45 β Time Series, Cointegration and Error Correction-III
π Overview: This lecture continues the discussion of time series econometrics, focusing on autoregressive processes, vector autoregressive (VAR) models, ARIMA modeling, and cointegration testing. It provides practical Stata applications for estimating these models and interpreting their results, which is essential for analyzing economic data that is recorded over time.
ποΈ Topics Covered
The lecture covers Autoregressive (AR) processes including AR(p) and AR(1) specifications with Stata examples, Vector Autoregressive (VAR) models and stationarity requirements using Dickey-Fuller tests and Schwert's rule of thumb for optimal lag selection, ARMA and ARIMA modeling with post-estimation diagnostics, Johansen's test for cointegration using maximum likelihood estimation, and the Vector Error Correction Model (VECM) as a multivariate extension of ECM.
π Lecture Summary
Time Series Definition
Variables recorded over time can be observed at different frequencies: Annually (Macro data), Biannually (financial data), Quarterly (Macro data, agricultural data), Monthly (agricultural data, market prices), or Daily (Stock exchange, Foreign Exchange Rates, commodity prices). The lecture includes an example graph showing Pakistan's exports over time.
Autoregressive Process
An Autoregressive Process occurs when a variable depends linearly on its own past values (lags), expressed as a weighted sum of past values.
π Definition β AR(p) process: ν¦β = Οβ + Οβν¦βββ + Οβν¦βββ + ... + Οβν¦βββ + Ξ΅β
π Definition β AR(1) process: ν¦β = Οβ + Οβν¦βββ + Ξ΅β
π Example β Stata AR(3) model: reg gdp L.gdp L2.gdp L3.gdp
VAR (Vector Autoregressive Model)
A VAR (Vector Autoregressive Model) is a multivariate time-series regression of each dependent variable on lags of itself and on lags of all the other dependent variables.
π Definition β VAR(1) process for y and z:
- ν¦β = Ξ±β + Ξ±βν¦βββ + Ξ±βν§βββ + uβ
- ν§β = Ξ²β + Ξ²βν¦βββ + Ξ²βν§βββ + vβ
π Example β Stata VAR(1) model: tsset time then var gdp exports, lags(1). If lags are not specified, 2 is the default.
Stationarity Requirement: For VAR, both series should be stationary. The Dickey Fuller test can be used to determine at what level data is stationary. For Dickey Fuller test, we need to know the appropriate lag.
Lag Selection Trade-offs:
- If p is too small, remaining serial correlation in the errors will bias the test.
- If p is too large, the power of the test will suffer.
- Monte Carlo experiments suggest it is better to err on the side of including too many lags.
π Schwert's (1989) rule of thumb: pβββ = [12 Β· (T/100)^(1/4)] where T = number of observations and [ ] means integer part.
π Example: In ECM.dta with 30 observations, lags = 8. The default lag length for the dfuller command is zero.
π Example β Stationarity test results: Imports are stationary at second level. The command dfuller for random walk with drift is used. If they follow random walk with drift, exports and imports are integrated of order 1.
Applying VAR
First determine the optimal lag length for VAR. The command is varsoc (number of max lags can be given).
π Definition β AIC (Akaike Information Criterion): Should be minimized; suggested lag is ONE.
π Example β Model estimation: Default lag=2 so we need to specify ONE (suggested by AIC). Here the sign and significance, not the magnitude, are important.
Post Estimation Test: Stability of the model requires eigenvalues should be less than one (roots of the companion matrix). After running the model, use varstable, graph.
ARMA (Autoregressive Moving Average) and ARIMA (Autoregressive Integrated Moving Average)
An ARIMA model is a combination of AR and MA processes where AR is autoregressive, I is Integrated, and MA is a Moving Average process (a process containing past realizations of the variable's own residual).
π Definition β ARMA(p,q) process: yβ = Οβ + Ξ΅β + Οβeβββ + Οβeβββ + ... + Οβeβββ
- ARMA(1,0) is same as AR(1)
- ARMA(0,1) is same as MA(1)
π ARMA(1,1) process: yβ = c + Ξ±βyβββ + Ξ²βΞ΅βββ + Ξ΅β
Series where I=0 is stationary. arima is a maximum likelihood estimation (not OLS). The lecture discusses Univariate ARIMA.
π Example β Stata: Must run arima on a stationary series. Stationary level must be determined. Command: arima gdp, arima (1,1,1) which is the same as arima gdp, ar(1) ma(1).
ARIMA Post Estimation Commands in Stata:
estat acplotestimates autocorrelation and covariances (produces parametric autocorrelations with 95% confidence intervals)estat arootschecks the stability conditionsestat vcegives the Variance covariance matrix of the estimates
Johansen's Test for Cointegration
This test is based on maximum likelihood estimation and two statistics: maximum eigenvalues and a trace-statistic.
π Definition β Johansen's Test: Used to test for cointegration among variables.
π Example β Stata command: vecrank exports imports, lags(1) using one lag as suggested by varsoc for VAR model. Results: Variables are cointegrated. If rank would have been zero, there would have been no cointegration.
Vector Error Correction Model (VECM)
ECM cannot be used in complex situations like with more nonstationary variables. A Vector Error Correction Model (VECM) adds error correction features to a multi-factor model such as a vector autoregressive model. It is the multivariate specification of ECM.
π Example β Stata: The command is vec. There is one lag less than that of VAR, but Stata will automatically subtract the lag. Syntax: vec varlist [if] [in] [, options]. Menu path: Statistics > Multivariate time series > Vector error-correction model (VECM).
π Example β Using the option alpha gives the short run adjustment parameters. Results show that gfcf responds faster than exports in case of changes or shocks.
Post Estimation commands for vec:
- Eigenvalues should be within the circle (stability check)
veclmartests the autocorrelation of residuals β in the example, no autocorrelation is detected.
β Key Takeaways
The lecture teaches that autoregressive processes model variables based on their own past values, and when moving to multivariate settings, VAR models require all series to be stationary, with lag selection being criticalβSchwert's rule helps determine optimal lags for Dickey-Fuller tests. ARIMA models combine autoregressive, integrated, and moving average components and require maximum likelihood estimation on stationary series. Johansen's test using maximum eigenvalues and trace statistics determines cointegration, and if variables are cointegrated, a VECM is the appropriate multivariate specification that automatically handles lag adjustments. Post-estimation diagnostics including stability checks (eigenvalues less than one) and autocorrelation tests (veclmar) are essential for model validation.
π§ Quick Revision Questions
- What is the difference between an AR(p) process and a VAR(1) process?
- Why must both series be stationary before estimating a VAR model, and how is stationarity tested?
- What does Schwert's rule of thumb calculate, and why is choosing the correct lag important in Dickey-Fuller tests?
- What are the two statistics used in Johansen's test for cointegration, and what does the rank indicate?
- How does a Vector Error Correction Model (VECM) differ from a standard ECM, and what post-estimation commands are used to validate it?