[R] normality testing with nortest

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon May 22 10:16:03 CEST 2006


Raymond Wan wrote:

> 
> On Mon, 22 May 2006, Uwe Ligges wrote:
> 
>> Rolf Turner wrote:
>>
>>> If the nortest package does it differently (and I don't really see
>>> how it possibly could!) then it is confusingly designed.  I rather
>>> suspect that its design is just fine, and that it does what it should
>>> do.
>>
>> I suspect so as well.
>> If you think something is wrong, please contact the package maintainer 
>> (CCing; he's not reading R-help posts).
> 
> 
>     Ah, ok -- but in this case, it was clearly my misunderstanding which 
> is one reason why I never though of writing to the package maintainer.  
> I have one of the books that the Nortest documentation cites, but I was 
> clearly reading it backwards or upside-down or something as I missed 
> several crucial points.
> 
>     One thing that threw me off (and this is not really specific to 
> Nortest as it seems to be correct, but just my understanding), but the 
> p-value seems quite unstable.  For example:
> 
>> ad.test(rnorm(100,mean=5,sd=3))
> 
> ...
> A = 0.2382, p-value = 0.7767
> 
>> ad.test(rnorm(100,mean=5,sd=3))
> 
> ...
> A = 0.1846, p-value = 0.9059
> 
>> ad.test(rnorm(100,mean=5,sd=3))
> 
> ...
> A = 0.5138, p-value = 0.1887
> 
>     I mistakenly had thought the p-values would be more stable since I 
> am artificially creating a random normal distribution.  Is this expected 
> for a normality test or is this an issue with how rnorm is producing 
> random numbers?  I guess if I run it many times, I would find that I 
> would get many large values for the p-value?

Well, as many large values as small values, 5% significant differences 
for the 5% level....

The following looks alright:

hist(replicate(1000,  ad.test(rnorm(100,mean=5,sd=3))$p.value))

> Ray
>



More information about the R-help mailing list