Time‐Varying Volatility and ARCH Models

Time‐Varying Volatility and ARCH Models ARCH MODEL AND TIME-VARYING VOLATILITY
In this lesson we'll use Stata to estimate several models in which the variance of the dependent
variable changes over time. These are broadly referred to as ARCH (autoregressive conditional
heteroskedasticity) models and there are many variations upon the theme. Again, this is all
covered in POE4.
The first thing to do is illustrate the problem graphically using data on stock returns. The data
are stored in the Stata dataset returns.dta.
use returns, clear
The data contain four monthly stock price indices: U.S. Nasdaq (nasdaq), the Australian All
Ordinaries (allords), the Japanese Nikkei (nikkei) and the U.K. FTSE (ftse). The data are
recorded monthly beginning in 1988m1 and ending in 2009m7.
gen date = m(1988m1) + _n - 1
format date %tm
tsset date
Plots of the series in their levels are generated using twoway(tsline varname).
qui tsline nasdaq, name(nas, replace)
qui tsline allords, name(a, replace)
qui tsline ftse, name(f, replace)
qui tsline nikkei, name(nk, replace)
graph combine nas a f nk, cols(2) name(all1, replace)
1990m1 1995m1 2000m1 2005m1 2010m1
date
NIkkei Stock Index (Japan)
-30 -20 -10 0
10 20
All Ordinaries Stock Index (Australia)
-20
-10
0
10
NASDAQ stock Index (USA)
-30 -20 -10 0
10 20
-20
FTSE Stock Index (UK)
-10
0
10
20
1990m1 1995m1 2000m1 2005m1 2010m1
date
1990m1 1995m1 2000m1 2005m1 2010m1
date
1990m1 1995m1 2000m1 2005m1 2010m1
date
The series are characterized by random, rapid changes and are said to be volatile. The volatility
seems to change over time as well. For instance U.S. stock returns (nasdaq) experiences a
relatively sedate period from 1992 to 1996. Then, stock returns become much more volatile until
early 2004. Volatility increases again at the end of the sample. The other series exhibit similar
periods of relative calm followed by increased volatility.
Next, the histogram command is used to generate graphs of the empirical distribution of
returns. A curve from a normal distribution is overlaid using the normal option.
qui histogram
qui histogram
qui histogram
qui histogram
graph combine
nasdaq, normal name(nas, replace)
allords, normal name(a, replace)
ftse, normal name(f, replace)
nikkei, normal name(nk, replace)
nas a f nk, cols(2) name(all2, replace)
0
0
.02
.02
Density
.04
.06
Density
.04 .06 .08
.1
.08
Time-Varying Volatility and ARCH Models
-20
-10
0
10
NASDAQ stock Index (USA)
20
-20
-10
0
10
FTSE Stock Index (UK)
20
-20
-10
0
10
All Ordinaries Stock Index (Australia)
0
0
.02
Density
.05
Density
.04
.06
.1
.08
-30
-30
-20
-10
0
10
NIkkei Stock Index (Japan)
20
These series are leptokurtic. That means they have lots of observations around the average and a
relatively large number of observations that are far from average; the center of the histogram has
a high peak and the tails are relatively heavy compared to the normal.
TESTING, ESTIMATING, AND FORECASTING
The basic ARCH models consist of two equations. The mean equation describes the behavior of
the mean of your time series; it is a linear regression function that contains a constant and
possibly some explanatory variables. In the cases considered below, the mean function contains
only an intercept.
yt    et
In this case we expect the time series to vary randomly about its mean, If the mean of your
time series drifts over time or is explained by other variables, you'd add them to this equation just
as you would in the usual regression model. The error of the regression is normally distributed
and heteroskedastic. The variance of the current period's error depends on information that is
revealed in the preceding period. The variance of et is given the symbol ht. The variance
equation describes how the error variance behaves.
ht    1et21
Notice that ht depends on the squared error in the preceding time period. The parameters in this
equation have to be positive to ensure that the variance, ht, is positive.
A Lagrange Multiplier (LM) test can be used to test for the presence of ARCH effects (i.e.,
whether ). To perform this test, first estimate the mean equation. Save and square the
estimated residuals, eˆt2 . You will use these in an auxiliary regression from which you’ll use the
sample size and goodness-of-fit measure to compute a test statistic. For first order ARCH, regress
eˆt2 on the lagged residuals eˆt21 and a constant:
eˆt2   0  1eˆt21  vt
where vt is a random term. The null and alternative hypotheses are:
H 0 : 1  0
H 1 : 1  0
The test statistic is TR2, where T is the number of observations in the auxiliary regression. It has a
 distribution is the null hypothesis is true. Compare the p-value from this statistic to the
