various distributions of returns

For questions and discussion related to graphs, reports, and other output, including issues related to presenting or publishing results.
ac_1
Posts: 465
Joined: Thu Apr 15, 2010 6:30 am

various distributions of returns

Unread post by ac_1 »

Hi Tom,

In RATS (using the various models from GARCHUV.RPF):

(a) How do I plot the PDF Fit from a (G)ARCH-family model superimposed on the raw returns, as (G)ARCH-family says returns are distributed around the mean with volatility sigma(t)?

(b) I want a diagnostic check (the assumption about the innovations), so plot the standardized residuals eps(t)/sigma(t) against the assumed pdf (Normal/t/GED). How?

Additionally,

Code: Select all

*===============================
* Normal overlay
@histogram(distrib=normal,maxgrid=100,$
           header="distribution of log-returns dlogdm overlay of the normal density") dlogdm

* KDE overlay
density dlogdm / sgrid sdensity
density(type=histogram) dlogdm / hgrid hdensity
scatter(style=bargraph,overlay=line,header='kernel estimates of the distribution of log-returns dlogdm') 2
# hgrid hdensity
# sgrid sdensity
Can the black density histogram be plotted with just a border for each bar i.e. no colour. How about other colours rather than black, or shading/patterns?

Further, how would I overlay all 3: normal, KDE and GARCH PDF Fit, with the histogram of the returns?

thanks,
Amarjit
TomDoan
Posts: 7774
Joined: Wed Nov 01, 2006 4:36 pm

Re: various distributions of returns

Unread post by TomDoan »

I have no idea what you mean about the GARCH "PDF". There's a different variance for each data point so you only get one observation on each.

The histogram and the kernel density are two alternative views of the same information. You generally would not show both on a single graph. (That would typically be done only to demonstrate what a kernel density does).

Graph styles/colors are described on:

https://estima.com/webhelp/topics/graph ... mbers.html

https://estima.com/webhelp/topics/stylesheets.html

The 3rd example on SCATTER shows calculation of an empirical density function graphed against the true density:

https://estima.com/webhelp/topics/scatt ... ction.html
ac_1
Posts: 465
Joined: Thu Apr 15, 2010 6:30 am

Re: various distributions of returns

Unread post by ac_1 »

TomDoan wrote: Tue Sep 02, 2025 9:10 am I have no idea what you mean about the GARCH "PDF". There's a different variance for each data point so you only get one observation on each.
Sorry, my error, (G)ARCH-family model(s) do not directly produce a probability density function (PDF) Fit to the returns.
ac_1
Posts: 465
Joined: Thu Apr 15, 2010 6:30 am

Re: various distributions of returns

Unread post by ac_1 »

If I want to graph the

standardized residuals diagnostics:
- Histogram of residuals with an overlay against the assumed pdf (Normal/t/GED)
- Helps check if volatility model captures heteroskedasticity.

within a loop, RATS will generate lots of graphs.

I would like just ONE graph being overwritten, as I traverse through the loop.

Is there an option?
TomDoan
Posts: 7774
Joined: Wed Nov 01, 2006 4:36 pm

Re: various distributions of returns

Unread post by TomDoan »

There's a preference item (Graphics tab) for "One Graph Window Only?". I seriously doubt that you will find that useful. You would be overwriting its contents maybe 10 to 50 times a second.
ac_1
Posts: 465
Joined: Thu Apr 15, 2010 6:30 am

Re: various distributions of returns

Unread post by ac_1 »

TomDoan wrote: Thu Sep 04, 2025 8:52 am There's a preference item (Graphics tab) for "One Graph Window Only?". I seriously doubt that you will find that useful. You would be overwriting its contents maybe 10 to 50 times a second.
Thanks.

If I do something like:

Code: Select all

comp rend = 800

do jj = 0, 50

   garch(p=1,q=1,resids=u,hseries=h,print,METHOD=BFGS,stdresids=stdu) 2 rend+jj y

   set stdusq 2 rend+jj = stdu(1)^2
   @histogram(distrib=normal) stdusq 2 rend+jj

end do jj
I get 51 graphs.

Preferences -> One Graph Window Only

I get one graph window, and sometimes get an "animation", sometimes not, as RATS crashes. Animations are useful, especially over a long history of time, here, to see what's in the tail's when using rolling/recursive windows. Presumably, slow-down the graphing somehow?
TomDoan
Posts: 7774
Joined: Wed Nov 01, 2006 4:36 pm

Re: various distributions of returns

Unread post by TomDoan »

The one graph option is a throw back to the earlier days of Windows when you could be severely limited in how many windows could be handled by the operating system (and computers were 100 times slower than today so graphs wouldn't be overwritten multiple times a second).
Post Reply