[R] Jarque-Bera and rnorm()

Andrew Robinson A.Robinson at ms.unimelb.edu.au
Fri Apr 27 11:15:17 CEST 2007


On Fri, April 27, 2007 7:02 pm, Murali Menon wrote:
> Folks,
>
> I'm a bit puzzled by the fact that if I generate 100,000 standard normal
> variates using rnorm() and perform the Jarque-Bera on the resulting
> vector,
> I get p-values that vary drastically from run to run. Is this expected?
> Surely the p-val should be close to 1 for each test?

No.  Under the null hypothesis, the p-value is a uniformly-distributed
random variable, with range 0 to 1.

Cheers,

Andrew



> Are 100,000 variates sufficient for this test?
>
> Or is it that rnorm() is not a robust random number generator? I looked at
> the skewness and excess kurtosis, and the former seems to be unstable,
> which
> leads me to think that is why JB is failing.
>
> Here are my outputs from successive runs of rjb.test (the robust Jarque
> Bera
> from the lawstat package).
>
>
>>set.seed(100)
>
>>y <- rnorm(100000);rjb.test(y);skewness(y)[1];kurtosis(y)[1]
>
>         Robust Jarque Bera Test
>
> data:  y
> X-squared = 1.753, df = 2, p-value = 0.4162
>
> [1] -0.01025744
> [1] 0.0008213325
>
>>y <- rnorm(100000);rjb.test(y);skewness(y)[1];kurtosis(y)[1]
>
>         Robust Jarque Bera Test
>
> data:  y
> X-squared = 0.1359, df = 2, p-value = 0.9343
>
> [1] -0.001833042
> [1] -0.002603599
>
>>y <- rnorm(100000);rjb.test(y);skewness(y)[1];kurtosis(y)[1]
>
>         Robust Jarque Bera Test
>
> data:  y
> X-squared = 4.6438, df = 2, p-value = 0.09809
>
> [1] -0.01620776
> [1] -0.005762349
>
>
> Please advise. Thanks,
>
> Murali
>
> _________________________________________________________________
> MSN is giving away a trip to Vegas to see Elton John.  Enter to win today.
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


Andrew Robinson
Senior Lecturer in Statistics                       Tel: +61-3-8344-9763
Department of Mathematics and Statistics            Fax: +61-3-8344 4599
University of Melbourne, VIC 3010 Australia
Email: a.robinson at ms.unimelb.edu.au    Website: http://www.ms.unimelb.edu.au



More information about the R-help mailing list