Learn R Programming

LogisticDx (version 0.1)

logiDx: Diagnostics for logistic regression

Description

Returns standard diagnostic measures for a logistic regression model by covariate pattern

Usage

logiDx(x, round = FALSE, roundTo = 3)

Arguments

x
A model of class glm
round
If round=TRUE, digits will be ronded to roundTo decimal places
roundTo
No. decimal places to which to round digits

Value

  • A data.table. There is one row per covariate pattern with at least one observation. These are sorted by dBhat (see below). The initial columns give all combinations of the predictor variables with at least one observation. Subsequent columns are labelled as follows:
  • obsNumber of observations with this covariate pattern
  • probProbability of this covariate pattern
  • yhatNumber of observations of $y=1$, predicted by the model
  • yActual number of observations of $y=1$ from the data
  • levLeverage, the diagonal of the hat matrix used to generate the model; a measure of influence of this covariate pattern
  • devRDeviance residual, calculated by covariate pattern; a measure of influence of this covariate pattern
  • PeRPearson residual, calculated by covariate pattern; a measure of influence of this covariate pattern. Given by: $$\sqrt{obs}\sqrt{\frac{prob}{(1-prob)}}$$
  • sPeRStandardized Pearson residual calculated by covariate pattern; a measure of influence of this covariate pattern. Given by: $$\frac{PeR}{\sqrt{(1-lev)}}$$
  • dBhatChange in Bhat, the standardized difference between the original maximum likelihood estimates B and that estimates with this covariate pattern excluded
  • dXsqChange in chi-square, decrease in the value of Pearson chi-square statistic with this covariate pattern excluded. Given by: $$sPeR^2$$
  • dDevChange in deviance D with this covariate pattern excluded. Given by: $$\frac{dev^2}{(1-lev)}$$

See Also

plotLogiDx

Examples

Run this code
d1 <- genLogiDt(model=FALSE)
f1 <- stats::glm(y ~ I(x5^2)*x1 -1, family=binomial("logit"), data=d1)
logiDx(f1)

Run the code above in your browser using DataLab