[R] nested anova<-R chrashing

joerg stephan stephanj at rhrk.uni-kl.de
Mon Sep 12 20:05:43 CEST 2011


Hi,

I tried to do a nested Anova with the attached Data. My response 
variable is "survivors" and I would like to know the effect of 
(insect-egg clutch) "size", "position" (of clutch on twig) and "clone" 
(/plant genotype) on the survival of eggs (due to predation). Each plant 
was provided with three different sizes of clutches (45,15,5) and had 
pseudo-replications of size 15 and 5 on it.

_Question 1: right code for nested Anova_

Here part of the code I used:

clone1<-as.factor(ifelse(clone=="Gudrun",1,ifelse(clone=="Loden",2,ifelse(clone=="021",3,4))))

plant1<-as.factor(ifelse(plant==1,1,ifelse(plant==2,2,ifelse(plant==3,3,ifelse(plant==4,4,ifelse(plant==5,5,ifelse(plant==6,6,

ifelse(plant==7,7,ifelse(plant==8,8,ifelse(plant==9,9,ifelse(plant==10,10,ifelse(plant==11,11,ifelse(plant==12,12,

ifelse(plant==13,13,ifelse(plant==14,14,ifelse(plant==15,15,ifelse(plant==16,16,ifelse(plant==17,17,ifelse(plant==18,18,

ifelse(plant==19,19,ifelse(plant==20,20,ifelse(plant==21,21,ifelse(plant==22,22,ifelse(plant==23,23,ifelse(plant==24,24,

ifelse(plant==25,25,ifelse(plant==26,26,ifelse(plant==27,27,ifelse(plant==28,28,ifelse(plant==29,29,ifelse(plant==30,30,

ifelse(plant==31,31,ifelse(plant==32,32,ifelse(plant==33,33,ifelse(plant==34,34,ifelse(plant==35,35,ifelse(plant==36,36,

ifelse(plant==37,37,ifelse(plant==38,38,ifelse(plant==39,39,ifelse(plant==40,40,ifelse(plant==41,41,ifelse(plant==42,42,43)))))))))))))))))))))))))))))))))))))))))))

size1<-as.factor(ifelse(size==5,1,ifelse(size==15,2,3)))

position1<-as.factor(ifelse(position==1,1,ifelse(position==2,2,ifelse(position==3,3,

ifelse(position==4,4,ifelse(position==5,5,ifelse(position==6,6,ifelse(position==7,7,

ifelse(position==8,8,ifelse(position==9,9,ifelse(position==10,10,ifelse(position==11,11,ifelse(position==12,12,13)))))))))))))

ANOVA<-aov(survivors~(clone1*size1*position1)+Error(plant1/(size1*position1)))

After that command it says: "Error() model is singular". Even after 
googling (looks like many people had that problem) I am still uncertain 
how to solve that, mainly because I am not sure if the used code for the 
Anova meets my set up requirements. If I am using 
"ANOVA<-aov(survivors~clone1*plant1/(size1*position1)))" R sometimes is 
even crashing down.

_Question 2: normal distribution and homogeneity of variance_

So fare I tested "normal" Anovas by doing a linear model following 
plotting and KS-test and Bartlett-test including Q-Q-plot.

fm<-lm(survivors~clone1*plant1*size1*position1)

Residuen<-resid(fm) Here R is crashing again!!!

ks.test(Residuen,mean(Residuen),sd(Residuen))

plot(density(Residuen))

qqnorm(Residuen)

par(mfrow=c(2,2))

plot(fm)

bartlett.test(survivors~clone1*plant1*position1*size1)

Is that too much to compute for R? Is it OK to look for the 
preconditions for that nested Anova in that way, or do I have to use the 
same code for the Bartlett also (or evaluate only by looking at the 
Graphs (Zuur et al. 2010))??????

Thank you very much in advance

Jörg

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: survival.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110912/2103af20/attachment.txt>


More information about the R-help mailing list