Dear,
I need to estimate a VAR-GARCH-M (BEKK) using nonparametric or semiparametric methods. Where can I find RATS codes for it.
Vinícius dos Santos Cerqueira
all 133
open data dados(ipa2).xls
data(format=xls,org=columns) / juros cambio
compute n=2
compute gstart=4,gend=133
*
dec series[vect] yv
dec frml[vect] residv
dec vect[series] u(n)
*
* The paths of the covariance matrices and uu' are saved in the
* SERIES[SYMM] named H and UU. UX and HX are used for the current values
* of the residual vector and H matrices
*
declare series[symm] h uu
*
* ux is used when extracting a u vector
*
declare symm hx(n,n)
declare vect ux(n)
*
* These will be the parameters for the mean equations. These are adjusted to add
* variance or covariance terms as needed.
*
dec vect b(n)
dec rect ar(n,n) ars(n,n) gm(n,n)
nonlin(parmset=meanparms) ar ars gm
*
* Mean model = VARMA(1,1) with sqrt(h) "M" term
*
frml residv = yv-ar*yv{1}-ars*yv{2}-gm*%sqrt(%xdiag(h))
*
gset yv = ||juros,cambio||
*
* Run preliminary VAR(1) to get estimates of residuals
*
linreg juros / u(1)
# constant cambio{1 to 2} juros{1 to 2}
linreg cambio / u(2)
# constant cambio{1 to 2} juros{1 to 2}
vcv(matrix=rr,noprint)
# u
*
* These are used to initialize pre-sample variances.
*
gset h * gend = rr
gset uu * gend = rr
set u(1) = 0.0
set u(2) = 0.0
*
declare frml[symm] hf
*
frml logl = $
hx = hf(t) , $
h(t) = hx, $
ux = residv , $
uu(t) = %outerxx(ux), $
%pt(u,t,ux),$
%logdensity(hx,ux)
*
* This does a simple GARCH(1,1) model for the variance.
*
NLPAR(SUBITERS=10)
dec symm vcs(n,n) vas(n,n) vbs(n,n)
compute vcs=rr,vbs=%const(0.50),vas=%const(0.05)
nonlin(parmset=garchparms) vcs vas vbs
frml hf = vcs+vbs.*h{1}+vas.*uu{1}
maximize(trace,parmset=meanparms+garchparms,pmethod=simplex,piters=10,method=bfgs,iters=400) logl gstart gend
*
* This does a BEKK model for the variance
*
dec rect vab(n,n) vbb(n,n)
compute vab=.05*%identity(n),vbb=.50*%identity(n)
nonlin(parmset=garchparms) vcs vab vbb
compute vcs=%decomp(rr)
frml hf = vcs*tr(vcs)+vbb*h{1}*tr(vbb)+vab*uu{1}*tr(vab)
maximize(trace,parmset=meanparms+garchparms,pmethod=simplex,piters=10,method=bfgs,robustererros,iters=400) logl gstart gend
Return to ARCH and GARCH Models
Users browsing this forum: No registered users and 2 guests