desired test level () and reject the null if the p-value is smaller. If you suspect a higher order
ARCH(q) error variance process, then include q lags of eˆt2 as regressors, compute TR2, and use
the q distribution to obtain the p-value.
In the first ARCH example the byd.dta data are used. Load the data using the clear option to
remove any previous data from Stata’s memory.
use byd, clear
This dataset contains a single undated time series. Generate a time variable in the easiest way
possible and declare the data to be time series.
gen time = _n
tsset time
In this instance, a time counter equal to the observation number is created using _n and this is set
equal to the variable time. Then the tsset command is used to declare it a time series.
The first thing to do is plot the time series using
tsline r, name(g1, replace)
This yields
returns to shares in BrightenYourDay (BYD) Lighting
-2
0
2
4
6
8
Time-Varying Volatility and ARCH Models
0
100
200
300
400
500
time
There is visual evidence of time varying volatility. Towards the end of the time series, returns for
BYD appear to become more volatile. An ARCH(1) model is proposed and the ARCH(1) model
is tested against the null hypothesis of no ARCH using the LM test discussed above. The first
step is to estimate a regression that contains only an intercept. Obtain the residuals, which we call
ehat, and square them.
regress r
predict ehat, residual
gen ehat2 = ehat * ehat
The auxiliary regression eˆt2   0  1eˆt21  vt uses the lag operator . to take a single lag to include as
a regressor in the auxiliary model.
regress ehat2 L.ehat2
The test statistic is TR2 from this regression. The p-value is computed using the chi2tail
function. Remember, the first argument of chi2tail is the degrees of freedom for your test
(equal to q) and the second argument is the computed value of your statistic. Reject no arch if the
p-value is less than the desired significance level, . The Stata code is:
scalar TR2 = e(N)*e(r2)
scalar pvalue = chi2tail(1,TR2)
scalar crit = invchi2tail(1,.05)
scalar list TR2 pvalue crit
This yields the result:
. scalar list
TR2 =
pvalue =
crit =
TR2 pvalue crit
62.159504
3.167e-15
3.8414588
Stata also includes a built-in function to compute this test statistic. Using it will provide identical
results. First estimate the regression then use the post-estimation command archlm as shown
below:
regress r
. regress r
Source
SS
df
MS
Model
Residual
0
700.737278
0
499
.
1.40428312
Total
700.737278
499
1.40428312
r
Coef.
_cons
1.078294
Std. Err.
.0529959
t
20.35
Number of obs
F( 0,
499)
Prob > F
R-squared
Adj R-squared
Root MSE
=
=
=
=
=
=
500
0.00
.
0.0000
0.0000
1.185
P>|t|
[95% Conf. Interval]
0.000
.9741716
1.182417
Then use the post-estimation command archlm as shown below.
estat archlm, lags(1)
As we know, post-estimation commands begin with estat, after which the archlm command is
issued. The archlm command uses the lags(q) option, where q is the order of the ARCH process
you wish to include in the alternative hypothesis. In this example q=1.
The results from the archlm command are:
. estat archlm, lags(1)
LM test for autoregressive conditional heteroskedasticity (ARCH)
lags(p)
chi2
df
Prob > chi2
1
62.160
1
0.0000
H0: no ARCH effects
vs.
H1: ARCH(p) disturbance
This is a particularly useful alternative to the manual process of computing TR2 from an auxiliary
regression. The null and alternative hypotheses are clearly stated, the statistic and its distribution
are given, and the p-value is computed and shown in the default output. That means that Stata is
generating all the information you need to properly conduct the test. Excellent!
The archlm test can be accessed through the dialogs, but the process is fairly convoluted. Just
in case you haven’t weaned yourself from using the pull-down menus yet here is how. First you
need to estimate the mean equation using regression. Select Statistics > Linear models and
related > Linear regression. Choose r as the dependent variable (with no independent
Time-Varying Volatility and ARCH Models
variables) and click OK. Then, choose Statistics > Time series > Tests < Time-series tests after
regress.
This reveals the estat dialog box that we’ve seen before.
In this case, scroll down to the option Test for ARCH effects in the residuals (archlm – time
series only) and then specify the number of lags to be tested (1 as shown). Click OK.
In this example, the no ARCH effects hypothesis is rejected at the 5% level and we proceed to
estimation of the model.
The basic ARCH model and all the variants considered below are estimated using the arch
command. The syntax is shown below:
arch depvar [indepvars] [if] [in] [weight] [, options]
After issuing the arch command, list the dependent variable, independent variables (if you have
any), and any conditionals or weights you may wish to use. Then, list the desired options. These
options are what make Stata’s arch command very flexible and powerful.
For the ARCH(1) model of BYD, the option to use is simply arch(1). The complete
command syntax for an ARCH(1) model of BYD’s returns is
arch r, arch(1)
which produces this output:
In the Stata output (but not shown) is a list of iterations; this gives a clue as to how this magic is
actually being performed. Iterations indicate that a nonlinear numerical optimization is being
done behind the scenes, in this case to maximize the likelihood function. The log likelihood
should be getting larger as the iterations proceed. If the numerical optimization somehow fails, an
error message will appear just after the (many) iterations.
The parameter estimates follow the iteration summary. In this case they match those in POE,
but the standard errors are a little different. Don’t worry about this, they are valid if the ARCH(1)
model is appropriate. So, in the BYD example, the average return is about 1.06%. The ARCH
term’s t-ratio is statistically significant and you conclude that the variance is autoregressive
conditionally heteroskedastic (which for good measure should be repeated out loud three times).
To arrive at these results through the dialogs choose Statistics > Time series >
ARCH/GARCH > ARCH and GARCH models from the pull-down menu. This reveals the
arch – Autoregressive conditional heteroskedasticity family of estimators dialog box shown
below:
Time-Varying Volatility and ARCH Models
In this box choose r as the dependent variable and select a single lag in the ARCH maximum lag
box. Click OK and you are done. Note, you can choose longer maximum ARCH lags (i.e., q) or
even specify a list of lags in this dialog. The dialog is also used to estimate a generalization of
ARCH that is considered in the next section. Before moving on though, let’s graph the estimated
future return rt 1 and the conditional volatility ht 1 .
The forecasted return is just a constant in this case, since no explanatory variables other than
a constant was included in the regression portion of the ARCH model
rˆt 1  ˆ 0  1.063
The forecasted error variance is essentially an in-sample prediction model based on the estimated
variance function.

