[R] Hierarchical glm with binomial family
Johan Stenberg
jonstg at gmail.com
Wed May 27 15:13:42 CEST 2009
Dear members of the R help list,
I want to do a hierarchical glm with binomial family but am unsure
about how to write the syntax which involves nesting.
I want to test whether the risk of being attacked by Herbivores for
Meadowsweet plants is significantly dependent on the Distance to
heterospecific source plants.
Dependent variable = Herbivory (yes/no)
Explanatory continuous variable = Distance to heterospecific source plant
Distance should be nested within Subpopulation which in turn should be
nested within Population.
The number of replicates per subpopulation varies between 8 and 36.
The number of subpopulations per population varies between 4 and 9.
I haven't figured out how to do nesting, but guessing that nesting is
denoted with brackets I guess the syntax should look something like
this (below). Could you please help me to correct this syntax so that
it becomes useful in R?
model<-glm(Herbivory~Distance(Subpopulation(Population)), family=binomial)
Thanks a lot! I deeply appreciate your non-profit engagement!
Johan
More information about the R-help
mailing list