Dear list members, I'd like to perform a glm analysis with a hierarchically nested design. In particular, I have one fixed factor ("Land Use Classes") with three levels and a random factor ("quadrat") nested within Land Use Classes with different levels per classes (class artificial = 1 quadrat; class crops = 67 quadrats; and class seminatural = 30 quadrats). I have four replicates per each quadrats (response variable = species richness per plot) Here some question about: 1) could I analize these data using the class "artificial" (i.e. I have only 1 level)? 2) using R I'd like perfor a glm analysis considering my response variable (count of species) with a Poisson distribution. How can I develop my model considering the nested nature of my design? I'm sorry but I don't know the right package to use. 3) for the Anova analysis I'd like use a post-hoc comparison between pairwise classes. What is the right procedure to do this? Is this analysis performed in R? Thanks Giovanni [[alternative HTML version deleted]]
<see inline> Giovanni Bacaro wrote:> Dear list members, > > I'd like to perform a glm analysis with a hierarchically nested design. In > particular, > > I have one fixed factor ("Land Use Classes") with three levels and a random > factor ("quadrat") nested within Land Use Classes with different levels per > classes (class artificial = 1 quadrat; class crops = 67 quadrats; and class > seminatural = 30 quadrats). > > I have four replicates per each quadrats (response variable = species > richness per plot) > > Here some question about: > > 1) could I analize these data using the class "artificial" (i.e. I have only > 1 level)?SG: I don't know for sure, but I don't think it would be a problem. I wouldn't be afraid to try.> > 2) using R I'd like perfor a glm analysis considering my response variable > (count of species) with a Poisson distribution. How can I develop my model > considering the nested nature of my design? I'm sorry but I don't know the > right package to use. >SG: There are several functions for "generalized linear mixed models", but I think the best is 'lmer' with the 'lme4' and 'matrix' packages. For documentation, I recommend the "MlmSoftRev" vignette in the "mlmRev" package plus the article by Doug Bates in a recent issue of "R News" on this subject. Vignettes are particularly powerful, because you get both an Adobe Acrobat *.PDF file and a companion script file that you can work through line by line. To see how to do this, I suggest you try something like RSiteSearch("vignette edit") [or RSiteSearch("vignette emacs") if you use (X)Emacs]. To find the suggested Bates article, try "www.r-project.org" -> "Documentation: Newsletter", then download and search the table of contents.> > 3) for the Anova analysis I'd like use a post-hoc comparison between > pairwise classes. What is the right procedure to do this? Is this analysis > performed in R?SG: Try RSiteSearch("post-hoc comparisons").> > Thanks > > Giovanni > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Hello, there is a problem to calculate the following model: model<-aov(Biomass~Beech+Age+Error(Age/Stand)) Warning message: Error() model is singular in: aov(Biomass ~ Beech + Age + Error(Age/Stand)) The summary output is: Error: Age Df Sum Sq Mean Sq Beech 1 142671 142671 Error: Age:Stand Df Sum Sq Mean Sq F value Pr(>F) Beech 1 4042 4042 0.1123 0.7416 Residuals 17 611719 35983 Error: Within Df Sum Sq Mean Sq F value Pr(>F) Beech 1 6244 6244 2.4194 0.1221 Residuals 139 358724 2581 I'm interested in the Age-effect. What is wrong with this model? Additional I've tried to compute an lme with model<-lme(Biomass~Age,random=~1|Age/Stand) anova(model) numDF denDF F-value p-value (Intercept) 1 140 61.17626 <.0001 Age 1 0 2.70482 NaN Warning message: NaNs produced in: pf(q, df1, df2, lower.tail, log.p) This can't be the right way, or? What is wrong? thanks for your ideas. J?rn Buse Lueneburg, Germany -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal f?r Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
Your model model <- aov(Biomass ~ Beech + Age + Error(Age/Stand)) has a redundancy that might be causing the problem. I can't tell without the data. Try tree.aov <- aov(Biomass ~ Beech + Age + Error(Stand %in% Age)) A second potential problem is the class of the variables.>From the degrees of freedom, it looks like Stand is a factor.Since there is only one df for each of Beech and Age, they might be incorrectly interpreted as continuous variables instead of factors. My guess is that they should be multi-degree-of-freedom factors and aren't. Rich
Jorn, For your model, model<-lme(Biomass~Age,random=~1|Age/Stand) think about nesting age in stand (doesn't that makes more sense, anyway ?). If you're lucky the NaN will zip. So, do model <- lme( Biomass ~ Age, random = ~ 1 | Stand/Age I've had a similar problem with unbalanced data when I've tried to nest Season%in%Site (which is what I wanted), with Site as a fixed effect as well. Then, like you, I've got NaN's for my Site(s). Changing the nesting to Site%in%Season has fixed the problem. However, random effects are now being specified somewhat differently. Hopefully a statistician will come in and tell you and me quite what the difference is, because I get lost in the logic of it. Note that lmer() copes with the problematic Season%in%Site nesting without problems, using the same dataset. Regards, Mark ------------------------------------------------------------ Mark DiffordPh.D. candidate, Botany Department, Nelson Mandela Metropolitan University, Port Elizabeth, SA.