models with eviews res. asst. gizem...
TRANSCRIPT
WORKSHOP on
Forecasting, and Volatility Models with EViews
Asst. Prof. Dr. Kemal BagzibagliDepartment of Economic
Res. Asst. Pejman BahramianPhD Candidate, Department of Economic
Res. Asst. Gizem UzunerMSc Student, Department of Economic
EViews Workshop Series Agenda1. Introductory Econometrics with EViews
2. Advanced Time Series Econometrics with EViewsa. Unit root test and cointegrationb. Vector Autoregressive (VAR) modelsc. Structural Vector Autoregressive (SVAR) modelsd. Vector Error Correction Models(VECM)e. Autoregressive Distributed Lag processes
3. Forecasting, and Volatility Models with EViewsa. Forecastingb. Volatility modelsc. Regime Switching Models
2
Part 3 - Outline1. Forecasting
a. Forecasting with Exogenous Variablesb. Out-of-sample Forecastsc. Forecasting with AR Termsd. Forecasting with MA Terms
2. Volatility Modelsa. Autoregressive Conditionally Heteroscedastic (ARCH) Models
i. Testing for “ARCH Effects”ii. Problems with ARCH(q) Models
b. Generalised ARCH (GARCH) Modelsc. Extensions to Basic GARCH (EGARCH) Modelsd. The GJR Model
3. Markov Regime Switching Models 3
1. Forecasting
Forecasting with Exogenous Variables● Suppose we want to forecast the level of non-farm payroll
employment for the period from 2014m04 to 2014m12.● To accomplish this task, we first need to specify and estimate
a model. Let’s model the payroll level as a linear function of a time trend and seasonal factors.
Estimation1.Type in the command window: ls payroll c @trend @expand(@month, @dropfirst)
2.Press Enter (save this equation as eq01).5
Forecasting with Exo. Variables (cont.)
● Note that command @expand(@month) creates 12 dummy variables, one for each month of the year.
● These are the seasonal factors. ● Because we have included a constant, we need to exclude
one of the dummy variables in order not to fall in the dummy variable trap.
● Here we have chosen to exclude January, by using the option @dropfirst. 6
Forecasting with Exo. Variables (cont.)We also plot the actual and fitted values of the model:View → Actual, Fitted, Residual → Actual Fitted Residual Graph.
7
To forecast press the button in the equation toolbar.
1. Under Series name, specify a name for the forecast series. EViews suggests a name (payrollf) but this series will be overwritten every time a new model is estimated. Let’s save our series as eq01_f.
2. Under Forecast sample, select the sample over which the forecast will be carried out. Here we type, 2013m04 @last.
Forecasting with Exo. Variables (cont.)
8
Forecasting with Exo. Variables (cont.)3. Check “Insert actuals for out-of-sample
observations.”4. Under Method, notice that EViews indicates this is a
Static forecast (no dynamics in the equation) (more details later).
5. Under Output, check Forecast graph and Forecast evaluation.
6. Click OK.
9
Forecasting with Exo. Variables (cont.)The Forecast Output is shown here. Notice that EViews shows the series Eq01_f over the forecast sample, together with 2 standard error bands.
10
Forecasting with Exo. Variables (cont.)What would happen if we set the forecast sample to be the entire range of the workfile?
11
Forecasting with Exo. Variables (cont.)1. Under Series name, name the new forecasted series
eq01_f3.2. Set all the other options as we did before (check
Forecast graph and Forecast evaluation, check “Insert actuals for out-of-sample observations.”
3. Under Forecast Sample, set the sample to the entire workfile range (1960m01 2014m12).
4. Click OK. 12
Out-of-Sample Forecasts
Estimation1.Type in the command window:
smpl 1960m01 2008m12 ls payroll c @trend @expand(@month,@dropfirst)
13
2. Open eq02. On the equation box toolbar, press the button. The Forecast dialog box opens up.
3. Under Series name, name the series eq02_f.
4. Under the Forecast sample, type the forecast sample (here, 2009m1 2014m12).
14
Out-of-Sample Forecasts
5. Set all the other options as we did previously (check Forecast graph, Forecast evaluation, and Insert actuals for out-of-sample observations).
6. Click OK.
15
Out-of-Sample Forecasts (cont.)
• For comparison purposes, we have also shown a graph of the payroll and eq02_f series. Notice that since we selected to “Insert actuals for out-of-sample observations” the series are identical over the estimation sample (1960m1 to 2008m12 ).
Forecast Graph Payroll vs eq02_f
16
Out-of-Sample Forecasts (cont.)
Estimation with AR terms 1.Let’s first specify a model with two AR terms. Type in the command window: smpl sample_est ls payroll c ar(1) ar(2) @trend @expand(@month, @droplast)
17
Forecasting with AR Terms
Estimation with AR terms
2.Press Enter (the second command should be typed in one line).
18
Forecasting with AR Terms (cont.)
3. Open eq06 and click the button. As usual, the Forecast dialog box opens up. Name the series eq06_dyn for the dynamic series and eq06_stat for the static forecast series.
19
Forecasting with AR Terms (cont.)
20
Forecasting with AR Terms (cont.)4. Under Forecast Sample set
the sample to sample_for. Under Method, select Dynamic forecast (for the dynamic series), and Static forecast (for the static series). Set the rest of the parameters as shown here.
5. Click OK.
• The Forecast Output for both methods is shown here. To produce forecasts with AR terms, EViews adds forecasts of the residuals to the forecasts of the structural model (structural model is based solely on explanatory variables).
• As expected, the static forecast
(bottom graph) goes up to 2013m04, and performs better than the dynamic forecast. 21
Forecasting with AR Terms (cont.)
● In the dynamic forecast (top graph), the lagged residuals are forecasted dynamically. This means that future values of lagged residuals are formed using the forecasted values of the dependent variable.
● In contrast, the static forecast uses actual lagged residuals and actual values for the dependent variable to produce forecasts.
22
Forecasting with AR Terms (cont.)
Estimation with MA terms 1.Let’s first specify a model with one MA term. Type in the command window: smpl sample_est ls payroll c ma(1) @trend @expand(@month, @droplast)
23
Forecasting with MA Terms
24
Forecasting with MA Terms (cont.)2.Press Enter (the second command should be typed in one line).
• Let’s produce dynamic and static forecast for the MA(1) model we just estimated.
1. Open equation and click the button. As usual, the Forecast dialog box opens up. Name the series eq08_dyn and eq08_stdev_dyn for the dynamic series and eq08_stat and eq08_stdev_stat for the static forecast series.
2. Under Forecast Sample set the sample to sample_for. 25
Forecasting with MA Terms (cont.)
1. Note that a new field MA backcast appears. Here you can choose either of two options: Estimation period (the default) and Forecast available (v5). Let’s choose Estimation period.
2. Click OK.
26
Forecasting with MA Terms (cont.)
2. Volatility Models
• ARCH–Autoregressive Conditional
Heteroscedasticity
• GARCH–Generalized ARCH
Modeling Volatility
28
The full model would be
where, • We can easily extend this to the general case where
the error variance depends on q lags of squared errors:
• This is an ARCH(q) model.29
Autoregressive Conditionally Heteroscedastic (ARCH) Models
30
Autoregressive Conditionally Heteroscedastic (ARCH) Models (cont.)
• Instead of calling the variance , in the literature it is usually called ht, so the model is
where,
• For illustration, consider an ARCH(1). Instead of the above, we can write
yt = β1 + β2x2t + ... + βkxkt + ut , ut = vtσt
, vt ∼ N(0,1) • The two are different ways of expressing exactly the same model.
The first form is easier to understand while the second form is required for simulating from an ARCH model, for example.
31
Another Way of Writing ARCH Models
1. First, run any postulated linear regression of the form given in the equation above, e.g. yt = β1 + β2x2t + ... + βkxkt + ut
saving the residuals, .
2. Then square the residuals, and regress them on q own lags to test for ARCH
of order q, i.e. run the regression
where vt is iid. Obtain R2 from this regression
32
Testing for “ARCH Effects”
33
Testing for “ARCH Effects” (cont.)
3. The test statistic is defined as TR2 (the number of observations multiplied by the coefficient of multiple correlation) from the last regression, and is distributed as a χ2(q).
4. The null and alternative hypotheses areH0 : γ1 = 0 and γ2 = 0 and γ3 = 0 and ... and γq = 0H1 : γ1 ≠ 0 or γ2 ≠ 0 or γ3 ≠ 0 or ... or γq ≠ 0.
If the value of the test statistic is greater than the critical value from
the χ2 distribution, then reject the null hypothesis.
• Note that the ARCH test is also sometimes applied directly to returns instead of the residuals from Stage 1 above.
34
Testing for “ARCH Effects” (cont.)
• How do we decide on q?• The required value of q might be very large• Non-negativity constraints might be violated.
– When we estimate an ARCH model, we require αi >0 ∀ i=1,2,...,q (since variance cannot be negative)
• A natural extension of an ARCH(q) model which gets around some of these problems is a GARCH model.
35
Problems with ARCH(q) Models
•• Bollerslev (1986): Allow the conditional variance to be dependent
upon previous own lags• The variance equation is now
(1)• This is a GARCH(1,1) model, which is like an ARMA(1,1) model for
the variance equation.• We could also write
36
Generalised ARCH (GARCH) Models
• By iterative substitution of σt-i
2 , for i = 2, 3, …, t into (1)• GARCH(1,1) model can be written as an infinite order ARCH model.
37
Generalised ARCH (GARCH) Models (cont.)
38
• But in general a GARCH(1,1) model will be sufficient to capture the volatility clustering in the data.
• Why is GARCH better than ARCH?
- more parsimonious - avoids overfitting- less likely to breach non-negativity constraints
Generalised ARCH (GARCH) Models (cont.)
39
The Unconditional Variance under the GARCH Specification
• The unconditional variance of ut is given by
when• is termed “non-stationarity” in variance
• is termed integrated GARCH
• For non-stationarity in variance, the conditional variance forecasts will not converge on their unconditional value as the horizon increases.
• Since the model is no longer of the usual linear form, we cannot use OLS.
• We use another technique known as maximum likelihood.
• The method works by finding the most likely values of the parameters given the actual data.
• More specifically, we form a log-likelihood function and maximise it.
40
Estimation of ARCH / GARCH Models
• Since the GARCH model was developed, a huge number of extensions and variants have been proposed. Three of the most important examples are EGARCH, GJR, and GARCH-M models.
• Problems with GARCH(p,q) Models:
- Non-negativity constraints may still be violated- GARCH models cannot account for leverage effects
• Possible solutions: the exponential GARCH (EGARCH) model or the
GJR model, which are asymmetric GARCH models.
41
Extensions to the Basic GARCH Model
• Suggested by Nelson (1991). The variance equation is given by
• Advantages of the model- Since we model the log(σt
2), then even if the parameters are negative, σt
2
will be positive.- We can account for the leverage effect: if the relationship between volatility and returns is negative, γ, will be negative.
42
The EGARCH Model
• Due to Glosten, Jaganathan and Runkle
where It-1 = 1 if ut-1 < 0 = 0 otherwise
• For a leverage effect, we would see γ > 0. • We require α1 + γ ≥ 0 and α1 ≥ 0 for non-negativity.
43
The GJR Model
44
Estimation of ARCH Models in EViews
The Mean Equationyou should enter the specification of the mean equation
Class of models● To estimate one of the
standard GARCH models as described above, select the GARCH/ TARCH entry in the Model dropdown menu.
● The other entries (EGARCH, PARCH, and Component ARCH(1, 1)) correspond to more complicated variants of the GARCH specification.
45
Estimation of ARCH Models in EViews (cont.)
Variance repressorslist variables you wish to include in the variance specification.
Estimation Options
46
Estimation of ARCH Models in EViews (cont.)
The main output from ARCH estimation is divided into two sections—the upper part provides the standard output for the mean equation, while the lower part, labeled“Variance Equation”,
47
Output
GARCH Graph/Conditional Standard Deviation and GARCH Graph/Conditional Variance plots the one-step ahead standard deviation or variance for each observation in the sample
48
Views of ARCH Models
Residual Diagnostics/ ARCH LM Test carries out Lagrange multiplier tests to test whether the standardized Residuals exhibit additional ARCH.
49
Views of ARCH Models (cont.)
Forecast uses the estimated ARCH model to compute static and dynamic forecasts of the mean, its forecast standard error, and the conditional variance.
50
Views of ARCH Models (cont.)
3. Markov Regime Switching Models
● Allowing for periodic shifts in the parameters that describe the system’s dynamics and volatility
● Examples include:○ dynamics and volatility differ between recessions and expansions
○ predictability and volatility in asset returns vary across subsamples
○ money demand functions are notoriously unstable and heteroskedastic
52
Regime Switching Models
● State-space models in which switching between regimes occurs stochastically according to a Markov process
● BusinessDictionary.com○ “Process whose future behavior cannot be accurately predicted
from its past behavior (except the current or present behavior) and which involves random chance or probability”■ e.g. behavior of a business or economy, flow of traffic, progress of
an epidemic
○ “Named after the inventor of Markov analysis, the Russian mathematician Andrei Andreevich Markov (1856-1922)” 53
Markov Regime Switching Models
Hamilton (1989)● a two-state Markov switching model ● the mean growth rate of GNP is subject to regime
switching● errors follow a regime-invariant AR(4) process➢ Generalisation of the simple dummy variables approach
➢ Allows regimes (called states) to occur several periods over time
➢ In each period t (the state) is denoted by st
➢ There can be m possible states: st = 1,... , m54
Markov Regime Switching Models (cont.)
Garcia and Perron (1996)● Time series behavior of the U.S. real interest rate from 1961
to 1986
● Three possible regimes affecting both the mean and variance
● States: high - middle - low
● Probabilities of being in the different states at each point of the sample
55
Markov Regime Switching Models (cont.)
56
Garcia and Perron (1996) - cont.Ex-post Real Interest Rate Inflation Rate
Low
Middle
High
Markov Regime Switching Models (cont.)● Let yt denote the GDP growth rate● Simple model with m = 2 (only 2 regimes)
yt = μ1 + et when St = 1yt = μ2 + et when St = 2
e t i.i.d. N(0, σ2)● Notation using dummy variables:
yt = μ1 D1t + μ2 (1-D1t) + et where D1t = 1 when St = 1, = 0 when St = 2
57
Markov Regime Switching Models (cont.)
How does st evolve over time?
Model: Markov switching :P[St | S1, S2, ..., St-1] = P[St | St-1]
Probability of moving from state i to state j:pij = P[St= j| St-1= i]
58
Markov Regime Switching Models (cont.)
● Unconditional probabilities:○ Prob[St = 1] = (1-p22 )/(2 - p11 - p22 )○ Prob[St = 2] = 1 - Prob[St = 1]
● Examples: If p11 = 0.9 and p22 = 0.7 then Prob[st = 1] = 0.75
If p11 = 0.9 and p22 = 0.9 then Prob[st = 1] = 0.5
59
Markov Regime Switching Models (cont.)
Example with only 2 possible states: m = 2Switching (or conditional) probabilities:● Prob[St = 1 | St-1 = 1] = p11● Prob[St = 2 | St-1 = 1] = 1 - p11● Prob[St = 2 | St-1 = 2] = p22● Prob[St = 1 | St-1 = 2] = 1 – p22
Expected Duration: 1/(1-pjj)● Expected duration of state j, for j = 1, 2 60
Markov Regime Switching Models (cont.)
Estimation● Maximize Log-Likelihood● Hamilton filter - Filtered probabilities:
π 1, t = Prob[St = 1 | y1, y2, …, yt ]π 2 , t = Prob[St = 2 | y1, y2, …, yt ] = 1- π 1 ,t
for t=1, …, T
61
Yilmazkuday and Akay (2008)● Analysis of the business cycles of the Turkish economy over
the period 1987–2002
● Three-state univariate Markov switching
● Decomposition of the non-recessionary state into two sub-states: high-growth and low-growth states
● Aim: generate regime probabilities from the real GDP data and make comparisons about the sequence of these states
62
Empirical Application
: unobserved MS variable such that
● Sjt = 1 if Sjt= j, and Sjt = 0 otherwise, for j = 0, 1, 2
63
Empirical ApplicationYilmazkuday and Akay (2008) - cont.
yt: percentage change in output
State-dependent Mean State-dependent Variance
St evolves according to the transition probabilities:
64
Empirical ApplicationYilmazkuday and Akay (2008) - cont.
65
Recession period: -0.88%Low growth regime: 0.65%High growth regime: 3.09%
Q/Q
Empirical ApplicationYilmazkuday and Akay (2008) - cont.
66
Empirical ApplicationYilmazkuday and Akay (2008) - cont.
Filtered probability of a recession
67
Empirical ApplicationYilmazkuday and Akay (2008) - cont.
Filtered probabilities of regimes with high-growth and low-growth
High growth regimeLow growth regimeHigh- and low-growth regimes do not move in a parallel fashion but follow each other!
Justification of the 3-state model
68
Empirical ApplicationYilmazkuday and Akay (2008) - cont.
Expected Durations of the States
0.803251
0.152326
0.156481 = 1 - 0.000165 - 0.843354 (Slides 17-18)
quarters
Expected durations vs. slide #20!
Comparison of AR(2) and Markov-switching AR(2)
69
Empirical ApplicationYilmazkuday and Akay (2008) - cont.
Applications with EViewsEstimation of the MS Models
Choose Switching Regression as the method of estimation.
70
Applications with EViewsEstimation of the MS Models (cont.)
The equation specification consists of a two-state Markov switching model ● with a single switching mean regressor C ● and the four non-switching AR terms.
71
Applications with EViewsEstimation of the MS Models (cont.)
● The error variance: assumed to be common across the regimes. ● The only probability regressor is the constant C since we have time-
invariant regime transition probabilities.
72
Applications with EViewsEstimation of the MS Models (cont.)
The top portion of the output ● describes the estimation settings
73
MS Models Estimation OutputThe middle section ● displays the coefficients for the regime specific mean
and the invariant error distribution coefficient
74
MS Models Estimation Output (cont.)The remaining results ● show the parameters of the transition matrix and
summary statistics for the estimated equation
75
MS Models Estimation Output (cont.)Transition matrix probabilities: View/Regime Results/Transition Results... OK
Default summary view:
76
MS Models Estimation Output (cont.)To display the filtered and full sample (smoothed) estimates of the probabilities of being in the two regimes.
● First select View/Regime Results/Regime Probabilities, and choose the filtered results.
● Results for the second regime
● Then repeat the procedure choosing the smoothed results.
EViews Tutorials77
References● EViews 8.1 User Guideline (http://www.eviews.
com/EViews8/ev8ecswitch_n.html#MarkovAR) ● Garcia, R., & Perron, P. (1996). An analysis of the real interest rate under
regime shifts. The Review of Economics and Statistics, 111-125.● Hamilton, J. D. (1989). A new approach to the economic analysis of
nonstationary time series and the business cycle. Econometrica: Journal of the Econometric Society, 357-384.
● Kim, C. J., & Nelson, C. R. (1999). State-space models with regime switching: classical and Gibbs-sampling approaches with applications (Vol. 2). Cambridge: MIT press.
● Yilmazkuday, H., & Akay, K. (2008). An analysis of regime shifts in the Turkish economy. Economic Modelling, 25(5), 885-898.
78