Extracting the residual series from MGARCH-M model
Extracting the residual series from MGARCH-M model
Hello,
I am using following Multivariate GARCH instruction to estimate a GARCH model. I want to extract the estimated residual series stored in rv. Could you please guide me about how to do this?
Thanks.
----------------------------------
garch(model=garchm,mv=bekk,presample=cv0,$
rvectors=rv,hmatrices=h,$
uadjust=%pt(eps,t,rv(t)),hadjust=%pt(sqrth,t,%sqrt(%xdiag(h(t)))),$
pmethod=simplex,piters=20,init=%beta)
I am using following Multivariate GARCH instruction to estimate a GARCH model. I want to extract the estimated residual series stored in rv. Could you please guide me about how to do this?
Thanks.
----------------------------------
garch(model=garchm,mv=bekk,presample=cv0,$
rvectors=rv,hmatrices=h,$
uadjust=%pt(eps,t,rv(t)),hadjust=%pt(sqrth,t,%sqrt(%xdiag(h(t)))),$
pmethod=simplex,piters=20,init=%beta)
Re: Extracting the residual series from MGARCH-M model
See page UG-302 in the Version 8 User's Guide. Those are doing standardized residuals, but you can do the same thing without the standardization.
Re: Extracting the residual series from MGARCH-M model
I am trying to extract Standardized residuals (RATS 8.0):
but face this error:
## OP3. This Instruction Does Not Have An Option UAD
>>>>sample=cv0,uadjust=<<<<
Code: Select all
system(model=var1)
variables O C
lags 1
end(system)
compute cv0=%sigma
garch(p=1,q=1,model=var1,mv=CC,variance=varma,pmethod=simplex,piters=5,hmatrices=Varmah, MVHSERIES=VarmaHmatrix, rvectors=Varmarv,presample=cv0,uadjust=%pt(eps,t,Varmarv(t)),hadjust=%pt(sqrth,t,%sqrt(%xdiag(Varmah(t)))),$
pmethod=simplex,piters=20 ) gstart gend O C
## OP3. This Instruction Does Not Have An Option UAD
>>>>sample=cv0,uadjust=<<<<
Re: Extracting the residual series from MGARCH-M model
UADJUST and HADJUST were added with RATS 8.1. There were many additional changes to GARCH with 9.0. I would suggest that you update to v9.
Re: Extracting the residual series from MGARCH-M model
the only way is updating?
how can I get the residuals?
how can I get the residuals?
Re: Extracting the residual series from MGARCH-M model
In effect, yes. You can't estimate the model without the new options---they were added precisely to make a model like this (a VARMA-GARCH-M) tractable. And if you can't estimate the model, you can't get the residuals.
Re: Extracting the residual series from MGARCH-M model
I mean, with this code I can estimate the model
Now I have the hmatrices, I can get the sqrt of it.**
if I can get the residuals of this GARCH function, then I have the standardized residuals!
**
{ I dont know how to find SQRT in RATS but code in R is as follow
a.eig <- eigen(a)
a.sqrt <- a.eig$vectors %*% diag(sqrt(a.eig$values)) %*% solve(a.eig$vectors)
Code: Select all
garch(p=1,q=1,model=var1,mv=CC,variance=varma,pmethod=simplex,piters=5,hmatrices=Varmah, MVHSERIES=VarmaHmatrix, rvectors=Varmarv)if I can get the residuals of this GARCH function, then I have the standardized residuals!
**
{ I dont know how to find SQRT in RATS but code in R is as follow
a.eig <- eigen(a)
a.sqrt <- a.eig$vectors %*% diag(sqrt(a.eig$values)) %*% solve(a.eig$vectors)
Re: Extracting the residual series from MGARCH-M model
The GARCHMV.RPF example with your version 8 has code for computing multivariate standardized residuals. (Note that there are an infinite number of ways of standardizing a multivariate set of series with each generating a somewhat different set of diagnostics). With version 9, there's a STDRESIDS option which computes it directly. Note that VARIANCES=VARMA has nothing to do with the "VARMA" (mean model) used in the original example in this thread.
Re: Extracting the residual series from MGARCH-M model
Code: Select all
garch(p=1,q=1,model=var1,mv=CC,variance=varma,pmethod=simplex,piters=5,hmatrices=Varmah, MVHSERIES=VarmaHmatrix, rvectors=Varmarv ) gstart gend O c
open copy 2.xls
copy(data,format=xls,org=columns) /Varmarv
>>>>columns) /Varmarv<<<<
How can I save the residuals?
Re: Extracting the residual series from MGARCH-M model
Even if that would work (it won't because RVECTORS produces a SERIES[VECTOR] which COPY doesn't handle), of what use would the non-standardized residuals from a GARCH model be? Those won't be all that different from the residuals from estimating the VAR without the GARCH errors. Compute the standardized residuals using the method shown in your GARCHMV.RPF program and you can apply COPY to them.
Re: Extracting the residual series from MGARCH-M model
Do you mean this code?
Code: Select all
* Estimates for a BEKK with t errors, saving the residuals and the
* variances (in the VECT[SERIES] and SYMM[SERIES] forms), and using them
* to compute the empirical probability of a residual (for Japan) being
* in the left .05 tail.
*
garch(p=1,q=1,mv=bekk,pmethod=simplex,piters=10,distrib=t,$
rseries=rs,mvhseries=hhs) / xjpn xfra xsui
*
compute fixt=(%shape-2)/%shape
set trigger = %tcdf(rs(1)/sqrt(hhs(1,1)*fixt),%shape)<.05
Re: Extracting the residual series from MGARCH-M model
No. You don't have version 9 (and that's a completely different calculation anyway). There's a GARCHMV.RPF in your examples folder which works with version 8. GARCHMV.RPF is also described in your User's Guide (Example 9.2) as is the process for obtaining standardized residuals (section 9.8.2). In the code below, the ZU are the multivariate standardized residuals. (Z1, Z2 and Z3 are univariate standardized residuals, which aren't as useful diagnostically).
Code: Select all
garch(p=1,q=1,pmethod=simplex,piters=10,$
hmatrices=hh,rvectors=rd) / xjpn xfra xsui
set z1 = rd(t)(1)/sqrt(hh(t)(1,1))
set z2 = rd(t)(2)/sqrt(hh(t)(2,2))
set z3 = rd(t)(3)/sqrt(hh(t)(3,3))
@bdindtests(number=40) z1
@bdindtests(number=40) z2
@bdindtests(number=40) z3
*
* Multivariate Q statistic. This requires transforming the residuals to
* eliminate the time-varying correlations.
*
dec vect[series] zu(%nvar)
do time=%regstart(),%regend()
compute %pt(zu,time,%solve(%decomp(hh(time)),rd(time)))
end do time
Re: Extracting the residual series from MGARCH-M model
Now it gives me this error:
## MAT15. Subscripts Too Large or Non-Positive
Error was evaluating entry 2355
## MAT15. Subscripts Too Large or Non-Positive
Error was evaluating entry 2355
Re: Extracting the residual series from MGARCH-M model
TomDoan wrote:it won't because RVECTORS produces a SERIES[VECTOR] which COPY doesn't handle[/i].
to export errors vector, I used this code
EWISE rd(t) = X(t)
## SX11. Identifier X is Not Recognizable. Incorrect Option Field or Parameter Order?
>>>>EWISE rd(t) = X(<<<<
still doesn't work
Re: Extracting the residual series from MGARCH-M model
I assume this is with your program adapted to your data set. You would have to attach the whole program for us to tell. Which instruction/loop is causing the problem? (Do Show Last Error on the Edit menu).