ARCHTEST - Test for ARCH/GARCH effects

Use this forum to post complete RATS "procedures". Please be sure to include instructions on using the procedure and detailed references where applicable.

ARCHTEST - Test for ARCH/GARCH effects

Postby TomDoan » Sun Jul 15, 2012 5:49 pm

The attached procedure does the Engle test for ARCH effects by regressing the square of a series on its lags and testing the significance of the lags. The null is that the series is mean zero, not serially correlated and has constant variance. This can be used to test the original series for ARCH (or GARCH) by applying it to residuals from a preliminary LINREG (to satisfy the requirement that the series be mean zero and not serially correlated)---this is done in the example below. It can also be used as a diagnostic by applying it to the standardized residuals from GARCH estimation. Note that you apply the procedure to the residuals, not to their squares. (The procedure handles the squaring).

A multivariate version is available with @MVARCHTEST (http://www.estima.com/forum/viewtopic.php?f=7&t=928).

archtest.src
Procedure files (requires RATS 7.3 or later)
(2.97 KiB) Downloaded 105 times


@ARCHTEST series start end

Options

LAGS=(maximum) number of lags [4]

SPAN=spacing between number of lags in a test sequence.
SPAN=1 will give a table of tests for all lags from 1 to the LAG option. The default is to test only the value of the LAGS option.

DFC=degrees of freedom correction for tests.
By default, 0. If <<series>> are residuals from an ARCH or GARCH, DFC should be the number of ARCH/GARCH parameters.

FORM=[F]/LM
Determines whether F-test or Lagrange multiplier form is used

[PRINT]/NOPRINT
TITLE=Title for output ["Test for ARCH in Series xxxx"]

Variables Defined

%CDSTAT F-statistic for test with LAG option lags
%SIGNIF Significance level of %CDSTAT

Example

Code: Select all
*
* Hill, Griffiths, & Lim, Principles of Econometrics, 3rd edition
* ARCH-GARCH examples starting page 369
*
open data byd.dat
data(format=free,org=columns) 1 500 r
*
linreg r
# constant
*
set e = %resids
*
* LM regression for ARCH test
*
set esq = e^2
linreg esq
# constant esq{1}
*
* This is slightly different from the result in the text as it uses the
* full precision of the R-squared.
*
cdf(title="ARCH test") chisqr %trsquared 1
*
* The ARCHTEST procedure can handle the entire test given the residuals.
* The FORM=LM asks for the form given in the text, rather than an F test.
*
@archtest(lags=1,form=lm) e
*
* Estimating an ARCH model. This is done using the GARCH instruction.
* The number of lagged squared residual terms is given by the Q option.
* Because the instruction can be used for several series at once, you
* put the estimation range first (here, just the / for the full range),
* followed by the series.
*
* One thing to note is that the estimated parameters and (particularly)
* the standard errors can be somewhat different. All of these models are
* estimated using iterative methods and different software use different
* algorithms to find the "best" set of parameters. While the parameter
* values are generally quite close, the standard errors are often quite
* different. Choice of algorithm has more of an effect on the latter
* than the former.
*
garch(q=1) / r
*
* Estimating the GARCH model. The number of lagged variance terms is
* indicating with the P option.
*
garch(p=1,q=1,hseries=hgarch) / r
*
* Estimating the model with asymmetry
*
garch(p=1,q=1,asymm,hseries=htgarch) / r
*
* Estimating the model with asymmetry and "M" effects. %garchv is a
* series used internally by GARCH to represent the variance. The
* REG(ressors) option indicates that the mean model takes the form of a
* regression, rather than just a simple mean.
*
garch(p=1,q=1,reg,asymmetric,hseries=htgarchm) / r
# constant %garchv
*
* The TABLE instruction can be used to determine the maximum value taken
* by the three variance series. Graphing all of them on a common scale
* is a good idea.
*
table(noprint) / hgarch htgarch htgarchm
spgraph(vfields=3,footer="Figure 14.7 Estimated variances of ARCH models")
graph(hlabel="(a) GARCH(1,1)",max=%maximum)
# hgarch
graph(hlabel="(b) T-GARCH(1,1)",max=%maximum)
# htgarch
graph(hlabel="(c) GARCH-in-mean",max=%maximum)
# htgarchm
spgraph(done)
Attachments
byd.dat
Data file for example
(6.35 KiB) Downloaded 71 times
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Return to RATS Procedures

Who is online

Users browsing this forum: No registered users and 2 guests