*
* Enders, Applied Econometric Time Series, 3rd edition
* Example from pp 169-171
* Multivariate GARCH
*
open data exratesdaily.xls
calendar(d) 2000:1:3
data(format=xls,org=columns) 2000:01:03 2013:04:26 euro pound sw
*
* Replace missing values in the exchange rates by the last observed value.
*
set euro = %if(%valid(euro),euro,euro{1})
set pound = %if(%valid(pound),pound,pound{1})
set sw = %if(%valid(sw),sw,sw{1})
*
* Flip the order on the Swiss Franc
*
set sw = 1/sw
*
* We generally recommend that the returns be multiplied up by 100, which
* changes the scales on the variances by 10000. This puts the
* coefficients in the GARCH within a few orders of magnitude of 1, which
* makes them easier to read. It also makes it easier to estimate the
* model. Note that this doesn't affect the lagged variance or lagged
* squared residual terms in the GARCH specification; just the means
* (which will be higher by x 100) and the constants in the GARCH, which
* will be higher by x 10000.
*
set reuro = 100.0*log(euro/euro{1})
set rpound = 100.0*log(pound/pound{1})
set rsw = 100.0*log(sw/sw{1})
*
spgraph
graph(footer="Figure 3.5: Daily Exchange Rates (Jan 3, 2000 - April 4, 2013)", $
vlabel="currency per dollar",key=attached,klabels=||"Pound","Euro","Swiss Franc"||) 3
# euro / 1
# pound / 2
# sw / 12
spgraph(done)
*
dofor r = reuro rpound rsw
linreg r
# constant
@archtest(lags=5) %resids
@regcorrs(number=6,report,qstats,title="Residuals for "+%l(r))
end dofor r
*
* CC model
*
garch(p=1,q=1,mv=cc) / reuro rpound rsw
*
* diagonal VECH model
*
garch(p=1,q=1,pmethod=simplex,piters=10,hmatrices=hhs) / reuro rpound rsw
set rho23 = hhs(t)(2,3)/sqrt(hhs(t)(2,2)*hhs(t)(3,3))
graph(footer="Figure 3.16 Pound/Franc Correlation from Diagonal vech")
# rho23