Covariate pattern residuals from a logistic regression model
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.
infert.glm <- glm(case ~ spontaneous + induced, data = infert, family = binomial()) infert.mf <- model.frame(infert.glm) infert.cp <- epi.cp(infert.mf[-1]) infert.obs <- as.vector(by(infert$case, as.factor(infert.cp$id), FUN = sum)) infert.fit <- as.vector(by(fitted(infert.glm), as.factor(infert.cp$id), FUN = min)) infert.res <- epi.cpresids(obs = infert.obs, fit = infert.fit, covpattern = infert.cp)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.