[R] Normal tests disagree?

Ben Bolker bolker at ufl.edu
Wed Dec 2 04:54:25 CET 2009


milton ruser <milton.ruser <at> gmail.com> writes:

> 
> Hi there,
> 
> Could you provide a minimum reproducible code, please.
> Bests
> 
> milton
> 
> On Tue, Dec 1, 2009 at 6:11 PM, <rkevinburton <at> charter.net> wrote:
> 
> > If I have data that I feed into shapio.test and jarque.bera.test yet they
> > seem to disagree. What do I use for a decision?
> >
> > For my data set I have p.value of 0.05496421 returned from the shapiro.test
> > and 0.882027 returned from the jarque.bera.test. I have included the data
> > set below.
> >
> > Thank you.
> >
> > Kevin

It depends why you are testing for normality.
How big a departure are you looking for, and how will those
departures affect your inference? How easily can you adopt
a robust approach so that it won't matter so much if the
data are normally distributed?

## "Residuals" data only
x = c(-0.449735723758323, 0.281461045050074, 
0.591383050911335, 0.239998659520616, 
0.00343879474063987, -2.64372061292663, 0.381630655290173, 
-1.79543281552347, 
1.90631012440313, -0.256232543929779, 1.83452602676812, 
-1.06869719416837, 
1.04378655286183, 0.232655831328322, -0.939084802643773,
 0.854132879285335, 
-1.71217066877156, 1.28040273099582, -0.386415431325857, -0.769127669783483, 
-0.810996835089867, 0.0477292147635991, 0.294672848750557, -0.0841330473924862, 
0.231663729192233, -0.601790650547443, 0.285635768516625, -0.96315495955862, 
1.52188112949994, -0.826092842933196, 1.91937201229077, -0.317789483136924, 
-0.865011007394312, -0.0281604973711276, -0.123887049811822, 
-0.0327727730592468, -0.0654939600771254, 0.279247739913908, 
0.167606602923418, 0.189533097427477, 0.402062194225847, 1.97150984262995, 
-2.27538477532968, 1.89091792097945, 0.0251732151287081, -0.2349741808124, 
-0.659332058368173, 0.127284768034285, -1.42838560676513, 0.617689775286461, 
-0.034243005247084, -0.304574261133836, 0.128679369916751, -0.657479389968652, 
0.608766068692517, 1.928147708694, -0.172644961366165, -0.453255508263169, 
-1.09903330959344)

shapiro.test(x)
library(tseries)
jarque.bera.test(x)

## Replicates results: p=0.059 vs 0.88
## Wikipedia article on Jarque-Bera test suggests chi-squared
## approximation isn't very good for small-to-moderate data sets

qqnorm(x)
## or ...
library(lattice)
qqmath(~x,
       prepanel = prepanel.qqmathline,
       panel = function(x, ...) {
         panel.qqmathline(x, ...)
         panel.qqmath(x, ...)
       })

hist(x)

## and just to add to the confusion ...
library(nortest)
ad.test(x)


  Bottom line: I would say the data don't *look* particularly
normal, and the anderson-darling test fairly conclusively
rejects normality, but it really depends what you want to 
do with the data ...




More information about the R-help mailing list