DECO GARCH error

Discussions of ARCH, GARCH, and related models
econonick
Posts: 4
Joined: Mon Jan 09, 2017 12:19 am

DECO GARCH error

Unread post by econonick »

I added the following code to the original DECO model code provided in RATS to compute the conditional covariance(Ht).

Code: Select all

dec series[symm] Hcov

compute tstart = %regstart()

do t = tstart, %regend()
   dec vect std(n)

   do i=1,n
      compute std(i) = vol(i)(t)
   end do i

   * DECO H(t): variance-covariance
   compute Hcov(t) = %mqform(%cvtocorr(q(t)), %diag(std))
end do t

However, when I run this code, I get the following error:


## MAT15. Subscripts Too Large or Non-Positive
The Error Occurred At Location 130, Line 10 of loop/block

Could you please explain the reason why this error occurs?
I have attached the code and the file.
Attachments
g10xrate.xls
(1.2 MiB) Downloaded 96 times
garchdeco_Ht.RPF
(2.48 KiB) Downloaded 114 times
TomDoan
Posts: 7816
Joined: Wed Nov 01, 2006 4:36 pm

Re: DECO GARCH error

Unread post by TomDoan »

You can do the whole extra calculation with the single instruction:

gset hcov %regstart() %regend() = %mqform(%cvtocorr(q),%diag(%xt(vol,t)))

The problem was with trying to do a COMPUTE on a single element of HCOV without the range of the SERIES[SYMM] ever having been set. GSET takes care of that.

(You could fix the original code by adding

gset hcov %regstart() %regend() = %zeros(n,n)

which initializes the range of HCOV for the later COMPUTE instructions)
Post Reply