checkLogReg: Logistic regression model checks

Description Usage Arguments Value Author(s) References See Also Examples

Description

checkLogReg is a wrapper of other functions (auc, binnedplot, gfitLogReg) to perform several tests and plots of goodness of fit and residuals from a logistic regression model

Usage

1
checkLogReg(obs, pred, covs = NULL, ...)

Arguments

obs

numeric vector with observations (either 0 or 1)

pred

numeric vector (same length as obs) with fitted model probabilities

covs

Optional. A named list of one or more numeric vectors that were used as covariates in the model

...

further arguments passed to gfitLogReg, such as groups number of bins or print.table Logical. Print table with numeric results or just make a plot? Default is FALSE.

Value

several plots and quantities

Author(s)

Paco

References

Gelman & Hill (2007)

See Also

binnedplot, plotCalibration, auc

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Generate some data
x <- seq(1:1000)
yhat <- plogis(0.2 + 0.003*x)   # inverse logit
y <- rbinom(1000, 1, yhat)

# Fit model and get predicted probabilities
model <- glm(y~x, family="binomial")
ypred <- predict(model, type="response")

checkLogReg(y, ypred)
checkLogReg(y, ypred, covs=list(predictor=x))

Pakillo/pacotools documentation built on May 7, 2019, 11:56 p.m.