Maria Kernecker
2014-Apr-03 13:54 UTC
[R] grouping explanatory variables into "sets" for GLMM
Dear all, I am trying to run a GLMM following the procedure described by Rhodes et al. (Ch. 21) in the Zuur book Mixed effects models and extensions in R . Like in his example, I have four "sets" of explanatory variables: 1. Land use - 1 variable, factor (forest or agriculture) 2. Location - 1 variable, factor (riparian or upland) 3. Agricultural management - 3 variables that are binary (0 or 1 for till, manure, annual crop) 4. Vegetation patterns - 4 variables that are continuous (# of plant species in 4 different functional guilds) How do I create these "sets"? I would like to build my model with these "sets" only instead of listing every variable. Also: is there a way of running all possible models with the different combinations of these sets and/or variables, sort of like running ordistep for ordinations? Thanks a bunch in advance for your help! Maria
Have you read "An Introduction to R" (or other online tutorial)? If not, please do so before posting further here. It sounds like you are missing very basic knowledge -- on factors -- which you need to learn about before proceeding. ?factor gives you the answer you seek, I believe. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." H. Gilbert Welch On Thu, Apr 3, 2014 at 6:54 AM, Maria Kernecker <maria.kernecker at mail.mcgill.ca> wrote:> Dear all, > > I am trying to run a GLMM following the procedure described by Rhodes et al. (Ch. 21) in the Zuur book Mixed effects models and extensions in R . Like in his example, I have four "sets" of explanatory variables: > 1. Land use - 1 variable, factor (forest or agriculture) > 2. Location - 1 variable, factor (riparian or upland) > 3. Agricultural management - 3 variables that are binary (0 or 1 for till, manure, annual crop) > 4. Vegetation patterns - 4 variables that are continuous (# of plant species in 4 different functional guilds) > > How do I create these "sets"? I would like to build my model with these "sets" only instead of listing every variable. > > Also: is there a way of running all possible models with the different combinations of these sets and/or variables, sort of like running ordistep for ordinations? > > Thanks a bunch in advance for your help! > Maria > > ______________________________________________ > R-help at 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.