View source: R/maximal.glmer.R
maximal.glmer | R Documentation |
Determine the call for a glmer
model with the maximal random effects
structure for a prototypical psycholinguistic design with a factorial
experimental design and with subjects and items as (crossed or partially
crossed) random effects.
maximal.glmer( data, outcome, subjects = "Subject", items = "Item", ivs = NULL, within.subjects = NULL, within.items = NULL, fit.model = FALSE, ... )
data |
a data frame containing the data to be fit with the model. |
outcome |
the name of the column containing the outcome variable (i.e., the dependent variable in an experimental study). |
subjects |
the name of the column containing the subject names or subject numbers. |
items |
the name of the column containing the item names or item numbers |
ivs |
the name(s) of the columns containing the independent or predictor variables (excluding the subjects and items). |
within.subjects |
the names of the IV columns, if any, that are within-subjects variables (i.e., each subject sees more than one level of this variable). |
within.items |
the names of the IV columns, if any, that are within-item variables (i.e., each subject sees more than one level of this variable). |
fit.model |
logical - should the model actually be fit, or should the function merely return a string describing the model call? |
... |
additional arguments to |
This function is only applicable to the set of designs in which there are exactly two sampling units (subjects and items) and all of the variables are factorially crossed. Although such designs are common in psycholinguistics, many other designs are certainly possible and are also valid applications of linear mixed effects models (merely outside the purview of this function).
In addition, the maximal random effects structure may or may not be appropriate for the particular dataset or analytic question (e.g., the model may be overparameterized). This function is provided simply to help beginning users understand how the model call relates to the experimental design and as a shortcut for when a maximal random effects structure is known to be desired.
either a model of class merMod
or a string containing
an glmer
function call that could be used to fit that model.
Barr, D.J., Levy, R., Scheepers, C., & Tily, H.J. (2013). Random effects structure for confirmatory hypothesis testing: Keep it maximal. Journal of Memory and Language, 68, 255-278.
maximal.lmer
for normal (Gaussian) linear mixed
effects models.
maximal.glmer(data=my.dataframe, outcome='RT', subjects='Subject', items='Items', ivs=c('SentenceType', 'PrimeType'), within.subjects=c('SentenceType', 'PrimeType'), within.items='PrimeType', fit.model=FALSE, family=binomial)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.