Maureen Ryan
2010-Jul-20 19:16 UTC
[R] logistic regression with repeated measures for species-habitat associations
Hi, I have three years of species presence/absence data for a set of ~100 ponds, with a list of associated habitat characteristics (park, vegetation, hydroperiod, etc.). The datasets differ slightly by year because some ponds were dry in some years and not in others. My goal is to look at habitat associations for a couple focal species. For each year, I have a data table that looks like (an expanded version of) this: pond park hydroperiod elevation veg.cover fish odonate beetle bullfrog newt tiger.sal . . . etc. 1 DV perennial 536 25 1 1 1 1 0 0 2 DV perennial 722 0 0 1 1 0 1 1 3 SN perennial 643 30 0 1 1 0 1 0 4 SN seasonal 1238 0 1 1 1 0 0 0 5 SN seasonal 2406 90 0 1 1 1 0 1 . . . etc. So far I've analyzed each year individually using (example for 2004): newts2004 <- glm(newts ~ ., data=ponds2004, family="binomial") step(newts2004) I'd like to do a holistic analysis for all three years but am unclear how to do logistic regression with repeated measures in R. Also not sure if missing data (from dry ponds) will be a problem. Thanks very much for any advice. Cheers, Maureen [[alternative HTML version deleted]]
Ben Bolker
2010-Jul-20 22:30 UTC
[R] logistic regression with repeated measures for species-habitat associations
Maureen Ryan <meryan <at> ucdavis.edu> writes:> > Hi, > I have three years of species presence/absence data for a set of ~100 > ponds, with a list of associated habitat characteristics (park, vegetation, > hydroperiod, etc.). The datasets differ slightly by year because some ponds > were dry in some years and not in others. My goal is to look at habitat > associations for a couple focal species. > > For each year, I have a data table that looks like (an expanded version of) > this: >[snip] Maureen, I think this is a generalized linear mixed model with binary outcomes, with fixed effects for the habitat variables, year, and (possibly) the interaction of habitat by year, and with ponds as random effects. I would recommend either lmer (in the lme4 package) or MCMCglmm (in the package of the same name), and I might recommend also that you visit the r-sig-mixed-models mailing list with additional questions ... Missing data should not be a big problem. Ben Bolker