remove.terms {buildmer} | R Documentation |
Remove terms from a formula
Description
Remove terms from a formula
Usage
remove.terms(formula, remove, check = TRUE)
Arguments
formula |
The formula. |
remove |
A vector of terms to remove. To remove terms nested inside random-effect groups, use ‘(term|group)’ syntax. Note that marginality is respected, i.e. no effects will be removed if they participate in a higher-order interaction, and no fixed effects will be removed if a random slope is included over that fixed effect. |
check |
A logical indicating whether effects should be checked for marginality. If |
Examples
library(buildmer)
remove.terms(Reaction ~ Days + (Days|Subject),'(Days|Subject)')
# illustration of the marginality checking mechanism:
# this refuses to remove the term:
remove.terms(Reaction ~ Days + (Days|Subject),'(1|Subject)')
# so does this, because marginality is checked before removal:
remove.terms(Reaction ~ Days + (Days|Subject),c('(Days|Subject)','(1|Subject)'))
# but it works with check=FALSE
remove.terms(Reaction ~ Days + (Days|Subject),'(1|Subject)',check=FALSE)
[Package buildmer version 2.11 Index]