plotLogiDx: Diagnostic plots for a logistic regression

Description Usage Arguments Value Note Examples

View source: R/plotLogiDx.R

Description

Common diagnostic plots for a logistic regression model

Usage

1
2
3
4
  plotLogiDx(x, noPerPage = 6,
    cols = c("deepskyblue", "dodgerblue"), cex = 2,
    pch = 21, inches = 0.25, identify = FALSE,
    extras = FALSE, width = NULL, height = NULL)

Arguments

x

A logistic regression model of class glm

noPerPage

Number of plots per page (for initial plots). Will be used as guidance and optimised for ease of display

cols

Colours. As used by graphics::points

cex

Cex Character expansion. See
?graphics::plot.default

pch

Plotting character. See
?graphics::points

inches

Width of circles for bubble plot. See
?graphics::symbols

identify

If TRUE will give option to identify individual points on a number of the plots produced.
The number which appears next to the point corresponds to the relevant row as given by logiGOF

extras

If TRUE produces additional plots, detailed below

width

Width of screen(display device) in pixels

height

Height of screen(display device) in pixels

Value

The following are plotted, for each covariate group:

p_X_lev

Probability of y=1 for this group by leverage (diagonal of hat matrix, a measure of influence)

p_X_dXsq

Probability as above by dXsq change in Pearson chi-square statistic with deletion of this group

p_X_dBhat

Probability by dBhat change in Bhat; the difference in the maximum likelihood estimators Beta for model coefficients with all subjects included vs those with this group, standardized by the estimated covariance matrix of Beta

p_X_dDev

Probability by dDev, the change in deviance when this group is excluded

bubbleplot

Probability by dXsq, with area of circle proportional to dBhat

lev_X_dXsq

Leverage by dXsq, the change in the Pearson chi-square statistic when this group is excluded

lev_X_dBhat

Leverage by dBhat, the difference in the maximum likelihood estimators Beta for model coefficients with all subjects included vs those when this group is excluded. This is standardized by the estimated covariance matrix of Beta

lev_X_dDev

Leverage by dDev, the change in deviance when this group is excluded

ROC

Receiver Operator Curve

Additional plots are given when extras=TRUE:

influenceplot

See
?car::influencePlot

sr_X_hat

Studentized residual by hat values. Studentized residual = residual / estimate of standard deviation of residual

slp

Spread-level plot. See
from ?car::spreadLevelPlot

qqPlot

quantile-quantile plot vs Normal for residuals. See
?stats::qqplot

iip

Influence-index plot. Gives Cooks distance, studentized residual and hat values for each observation

pairs

Pairs plot for the measures of influence dBhat, dXsq and dDev. See
?graphics::pairs

crPlots

Component + residual plots. See
?car::crPlots

avPlots

Added-variable plots. See
?car::avPlots

mmps

Marginal model plots. These require that the data.frame used to fit the model be present in the current environment. See
?car::mmps

Note

Different colors can be found with e.g.
grDevices::colours()[grep("blue",grDevices::colours())]

Examples

1
2
3
4
5
6
7
8
set.seed(1)
### generate up to 8x covariate patterns
mod1 <- genLogiDf(b=3, f=0, c=0, n=50)$model
plotLogiDx(mod1, cex=8, noPerPage=1)
plotLogiDx(mod1, cex=3, noPerPage=6, extras=TRUE)
df1 <- genLogiDf(b=0,f=0,c=2,n=50, model=FALSE)
g1 <- glm(y ~ ., family=binomial("logit"), data=df1)
plotLogiDx(g1)

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