GLMER | R Documentation |
Fit a generalized linear mixed-effects model with a fixed model structure
GLMER(modelData,responseVar,fitFamily,fixedStruct,
randomStruct,saveVars=character(0),REML=TRUE,
optimizer="bobyqa",maxIters=10000)
modelData |
A data frame containing the response variable, and all fixed and random effects in the specified model structure |
responseVar |
The response variable to fit in the model |
fitFamily |
The family to use for the generalized linear mixed effects model |
fixedStruct |
The fixed effects to include, in the format of a glmer model-call |
randomStruct |
The random effects to include, in the format of a glmer call |
saveVars |
Any variables in the original data frame to retain in the model data frame for later analysis |
REML |
Whether to use Restricted Maximum Likelihood for fitting the model. Alternative is simple maximum likelihood. Default is to use REML |
optimizer |
The GLMER optimizer to use. Options are 'bobyqa' (the default) and 'Nelder_Mead' |
maxIters |
The maximum number of iterations to allow by the optimizer (default is 10,000) |
model: the model
data: the dataset used in to fit the model, i.e. a subset of the original data frame, containing only the variables fit in the model, variables specified to be saved, and with any rows containing NA values removed
Tim Newbold <t.newbold@ucl.ac.uk>
# Load example data (site-level effects of land use on biodiversity from the PREDICTS database)
data(PREDICTSSiteData)
# Run a model of log-transformed total abundance as a function of land use, human population density
# and distance to nearest road (with an interaction between human population density
# and road distance)
m1 <- GLMER(modelData = PREDICTSSites,responseVar = "LogAbund",fitFamily = "gaussian",
fixedStruct = "LandUse+poly(logHPD.rs,2)+poly(logDistRd.rs,2)+poly(logHPD.rs,2):poly(logDistRd.rs,2)",
randomStruct = "(1|SS)+(1|SSB)",REML = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.