remove.terms {buildmer} R Documentation

## Remove terms from an lme4 formula

### Description

Remove terms from an lme4 formula

### Usage

remove.terms(formula, remove)


### Arguments

 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.

### 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)'))
# this is how you do it instead:
step1 <- remove.terms(Reaction ~ Days + (Days|Subject),'(Days|Subject)')
step2 <- remove.terms(step1,'(1|Subject)')


[Package buildmer version 2.5 Index]