logiDx: Diagnostics for logistic regression

Description Usage Arguments Value Note See Also Examples

View source: R/logiDx.R

Description

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

Usage

1
  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:

obs

Number of observations with this covariate pattern

prob

Probability of this covariate pattern

yhat

Number of observations of y=1, predicted by the model

y

Actual number of observations of y=1 from the data

lev

Leverage, the diagonal of the hat matrix used to generate the model; a measure of influence of this covariate pattern

devR

Deviance residual, calculated by covariate pattern; a measure of influence of this covariate pattern

PeR

Pearson residual, calculated by covariate pattern; a measure of influence of this covariate pattern. Given by:

obs^0.5 (prob/1-prob)^0.5

sPeR

Standardized Pearson residual calculated by covariate pattern; a measure of influence of this covariate pattern. Given by:

PeR.(1-lev)^0.5

dBhat

Change in Bhat, the standardized difference between the original maximum likelihood estimates B and that estimates with this covariate pattern excluded

dXsq

Change in chi-square, decrease in the value of Pearson chi-square statistic with this covariate pattern excluded. Given by:

sPeR^2

dDev

Change in deviance D with this covariate pattern excluded. Given by:

d^2/(1-lev)

Note

Values for the statistics are calculated by covariate pattern. Different values may be obtained if calculated for each individual obervation (i.e. row in data frame).

Generally, the values calculated by covariate pattern are preferred, particularly where no. observations are >5.

See Also

plotLogiDx

Examples

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

logisticDx documentation built on May 2, 2019, 6:30 p.m.