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)

Try the lme4 package in your browser

Any scripts or data that you put into this service are public.

lme4 documentation built on Nov. 5, 2023, 9:06 a.m.