[R] How to generate heteroscedastic random numbers?

Duncan Murdoch murdoch.duncan at gmail.com
Fri Jul 8 19:01:39 CEST 2011

On 08/07/2011 12:15 PM, UnitRoot wrote:
> Hello,
> I have tried to generate numbers randomly which follow normal, Student-t and
> skewed Student-t distributions. However, when I check those series for
> heteroscedastisity test (ARCH) results are showing that there is no
> heteroscedastisity.
> As we all know, returns (financial returns) usually have heteroscedastisity.
> My question is, is it possible somehow generate random numbers which have
> hetescedastisity?
> I was thinking about generating random numbers and sort them out and then
> allocate them, so they will have some level of heteroscedastisity. However,
> I am not sure if this is correct way of doing it.
> I appreciate any input. Thank you.

"Heteroscedastic" just means that the variance is not constant.  So

rnorm(10, sd=1:10)

gives heteroscedastic values.

If you are using some ARCH model to generate the random numbers, they 
may well be heteroscedastic, but that doesn't mean your test will detect 
it.  Tests are fallible, especially on small datasets.

Duncan Murdoch

More information about the R-help mailing list