a error occur when estimating VECM-GARCH

Discussions of ARCH, GARCH, and related models
huanpipt
Posts: 26
Joined: Sun Mar 27, 2011 7:52 am

a error occur when estimating VECM-GARCH

Unread post by huanpipt »

This is my code for VECM-GARCH

Code: Select all

@johmle(lags=6,cv=cvector,det=rc)
# lsp lf1m
equation(coeffs=cvector) ecteq  *
# LSP{1} Lf1m{1} constant


SYSTEM(MODEL=VAR)
VARIABLES DLSP DLF1M
DET Constant DLSP{1} DLF1M{1}
ect ecteq
END(SYSTEM)
ESTIMATE

garch(model=var,mv=bekk,iters=500,robusterrors) / dLSP dLF1M
When I run this code, there is the error message.
"## I2. Expected Instruction Here
>>>><<<< "
Can anyone help me?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: a error occur when estimating VECM-GARCH

Unread post by TomDoan »

You have a line of



where I assume you want ********. Note that there is a "Show Last Error" at the bottom of the Edit menu, which will take you to the instruction or line which created the syntax error.
huanpipt
Posts: 26
Joined: Sun Mar 27, 2011 7:52 am

Re: a error occur when estimating VECM-GARCH

Unread post by huanpipt »

Thanks, Tom.

I want to change the model into VECM-GARCH-M.

I try to revise the VAR-GARCH-M code.

But there are EC(1,2) and EC(2,2) in the the model.

I think this code might be wrong perhaps.

could you help me revising it.

Code: Select all


******************************************************************************
***********************************VAR-GARCH-M Model**************************

******************************************************************************
@varlagselect(crits=SBC,lags=30)
#dLsp dLf1m

compute n=2
compute gstart=1,gend=1555
*
dec series[vect] Y
dec frml[vect] R
dec vect[series] U(n)
dec series[vect] ECT

*
*
* 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] G uu
*
* ux is used when extracting a u vector
*
declare symm Gx(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 A(n)
dec rect B1(n,n) B2(n,n) B3(n,n) B4(n,n) B5(n,n) C(n,n) EC(n,n)

nonlin(parmset=meanparms) A B1 B2 B3 B4 B5 C EC
*
* Mean model = VAR(1) with sqrt(G) "M" term
*
frml R = Y-A-B1*Y{1}-B2*Y{2}-B3*Y{3}-B4*Y{4}-B5*Y{5}-C*%sqrt(%xdiag(G))-EC*ECT{1}
*
gset Y = ||dLSP,dLF1M||
******ECT term*****
linreg LSP / ECTEQ
# LF1M
gset ECT = ||ECTEQ,0||

*
* Run preliminary VAR(4) to get estimates of residuals
*
*


linreg dLSP / u(1)
# constant dLSP{1 to 5} dLF1M{1 to 5}
linreg dLF1M / u(2)
# constant dLSP{1 to 5} dLF1M{1 to 5}
*
linreg dLSP
# constant dLSP{1 to 5} DLF1M{1 to 5} u(1) u(2) ecteq{1}
compute A(1)=%beta(1),B1(1,1)=%beta(2),B2(1,1)=%beta(3),$
                      B3(1,1)=%beta(4),B4(1,1)=%beta(5),$
                      B5(1,1)=%beta(6),B1(1,2)=%beta(7),$
                      B2(1,2)=%beta(8),B3(1,2)=%beta(9),$
                      B4(1,2)=%beta(10),B5(1,2)=%beta(11),$
                      C(1,1)=%beta(12),C(1,2)=%beta(13),EC(1,1)=%beta(14),EC(1,2)=0
linreg dLF1M
# constant dLSP{1 to 5} dLF1M{1 to 5} u(1) u(2) ecteq{1}
compute A(2)=%beta(1),B1(2,1)=%beta(2),B2(2,1)=%beta(3),$
                      B3(2,1)=%beta(4),B4(2,1)=%beta(5),$
                      B5(2,1)=%beta(6),B1(2,2)=%beta(7),$
                      B2(2,2)=%beta(8),B3(2,2)=%beta(9),$
                      B4(2,2)=%beta(10),B5(2,2)=%beta(11),$
                      C(2,1)=%beta(12),C(2,2)=%beta(13),EC(2,1)=%beta(14),EC(2,2)=0




vcv(matrix=WWW)
# u

*
* These are used to initialize pre-sample variances.
*
gset G  * gend = WWW
gset uu * gend = WWW
set u(1) = 0.0
set u(2) = 0.0
*
declare frml[symm] Gf
*
frml logl = $
    Gx    = Gf(t) , $
    G(t)  = Gx, $
    ux    = R , $
    uu(t) = %outerxx(ux), $
    %pt(u,t,ux),$
    %logdensity(Gx,ux)

*
* This does a simple GARCH(1,1) model for the variance.
*
dec symm VA(n,n) VB1(n,n) VC1(n,n)

compute VA=WWW,VB1=%const(0.50),VC1=%const(0.05)
nonlin(parmset=garchparms) VA VB1 VC1
frml Gf = VA+VC1.*G{1}+VB1.*uu{1}

maximize(trace,parmset=meanparms+garchparms,pmethod=SIMPLEX,piters=10,method=bhhh,iters=400) logl gstart+6 gend
*
* This does a BEKK model for the variance
*
dec rect VBB1(n,n) VCC1(n,n)
compute VBB1=.05*%identity(n),VCC1=.50*%identity(n)
compute VA=%decomp(WWW)
nonlin(parmset=garchparms) VA VBB1 VCC1
frml Gf = VA*tr(VA)+VCC1*G{1}*tr(VCC1)+VBB1*uu{1}*tr(VBB1)
maximize(trace,parmset=meanparms+garchparms,pmethod=SIMPLEX,piters=10,method=bhhh,iters=400) logl gstart+6 gend
Post Reply