hˆt 1  ˆ 0  ˆ 1 rt  ˆ 0

2
 0.642  0.569  rt  1.063
2
Stata generates this whenever it estimates an ARCH model and saves the result to a variable using
the predict command with option variance. Here the ARCH(1) model is estimated and the
variance is saved as a variable called htarch.
arch r, arch(1)
predict htarch, variance
This could be generated manually using saved results from the estimated ARCH model
gen ht_1 = _b[ARCH:_cons]+_b[ARCH:L1.arch]*(L.r-_b[r:_cons])^2
list htarch ht_1 in 496/500
which produces:
. list htarch ht_1 in 496/500
496.
497.
498.
499.
500.
htarch1
ht_1
1.412281
.8093833
1.968768
1.614941
2.122526
1.412281
.8093833
1.968768
1.614941
2.122526
The built-in computation from Stata’s predict command is confirmed by our manual calculation.
Then tsline is used to plot the forecast error variance against time.
tsline htarch, name(g2, replace)
0
Conditional variance, one-step
5
10
15
20
This produces the time series plot
0
100
200
300
time
Obviously, there is a lot more volatility towards the end of the sample.
400
500
Time-Varying Volatility and ARCH Models
EXTENTIONS
An important extension of the ARCH(1) is the ARCH(q) model. Here, additional lags of the
squared residuals are added as determinants of the equation’s variance, ht:
ht   0  1et21   2 et2 2 ...   q et2 q
GARCH
Another extension is the Generalized ARCH or GARCH model. The GARCH model adds lags
of the variance, ht-p, to the standard ARCH. A GARCH(1,1) model would look like this:
ht    1et21  1ht 1
It has one lag of the regression model’s residual (1 ARCH term) and one lag of the variance itself
(1 GARCH term). Additional ARCH or GARCH terms can be added to obtain the GARCH(p,q),
where p is the number of lags for ht and q is the number of lags of et included in the model.
Estimating a GARCH(1,1) model for BYD is simple. Basically, you just add a single
GARCH term to the existing ARCH model, so the command is
arch r, arch(1) garch(1)
The syntax is interpreted this way. We have an arch regression model that includes r as a
dependent variable and has no independent variables other than a constant. The first option
arch(1) tells Stata to add a single lagged value of et to the modeled variance; the second option
garch(1) tells Stata to add a single lag of the variance, ht, to the modeled variance. The result is:
Iteration 7:
log likelihood = -736.02814
ARCH family regression
Sample: 1 - 500
Distribution: Gaussian
Log likelihood = -736.0281
Number of obs
Wald chi2(.)
Prob > chi2
OPG
Std. Err.
r
Coef.
_cons
1.049856
.0404623
arch
L1.
.4911796
garch
L1.
_cons
z
=
=
=
500
.
.
P>|z|
[95% Conf. Interval]
25.95
0.000
.9705517
1.129161
.1015995
4.83
0.000
.2920482
.6903109
.2379837
.1114836
2.13
0.033
.0194799
.4564875
.4009868
.0899182
4.46
0.000
.2247505
.5772232
r
ARCH
The estimate of  is 0.491 and the estimated coefficient on the lagged variance, is 0.238.
Again, there are a few minor differences between these results and those in the text, but that is to
be expected when coefficient estimates have to be solved for via numerical methods rather than
analytical ones.
As in the ARCH model, the predicted forecast variance can be saved and plotted:
predict htgarch, variance
tsline htgarch
0
Conditional variance, one-step
5
10
15
20
which yields the time series plot:
0
100
200
300
400
500
time
Threshold GARCH
The threshold GARCH model, or T-GARCH, is another generalization of the GARCH model
where positive and negative news are treated asymmetrically. In the T-GARCH version of the
model, the specification of the conditional variance is:
ht    1et21  d t 1et21  1ht 1
1 et  0 (bad news)
dt  
0 et  0 (good news)
Time-Varying Volatility and ARCH Models
In Stata this just means that another option is added to the arch r regression model. The option to
add asymmetry of this sort is acw() where the argument tells Stata how many lagged asymmetry
terms to add. This can be less than the number of ARCH terms, q, but not greater.
Here is a T-GARCH model for BYD.
arch r, arch(1) garch(1) tarch(1)
predict httgarch, variance
tsline httgarch
Once again, the variance is saved and plotted using a time series plot. The Threshold GARCH
result is:
Iteration 7:
log likelihood = -730.55397
ARCH family regression
Sample: 1 - 500
Distribution: Gaussian
Log likelihood = -730.554
Number of obs
Wald chi2(.)
Prob > chi2
OPG
Std. Err.
r
Coef.
_cons
.9948399
.0429174
arch
L1.
.754298
tarch
L1.
z
=
=
=
500
.
.
P>|z|
[95% Conf. Interval]
23.18
0.000
.9107234
1.078956
.2003852
3.76
0.000
.3615501
1.147046
-.4917071
.2045045
-2.40
0.016
-.8925285
-.0908856
garch
L1.
.2873
.1154888
2.49
0.013
.0609462
.5136538
_cons
.3557296
.0900538
3.95
0.000
.1792274
.5322318
r
ARCH
and the plotted predicted error variances are:
15
Conditional variance, one-step
5
10
0
0
100
200
300
400
500
time
GARCH-in-mean
A final variation of the ARCH model is called GARCH-in-mean (MGARCH). In this model,
the variance, ht, is added to the regression function.
yt  0  ht  et
If its parameter, , is positive then higher variances will cause the average return E(y) to increase.
This seems reasonable: more risk, higher average reward! To add a GARCH-in-mean to the BYD
example, we simply add another option to the growing list in the arch statement. The command
becomes:
arch r, archm arch(1) garch(1) tarch(1)
In this case, the option archm (which stands for arch in mean) is added to the others, arch(1)
garch(1) and tarch(1). These are retained since these terms are included in the BYD example
from the text. The results are
Time-Varying Volatility and ARCH Models
Iteration 7:
log likelihood = -724.65492
ARCH family regression
Sample: 1 - 500
Distribution: Gaussian
Log likelihood = -724.6549
Number of obs
Wald chi2(1)
Prob > chi2
OPG
Std. Err.
r
Coef.
_cons
.8181453
.0711579
sigma2
.1958843
arch
L1.
z
=
=
=
500
8.51
0.0035
P>|z|
[95% Conf. Interval]
11.50
0.000
.6786783
.9576122
.067164
2.92
0.004
.0642453
.3275233
.6160302
.1634603
3.77
0.000
.2956538
.9364066
tarch
L1.
-.321069
.1621927
-1.98
0.048
-.6389608
-.0031772
garch
L1.
.2783425
.1039073
2.68
0.007
.074688
.481997
_cons
.3705214
.0818646
4.53
0.000
.2100698
.5309731
r
ARCHM
ARCH
You can see that the coefficient on the GARCH-in-mean term ˆ  .1959, is positive and
statistically significant at the 5% level in this instance.
Finally, the predicted mean and variance functions are saved and plotted using time series
plots.
predict m_mgarch, xb
predict htmgarch, variance
qui tsline m_mgarch, name(g5, replace)
qui tsline htmgarch, name(g6, replace)
graph combine g5 g6, cols(1)
In this case, the mean and variance are plotted in the same graph in a single column:
xb prediction, one-step
2
3
4
1
0
100
200
300
400
500
300
400
500
Conditional variance, one-step
0
5
10
15
20
time
0
100
200
time
The predictions of the mean and variance follow very similar patterns.