Remove terms from an lme4 formula
Remove terms from an lme4 formula
remove.terms(formula, remove)
formula |
The lme4 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. |
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)')) # this is how you do it instead: step1 <- remove.terms(Reaction ~ Days + (Days|Subject),'(Days|Subject)') step2 <- remove.terms(step1,'(1|Subject)')
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.