SILVIA DIAZ FERNANDEZ <Silvia.Diaz <at> uclm.es> writes: > > Hi! > > I am trying to know which habitat variables most affect > bird counts in a radius of 100m. I obtained bird > counts in 2751 spatial points, and measured percentage of > 21 habitat variables in these points. > > I applied a mixed model using the "lmer" function to these data, > but I do not know how to select the best model > using AIC here. Is there a way to do this automatically with R? >
See the MuMIn package, and the "dredge" function. e.g.: library(MuMIn) library(lme4) example(lmer) dredge(fm1) **however**: if you have 21 habitat variables and want to consider all subsets of main effects only, you will have something like 2^21 approx. 2 million models to consider. Probably a bad idea. I would strongly recommend that you consider some sort of dimension reduction (e.g. take the first few PCAs of the habitat predictors) first. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.