Page 1 of 1

DECO GARCH error

Posted: Thu Jan 29, 2026 8:12 am
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.

Re: DECO GARCH error

Posted: Thu Jan 29, 2026 11:03 am
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)