epi.cpresids {epiR}R Documentation

Covariate pattern residuals from a logistic regression model

Description

Returns covariate pattern residuals and delta betas from a logistic regression model.

Usage

epi.cpresids(obs, fit, covpattern)

Arguments

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 epi.cp object.

Value

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.

References

Hosmer DW, Lemeshow S (1989). Applied Logistic Regression. John Wiley & Sons, New York, USA, pp. 137 - 138.

See Also

epi.cp

Examples

## 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)
   

[Package epiR version 2.0.38 Index]