MGARCH estimation
MGARCH estimation
I am trying to estimate a MGARCH(1,1) model but the variance-covariance matrix is coming up as non invertible. How can I correct this?
lin(noprint) baa / resids1
# constant
com AO = %beta(1)
com a11 = %seesq
lin(noprint) tbill3 / resids2
# constant
com BO = %beta(1)
com b11 = %seesq
com c11 = (a11*b11)**2
set R1 = resids1
set R2 = resids2
vcv(noprint,mat=cov)
# R1 R2
set U11 = cov(1,1)
set U22 = cov(2,2)
set U12 = cov(1,2)
nonlin AO BO a11 a12 a21 b11 b12 b21 c11 c12 c21
frml H11 = a11 + a12*U11{1} + a21*R1{1}
frml H22 = b11 + b12*U22{1} + b21*R2{1}
frml H12 = c11 + c12*U12{1} + c21*(R1{1}*R2{1})
frml res1 = baa-Ao
frml res2 = tbill3-Bo
com a12 = 0.05 , a21=0.7 , b12=0.05 , b21=0.7 , c12=0.05 , c21 = 0.7
dec symm covm
dec vec Res
frml LogL = (u11(t)=h11(t)),(u22(t)=h22(t)),(u12(t)=h12(t)),(R1(t)=res1(t)),(R2(t)=res2(t)),$
(covm=||u11(t)|u12(t),u22(t)||),$
(Res=||R1(t),R2(t)||),$
-.5*Log(%det(covm))-.5*%qform(inv(covm),Res)
max(method=simplex,iter=100,noprint) LogL 1970:12 2008:12
## MAT14. Non-invertible Matrix. Using Generalized Inverse for SYMMETRIC.
lin(noprint) baa / resids1
# constant
com AO = %beta(1)
com a11 = %seesq
lin(noprint) tbill3 / resids2
# constant
com BO = %beta(1)
com b11 = %seesq
com c11 = (a11*b11)**2
set R1 = resids1
set R2 = resids2
vcv(noprint,mat=cov)
# R1 R2
set U11 = cov(1,1)
set U22 = cov(2,2)
set U12 = cov(1,2)
nonlin AO BO a11 a12 a21 b11 b12 b21 c11 c12 c21
frml H11 = a11 + a12*U11{1} + a21*R1{1}
frml H22 = b11 + b12*U22{1} + b21*R2{1}
frml H12 = c11 + c12*U12{1} + c21*(R1{1}*R2{1})
frml res1 = baa-Ao
frml res2 = tbill3-Bo
com a12 = 0.05 , a21=0.7 , b12=0.05 , b21=0.7 , c12=0.05 , c21 = 0.7
dec symm covm
dec vec Res
frml LogL = (u11(t)=h11(t)),(u22(t)=h22(t)),(u12(t)=h12(t)),(R1(t)=res1(t)),(R2(t)=res2(t)),$
(covm=||u11(t)|u12(t),u22(t)||),$
(Res=||R1(t),R2(t)||),$
-.5*Log(%det(covm))-.5*%qform(inv(covm),Res)
max(method=simplex,iter=100,noprint) LogL 1970:12 2008:12
## MAT14. Non-invertible Matrix. Using Generalized Inverse for SYMMETRIC.
Re: MGARCH estimation
Shouldn't you be squaring the lagged residuals in the lines:
Also, unless I'm missing something, you could replace the whole thing with
There's nothing special about your model which would require doing the MAXIMIZE setup rather than just using GARCH.
Code: Select all
frml H11 = a11 + a12*U11{1} + a21*R1{1}
frml H22 = b11 + b12*U22{1} + b21*R2{1}Code: Select all
garch(p=1,q=1) / baa tbill3Re: MGARCH estimation
Hello,
I squared the lagged residuals, but I am still getting the same error message, that covm is not invertible. This is coming up for almost every data point.
I know I can just use the GARCH command, but I am trying to become more familiar and better with rats' coding.
I squared the lagged residuals, but I am still getting the same error message, that covm is not invertible. This is coming up for almost every data point.
I know I can just use the GARCH command, but I am trying to become more familiar and better with rats' coding.
Re: MGARCH estimation
Code: Select all
com c11 = (a11*b11)**2Re: MGARCH estimation
I'm still getting the same error message. I made the correction from above and I changed the parameter values to
com a12 = .9 ; com a21=0.7 ; com b12=.9 ;com b21=0.7 ; com c12=.8 ; com c21 = 0.7,
but nothing changed, covm is still not invertible.
## MAT14. Non-invertible Matrix. Using Generalized Inverse for SYMMETRIC.
comes up about a few hundred times and then it is followed by
## SR10. Missing Values And/Or SMPL Options Leave No Usable Data Points
com a12 = .9 ; com a21=0.7 ; com b12=.9 ;com b21=0.7 ; com c12=.8 ; com c21 = 0.7,
but nothing changed, covm is still not invertible.
## MAT14. Non-invertible Matrix. Using Generalized Inverse for SYMMETRIC.
comes up about a few hundred times and then it is followed by
## SR10. Missing Values And/Or SMPL Options Leave No Usable Data Points
Re: MGARCH estimation
You need to really think about your guess values for the parameters. In this last try, you have explosive behavior for each of the three terms in the covariance matrix. So first, you'll have to correct that.
Also, since you're having a hard time getting the function to even evaluate at your guess values, the simplest thing to do is to zero out the parameters for the cross term. If the model produces a zero covariance at the guess values, you shouldn't have a problem with a non-invertible matrix. Once you get a set of values at which the function can be evaluated, it can then estimate non-zero values for those parameters, since any set which produces a non-positive definite matrix will be rejected.
Also, since you're having a hard time getting the function to even evaluate at your guess values, the simplest thing to do is to zero out the parameters for the cross term. If the model produces a zero covariance at the guess values, you shouldn't have a problem with a non-invertible matrix. Once you get a set of values at which the function can be evaluated, it can then estimate non-zero values for those parameters, since any set which produces a non-positive definite matrix will be rejected.
Re: MGARCH estimation
I am using the general command,
garch(p=1,q=1,method=bhhh,mvhseries=HH,iters=500,pmethod=simplex,piters=20,subiter=100,regressors) / dssec dsp
For the two mean equations I am going to leave them as depending only on a constant, but I want the variance and covariance equations to include the regressor TERM.
Does the commend change according to,
garch(p=1,q=1,method=bhhh,mvhseries=HH,iters=500,pmethod=simplex,piters=20,subiter=100,regressors) / dssec dsp
# TERM
Is the above enough to include the regressor TERM in the covariance equations?
garch(p=1,q=1,method=bhhh,mvhseries=HH,iters=500,pmethod=simplex,piters=20,subiter=100,regressors) / dssec dsp
For the two mean equations I am going to leave them as depending only on a constant, but I want the variance and covariance equations to include the regressor TERM.
Does the commend change according to,
garch(p=1,q=1,method=bhhh,mvhseries=HH,iters=500,pmethod=simplex,piters=20,subiter=100,regressors) / dssec dsp
# TERM
Is the above enough to include the regressor TERM in the covariance equations?
Re: MGARCH estimation
You want the XREGRESSORS option, which adds regressors to the covariance matrix, not the REGRESSORS option which adds them to the mean equation.