[R] histogram not equal to Kolmogorov-Smirnov test; 3-way-nested Anova (2)

Jörg Stephan jogstephan at googlemail.com
Mon Aug 8 16:00:00 CEST 2011


Hello R-Help-Team,

I am doing a 3-way-nestedAnova and a very strange thing occurred. My 
"Two-sample Kolmogorov-Smirnov test" (p=0.957) meet the requirement of 
normal distribution, BUT if I have a look at the histogram it is 
definitely not normally distributed. I never had something like that and 
I am very confused. I attached the data and my used code; in case you 
are not able to open it or need further information?s please tell me. As 
it is my first nested Anova, it would be very nice if you (hopefully) 
confirm the used code. Hoping you can help me. Thank you very much in 
advance.

Jörg

-------------- next part --------------
genot	cage	egg	surviver
Gudrun	A	fortyfive	0,955555556
Gudrun	A	fifteen	1
Gudrun	A	fifteen	0,933333333
Gudrun	A	fifteen	0
Gudrun	A	five	0
Gudrun	A	five	0,4
Gudrun	A	five	0,6
Gudrun	A	five	0,8
Gudrun	A	five	0,8
Gudrun	A	five	0,4
Gudrun	A	five	0,8
Gudrun	A	five	0,8
Gudrun	A	five	1
Gudrun	B	fortyfive	0,822222222
Gudrun	B	fifteen	0
Gudrun	B	fifteen	0,933333333
Gudrun	B	fifteen	0,8
Gudrun	B	five	0,2
Gudrun	B	five	0
Gudrun	B	five	0,6
Gudrun	B	five	0,6
Gudrun	B	five	1
Gudrun	B	five	0
Gudrun	B	five	0,4
Gudrun	B	five	1
Gudrun	B	five	1
Gudrun	C	fortyfive	1
Gudrun	C	fifteen	1
Gudrun	C	fifteen	1
Gudrun	C	fifteen	1
Gudrun	C	five	0
Gudrun	C	five	1
Gudrun	C	five	0
Gudrun	C	five	0,6
Gudrun	C	five	1
Gudrun	C	five	0,8
Gudrun	C	five	1
Gudrun	C	five	1
Gudrun	C	five	0,6
Gudrun	D	fortyfive	0,866666667
Gudrun	D	fifteen	0,866666667
Gudrun	D	fifteen	0,933333333
Gudrun	D	fifteen	1
Gudrun	D	five	1
Gudrun	D	five	1
Gudrun	D	five	0,2
Gudrun	D	five	1
Gudrun	D	five	1
Gudrun	D	five	0
Gudrun	D	five	1
Gudrun	D	five	1
Gudrun	D	five	0,2
Gudrun	E	fortyfive	0,955555556
Gudrun	E	fifteen	1
Gudrun	E	fifteen	0,6
Gudrun	E	fifteen	0,533333333
Gudrun	E	five	0
Gudrun	E	five	0
Gudrun	E	five	1
Gudrun	E	five	1
Gudrun	E	five	1
Gudrun	E	five	0,6
Gudrun	E	five	1
Gudrun	E	five	0,6
Gudrun	E	five	1
Gudrun	F	fortyfive	1
Gudrun	F	fifteen	1
Gudrun	F	fifteen	1
Gudrun	F	fifteen	1
Gudrun	F	five	1
Gudrun	F	five	1
Gudrun	F	five	0
Gudrun	F	five	0
Gudrun	F	five	1
Gudrun	F	five	0,2
Gudrun	F	five	0
Gudrun	F	five	1
Gudrun	F	five	1
Gudrun	G	fortyfive	1
Gudrun	G	fifteen	0,866666667
Gudrun	G	fifteen	0,933333333
Gudrun	G	fifteen	0,8
Gudrun	G	five	0
Gudrun	G	five	0
Gudrun	G	five	1
Gudrun	G	five	1
Gudrun	G	five	1
Gudrun	G	five	0
Gudrun	G	five	1
Gudrun	G	five	0,6
Gudrun	G	five	1
Gudrun	H	fortyfive	0,577777778
Gudrun	H	fifteen	0,4
Gudrun	H	fifteen	0,866666667
Gudrun	H	fifteen	0,066666667
Gudrun	H	five	0
Gudrun	H	five	0
Gudrun	H	five	0,8
Gudrun	H	five	0,2
Gudrun	H	five	0,2
Gudrun	H	five	0
Gudrun	H	five	0
Gudrun	H	five	0
Gudrun	H	five	1
Gudrun	I	fortyfive	0,488888889
Gudrun	I	fifteen	0,933333333
Gudrun	I	fifteen	0,933333333
Gudrun	I	fifteen	0,8
Gudrun	I	five	0
Gudrun	I	five	0
Gudrun	I	five	0
Gudrun	I	five	0
Gudrun	I	five	0
Gudrun	I	five	0
Gudrun	I	five	1
Gudrun	I	five	0
Gudrun	I	five	0,6
Gudrun	J	fortyfive	1
Gudrun	J	fifteen	1
Gudrun	J	fifteen	0,666666667
Gudrun	J	fifteen	0,8
Gudrun	J	five	1
Gudrun	J	five	1
Gudrun	J	five	1
Gudrun	J	five	0
Gudrun	J	five	0,8
Gudrun	J	five	0,8
Gudrun	J	five	1
Gudrun	J	five	0,4
Gudrun	K	fortyfive	0,777777778
Gudrun	K	fifteen	0
Gudrun	K	fifteen	1
Gudrun	K	fifteen	0,266666667
Gudrun	K	five	0
Gudrun	K	five	0
Gudrun	K	five	0,2
Gudrun	K	five	0
Gudrun	K	five	1
Gudrun	K	five	0,8
Gudrun	K	five	0,4
Gudrun	K	five	0,2
Gudrun	K	five	0
Loden	A	fortyfive	1
Loden	A	fifteen	0,866666667
Loden	A	fifteen	1
Loden	A	fifteen	1
Loden	A	five	0,8
Loden	A	five	1
Loden	A	five	1
Loden	A	five	1
Loden	A	five	1
Loden	A	five	1
Loden	A	five	1
Loden	A	five	1
Loden	A	five	1
Loden	B	fortyfive	0,955555556
Loden	B	fifteen	1
Loden	B	fifteen	0,333333333
Loden	B	five	0
Loden	B	five	0
Loden	B	five	1
Loden	B	five	0,8
Loden	B	five	1
Loden	B	five	1
Loden	B	five	0,2
Loden	B	five	0,2
Loden	B	five	0
Loden	C	fortyfive	0,933333333
Loden	C	fifteen	0,8
Loden	C	fifteen	0,333333333
Loden	C	fifteen	0,066666667
Loden	C	five	0
Loden	C	five	0,6
Loden	C	five	0
Loden	C	five	0,4
Loden	C	five	0,2
Loden	C	five	0,8
Loden	C	five	0,2
Loden	C	five	0,4
Loden	C	five	0,4
Loden	D	fortyfive	0,911111111
Loden	D	fifteen	1
Loden	D	fifteen	0,933333333
Loden	D	fifteen	0,266666667
Loden	D	five	0
Loden	D	five	0,2
Loden	D	five	0,4
Loden	D	five	0
Loden	D	five	0
Loden	D	five	0,4
Loden	D	five	0
Loden	D	five	1
Loden	D	five	1
Loden	E	fortyfive	0,933333333
Loden	E	fifteen	0,133333333
Loden	E	fifteen	0,866666667
Loden	E	fifteen	0,866666667
Loden	E	five	0
Loden	E	five	0
Loden	E	five	0
Loden	E	five	1
Loden	E	five	0
Loden	E	five	1
Loden	E	five	0
Loden	E	five	1
Loden	E	five	0,8
Loden	F	fortyfive	0,866666667
Loden	F	fifteen	0,733333333
Loden	F	fifteen	0,733333333
Loden	F	fifteen	0,2
Loden	F	five	0,2
Loden	F	five	0,8
Loden	F	five	0,2
Loden	F	five	0,8
Loden	F	five	0
Loden	F	five	0
Loden	F	five	0
Loden	F	five	0
Loden	G	fortyfive	0,777777778
Loden	G	fifteen	0
Loden	G	fifteen	0
Loden	G	fifteen	0,866666667
Loden	G	five	1
Loden	G	five	1
Loden	G	five	0,8
Loden	G	five	1
Loden	G	five	1
Loden	G	five	0,8
Loden	G	five	1
Loden	G	five	1
Loden	G	five	0
Loden	H	fortyfive	0,622222222
Loden	H	fifteen	0,2
Loden	H	fifteen	0
Loden	H	five	0,2
Loden	H	five	0,8
Loden	H	five	0
Loden	H	five	0,4
Loden	H	five	0,6
Loden	H	five	0
Loden	H	five	1
Loden	H	five	0
Loden	H	five	1
Loden	I	fortyfive	0,977777778
Loden	I	fifteen	0,733333333
Loden	I	fifteen	1
Loden	I	fifteen	1
Loden	I	five	0
Loden	I	five	0,6
Loden	I	five	0
Loden	I	five	1
Loden	I	five	1
Loden	I	five	1
Loden	I	five	1
Loden	I	five	1
Loden	I	five	1
Loden	J	fortyfive	1
Loden	J	fifteen	0,533333333
Loden	J	fifteen	1
Loden	J	fifteen	0,4
Loden	J	five	1
Loden	J	five	1
Loden	J	five	1
Loden	J	five	0,8
Loden	J	five	0,6
Loden	J	five	1
Loden	J	five	0
Loden	J	five	0
Loden	J	five	0
twentyone	A	fortyfive	0,311111111
twentyone	A	fifteen	0,6
twentyone	A	fifteen	0,933333333
twentyone	A	fifteen	0,733333333
twentyone	A	five	0,8
twentyone	A	five	0
twentyone	A	five	1
twentyone	A	five	0,6
twentyone	A	five	0,6
twentyone	A	five	0
twentyone	A	five	1
twentyone	A	five	0
twentyone	A	five	0
twentyone	B	fortyfive	0,933333333
twentyone	B	fifteen	1
twentyone	B	fifteen	1
twentyone	B	fifteen	0,933333333
twentyone	B	five	0,4
twentyone	B	five	0,8
twentyone	B	five	0
twentyone	B	five	0,2
twentyone	B	five	0
twentyone	B	five	0
twentyone	B	five	0,4
twentyone	B	five	0,4
twentyone	B	five	1
twentyone	C	fortyfive	0,844444444
twentyone	C	fifteen	1
twentyone	C	fifteen	1
twentyone	C	fifteen	0,933333333
twentyone	C	five	0,2
twentyone	C	five	0
twentyone	C	five	0,8
twentyone	C	five	1
twentyone	C	five	0,8
twentyone	C	five	1
twentyone	C	five	0,8
twentyone	C	five	0,6
twentyone	C	five	0
twentyone	D	fortyfive	0,511111111
twentyone	D	fifteen	1
twentyone	D	fifteen	0,2
twentyone	D	fifteen	0,333333333
twentyone	D	five	0,6
twentyone	D	five	0,2
twentyone	D	five	0
twentyone	D	five	0
twentyone	D	five	0
twentyone	D	five	0,2
twentyone	D	five	0,4
twentyone	D	five	0
twentyone	D	five	0
twentyone	E	fortyfive	0,688888889
twentyone	E	fifteen	0,8
twentyone	E	fifteen	0
twentyone	E	fifteen	0,6
twentyone	E	five	0,8
twentyone	E	five	1
twentyone	E	five	0,6
twentyone	E	five	0
twentyone	E	five	1
twentyone	E	five	0
twentyone	E	five	0
twentyone	E	five	1
twentyone	E	five	0
twentyone	F	fortyfive	0,755555556
twentyone	F	fifteen	0,133333333
twentyone	F	fifteen	0,866666667
twentyone	F	fifteen	1
twentyone	F	five	0
twentyone	F	five	1
twentyone	F	five	1
twentyone	F	five	0
twentyone	F	five	0,8
twentyone	F	five	0
twentyone	F	five	1
twentyone	F	five	1
twentyone	G	fortyfive	0,311111111
twentyone	G	fifteen	0
twentyone	G	fifteen	0,933333333
twentyone	G	fifteen	1
twentyone	G	five	0,8
twentyone	G	five	0,2
twentyone	G	five	0
twentyone	G	five	0
twentyone	G	five	0
twentyone	G	five	0,2
twentyone	G	five	0,6
twentyone	G	five	0,2
twentyone	G	five	1
twentyone	H	fortyfive	0,844444444
twentyone	H	fifteen	0,066666667
twentyone	H	fifteen	0,866666667
twentyone	H	fifteen	0,8
twentyone	H	five	0,2
twentyone	H	five	0,6
twentyone	H	five	0
twentyone	H	five	0
twentyone	H	five	0,6
twentyone	H	five	1
twentyone	H	five	0
twentyone	H	five	0
twentyone	H	five	0,6
twentyone	I	fortyfive	0,6
twentyone	I	fifteen	0,533333333
twentyone	I	fifteen	0,533333333
twentyone	I	fifteen	0,666666667
twentyone	I	five	0
twentyone	I	five	0,2
twentyone	I	five	0
twentyone	I	five	0
twentyone	I	five	0
twentyone	I	five	0,4
twentyone	I	five	0,2
twentyone	I	five	1
twentyone	J	fortyfive	0,311111111
twentyone	J	fifteen	0,733333333
twentyone	J	fifteen	0,866666667
twentyone	J	fifteen	0,666666667
twentyone	J	five	0
twentyone	J	five	0,8
twentyone	J	five	0,6
twentyone	J	five	1
twentyone	J	five	0,6
twentyone	J	five	0
twentyone	J	five	0,2
twentyone	J	five	0
twentyone	J	five	0
twentyone	K	fortyfive	0,733333333
twentyone	K	fifteen	0,8
twentyone	K	fifteen	0
twentyone	K	fifteen	0,266666667
twentyone	K	five	0
twentyone	K	five	0
twentyone	K	five	0
twentyone	K	five	0
twentyone	K	five	0,2
twentyone	K	five	1
twentyone	K	five	0,2
twentyone	K	five	0
twentyone	K	five	0,4
eightythree	A	fortyfive	1
eightythree	A	fifteen	0,933333333
eightythree	A	fifteen	1
eightythree	A	fifteen	0,933333333
eightythree	A	five	0,4
eightythree	A	five	1
eightythree	A	five	1
eightythree	A	five	1
eightythree	A	five	1
eightythree	A	five	1
eightythree	A	five	0,8
eightythree	A	five	0,8
eightythree	A	five	1
eightythree	B	fortyfive	1
eightythree	B	fifteen	0,8
eightythree	B	fifteen	1
eightythree	B	fifteen	0,733333333
eightythree	B	five	0
eightythree	B	five	0,6
eightythree	B	five	0,8
eightythree	B	five	0
eightythree	B	five	0
eightythree	B	five	0
eightythree	B	five	0,4
eightythree	B	five	0
eightythree	B	five	1
eightythree	C	fortyfive	0,644444444
eightythree	C	fifteen	0,8
eightythree	C	fifteen	0,733333333
eightythree	C	fifteen	0
eightythree	C	five	0,4
eightythree	C	five	0
eightythree	C	five	0
eightythree	C	five	0
eightythree	C	five	0
eightythree	C	five	0
eightythree	C	five	0
eightythree	C	five	0
eightythree	C	five	1
eightythree	D	fortyfive	0,866666667
eightythree	D	fifteen	1
eightythree	D	fifteen	0,133333333
eightythree	D	five	0,6
eightythree	D	five	0,2
eightythree	D	five	0
eightythree	D	five	0
eightythree	D	five	0
eightythree	D	five	0
eightythree	D	five	0
eightythree	D	five	1
eightythree	D	five	0
eightythree	E	fortyfive	0,644444444
eightythree	E	fifteen	0,6
eightythree	E	fifteen	0,333333333
eightythree	E	fifteen	1
eightythree	E	five	0
eightythree	E	five	0
eightythree	E	five	0,6
eightythree	E	five	1
eightythree	E	five	1
eightythree	E	five	0
eightythree	E	five	0,6
eightythree	E	five	0
eightythree	E	five	0
eightythree	F	fortyfive	1
eightythree	F	fifteen	0,933333333
eightythree	F	fifteen	0,333333333
eightythree	F	fifteen	0,6
eightythree	F	five	0
eightythree	F	five	0,4
eightythree	F	five	0
eightythree	F	five	0
eightythree	F	five	0
eightythree	F	five	0,8
eightythree	F	five	0
eightythree	F	five	0
eightythree	F	five	0
eightythree	G	fortyfive	0,155555556
eightythree	G	fifteen	0,066666667
eightythree	G	fifteen	0,066666667
eightythree	G	fifteen	0,466666667
eightythree	G	five	0
eightythree	G	five	0,6
eightythree	G	five	0
eightythree	G	five	0,4
eightythree	G	five	0,4
eightythree	G	five	0
eightythree	G	five	0
eightythree	G	five	0
eightythree	H	fortyfive	0,666666667
eightythree	H	fifteen	0,666666667
eightythree	H	fifteen	0,133333333
eightythree	H	fifteen	0,533333333
eightythree	H	five	0
eightythree	H	five	0
eightythree	H	five	0,4
eightythree	H	five	0,4
eightythree	H	five	0
eightythree	H	five	0
eightythree	H	five	0,6
eightythree	H	five	1
eightythree	H	five	0
eightythree	I	fortyfive	0,533333333
eightythree	I	fifteen	0,066666667
eightythree	I	fifteen	0
eightythree	I	fifteen	1
eightythree	I	five	0
eightythree	I	five	0
eightythree	I	five	1
eightythree	I	five	0
eightythree	I	five	0
eightythree	I	five	0
eightythree	I	five	1
eightythree	I	five	0
eightythree	I	five	1
eightythree	J	fortyfive	0,888888889
eightythree	J	fifteen	0,466666667
eightythree	J	fifteen	0,8
eightythree	J	fifteen	0,533333333
eightythree	J	five	0,8
eightythree	J	five	0,8
eightythree	J	five	1
eightythree	J	five	1
eightythree	J	five	0,6
eightythree	J	five	1
eightythree	J	five	0
eightythree	J	five	0
eightythree	J	five	0
eightythree	K	fortyfive	0,955555556
eightythree	K	fifteen	0,2
eightythree	K	fifteen	0,066666667
eightythree	K	fifteen	0,933333333
eightythree	K	five	0
eightythree	K	five	1
eightythree	K	five	0
eightythree	K	five	1
eightythree	K	five	0
eightythree	K	five	0,8
eightythree	K	five	0
eightythree	K	five	1

code:

par(mfrow=c(2, 3),mar=c(5, 5, 3, 1))
hist(surviver,cex.lab=1.5,ylab="Frequenz",main="Histogramm")
boxplot(surviver)
title("Boxplot",ylab="Mittelwert",cex.lab=1.5)
qqnorm(surviver,cex.lab=1.5,ylab="gemessene Quantilen",xlab="theoretische Quantilen",main="normal Q-Q-Plot")
qqline(surviver)


fm<-lm(surviver~genot*cage/egg)
summary(fm)
ANOVA<-aov(fm)
summary(ANOVA)
ANOVA


Residuen<-resid(fm)
ks.test(Residuen,mean(Residuen),sd(Residuen))






Short explanation:

As the three independent variables ?fifteen? (15 eggs) and the 
nine ?five? (5 eggs) are pseudo-replication within one cage (plant individual),
 the ?egg? is nested within the ?cage?, respectively. 





More information about the R-help mailing list