## EXAMPLE 1:
dat.glm01 <- glm(case ~ spontaneous + induced, family = binomial(),
data = infert)
## Covariate patterns:
dat.mf01 <- model.frame(dat.glm01)
dat.cp01 <- epi.cp(dat.mf01[-1])
dat.obs01 <- as.vector(by(infert$case, as.factor(dat.cp01$id),
FUN = sum))
dat.fit01 <- as.vector(by(fitted(dat.glm01), as.factor(dat.cp01$id),
FUN = min))
dat.cpr01 <- epi.cpresids(obs = dat.obs01, fit = dat.fit01,
covpattern = dat.cp01)
head(dat.cpr01)
Run the code above in your browser using DataLab