[R-sig-eco] how to perform 5 level nested anova
Christian Parker
cparker at pdx.edu
Wed Feb 11 02:52:47 CET 2009
You just need to make sure that your factors are read as factors and not
numbers. The easiest way to do that is to specify the column types right
when you read in your data
Try this:
seedL<-read.delim("SeedL.txt.txt",colClasses=c("factor","factor","factor","factor","numeric","numeric"))
cmod<-lmer(SeedL~1+(1|SpecN)+(1|SpecN:PopN)+(1|SpecN:PopN:TreeN),data=seedL)
Mao Jianfeng wrote:
> Hello.
>
> I am new to R. And, I want to perform a multiple nested anova on a large
> datasets (with 9448 observations).
>
> I tried the function ("lmer()" in package "lme4"). But, I failed. Can anyone
> help me?
>
> my dataset("SeedL.txt") was attached. Data are not sorted by factors. This
> data are unequal sample sizes.
>
> In this dataset, "SpecN" "PopN" "TreeN" "ConeN" "SeedN" were 5 factors (as
> Explanatory), with "PopN" nested within "SpecN"; "TreeN" nested within
> "PopN"; "ConeN" nested within "TreeN" and "SeedN" nested within "ConeN".
>
> "SeedL" is a dependent variate (as Response).
>
> The model I have ever used in R is:
>
> cmod<-lmer(SeedL~1+(1|SpecN)+(1|SpecN:PopN)+(1|SpecN:PopN:TreeN),
> data=seedL)
>
> What I got in R is:
>
> error: length(f1) == length(f2) is not TRUE
> In addition: Warning messages:
> 1: In SpecN:PopN : 数值表达式一共有9447元素: 只用了第一个 (In Enlish: there are 9447
> elements in the expression, but only the first one has been used.)
> 2: In SpecN:PopN : 数值表达式一共有9447元素: 只用了第一个
> 3: In SpecN:PopN : 数值表达式一共有9447元素: 只用了第一个
> 4: In SpecN:PopN : 数值表达式一共有9447元素: 只用了第一个
> 5: In SpecN:PopN:TreeN : 数值表达式一共有6元素: 只用了第一个
> 6: In SpecN:PopN:TreeN : 数值表达式一共有9447元素: 只用了第一个
>
> I an longing for helps in R usage or statistical technology.
>
> Thanks a lot in advance.
>
> Mao J-F
> State Key Lab of Systematics and Evolutionary Botany
> Institute of Botany
> Chinese Academy of Sciences
> Beijing, China
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
More information about the R-sig-ecology
mailing list