Page 1 of 1

Reproducing Residuals

Posted: Thu Jul 24, 2008 4:16 pm
by Gregory
As a quick check of my work, I like to replicate the series of residuals returned by RATS by recalculating them using the estimated coefficients from the model I've run (from a GARCH model in this particular case). I find that my residuals are the same up to about five decimal places. Does this rounding error appear because RATS displays estimated coefficients at a lower precision than it uses internally? I notice too that when I save %BETA to a file, I get six decimal places, which is fewer than displayed in the results window. Can anyone tell me how I can get at the coefficients in full precision?

Regards,

Posted: Fri Jul 25, 2008 9:13 am
by moderator
"Does this rounding error appear because RATS displays estimated coefficients at a lower precision than it uses internally? "

Sure. On most types of computers, you'll have 15 digits of precision. Depending on the scale of your coefficient values, the GARCH output is probably showing just over half of those digits.

With respect to writing %BETA (or any array) to a file, there are a lot of ways to do that in RATS. You can use DISPLAY or WRITE, or use MEDIT to display the array in a window and then do File-Export, or create a REPORT and write that to a file.

With DISPLAY, you can use "picture codes" to control the formatting of the output. For example:

open betaout coeffs.txt
display(unit=betaout) ##.############## %beta

If you want to export to an Excel file, I would probably suggest just copying the data into a series:

set coeffs 1 %rows(%beta) = %beta(t)
open copy coeffs.xls
copy(for=xls,org=cols) / coeffs

That will give you the full precision.

Posted: Fri Jul 25, 2008 9:27 am
by Gregory
Good stuff. Thanks.