epi.cpresids | R Documentation |
Returns covariate pattern residuals and delta betas from a logistic regression model.
epi.cpresids(obs, fit, covpattern)
obs |
a vector of observed values (i.e., counts of ‘successes’) for each covariate pattern). |
fit |
a vector defining the predicted (i.e., fitted) probability of success for each covariate pattern. |
covpattern |
a |
A data frame with 13 elements: cpid
the covariate pattern identifier, n
the number of subjects in this covariate pattern, obs
the observed number of successes, pred
the predicted number of successes, raw
the raw residuals, sraw
the standardised raw residuals, pearson
the Pearson residuals, spearson
the standardised Pearson residuals, deviance
the deviance residuals, leverage
leverage, deltabeta
the delta-betas, sdeltabeta
the standardised delta-betas, and deltachi
delta chi statistics.
Hosmer DW, Lemeshow S (1989). Applied Logistic Regression. John Wiley & Sons, New York, USA, pp. 137 - 138.
epi.cp
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.