tests/drop1contrasts.R

## drop1 may not work right with contrasts: make up an example something like this ...
## options(contrasts=c("contr.sum","contr.poly"))
## drop1(fecpoiss_lm3,test="Chisq",scope=.~.)


if (.Platform$OS.type != "windows") withAutoprint({
    library(lme4)
    oldopts <- options(contrasts=c("contr.sum","contr.poly"))
    fm1 <- lmer(Reaction~Days+(Days|Subject),data=sleepstudy)
    drop1(fm1,test="Chisq")
    ## debug(lme4:::drop1.merMod)
    drop1(fm1,test="Chisq",scope=.~.)

    fm0 <- lm(Reaction~Days+Subject,data=sleepstudy)
    drop1(fm0,test="Chisq",scope=.~.)
    options(oldopts)  ## restore original contrasts

    ff <- function() {
        lmer(Reaction~Days+(Days|Subject),data=sleepstudy)
    }
    drop1(ff())  ## OK because sleepstudy is accessible!

}) ## skip on windows (for speed)
lme4/lme4 documentation built on April 19, 2024, 10:30 a.m.