Description Usage Arguments Value Note Examples
Standard diagnostic plots.
1 2 3 4 5 |
x |
A regression model with class |
y |
Not used. Present for compatibility with
generic |
... |
Additional arguments, which can be
passed to the plotting functions. See:
|
toPdf |
|
file |
Filename if writing to |
palette |
Palette of colors to use as the
'fill'/ 'background' colors for the plots.
|
usePalette |
Use the colorscheme in palette above.
|
bg |
The 'fill' or background color(s) to use, if
|
col |
The 'edge' or 'foreground' color used
to outline points in the plot.
|
alpha |
Transparency for colors above.
|
cex |
Character expansion.
|
pch |
Plotting character.
|
cex.main |
Character expansion for the plot title and the labels for the axes. |
inches |
Width of circles for the bubble plot. See
|
identify |
If |
devNew |
If |
There is one point per observation.
The following show probability P[i] on the x-axis:
P[i] vs. h[i] |
Probability vs. leverage. |
P[i] vs. dChisq[i] |
Probability vs. the change in the standardized Pearsons chi-squared with observation i excluded. |
P[i] vs. dDev[i] |
Probability vs. the change in the standardized deviance with observation i excluded. |
P[i] vs. dBhat[i] |
Probability vs. the change in the standardized maximum likelihood estimators of the model coefficients with observation i excluded. |
P[i] vs. dChisq[i] |
Bubbleplot of
probability vs. the change in the standardized
Pearsons chi-squared
with observation i excluded.
A[i] = pi r[i]^2, r[i] = (dBhat[i] / P[i])^0.5 For details see:
|
The following show leverage h[i] on the x-axis:
h[i] vs. dChisq[i] |
Leverage vs. the change in the standardized Pearsons chi-squared with observation i excluded. |
h[i] vs. dDev[i] |
Leverage vs. the change in the standardized deviance with observation i excluded. |
h[i] vs. dBhat[i] |
Leverage vs. the change in the standardized maximum likelihood estimators of the model coefficients with observation i excluded. |
The correlation of
dChisq, dDev and dBhat.
is shown in a pairs
plot. See:
?graphics::pairs
The Value of dx
is also returned, invisibly.
A choice of colors can be found with e.g.
grDevices::colours()[grep("blue", grDevices::colours())]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## H&L 2nd ed. Table 4.9. Figures 5.5-5.8. Pages 177-180.
data(uis)
uis <- within(uis, {
NDRGFP1 <- 10 / (NDRGTX + 1)
NDRGFP2 <- NDRGFP1 * log((NDRGFP1 + 1) / 10)
})
summary(g1 <- glm(DFREE ~ AGE + NDRGFP1 + NDRGFP2 + IVHX +
RACE + TREAT + SITE +
AGE:NDRGFP1 + RACE:SITE,
family=binomial, data=uis))
plot(g1)
## H&L. Similar to Figure 5.3.
set.seed(133)
(g1 <- glm(sample(c(0, 1), size=100,
replace=TRUE, prob=c(0.5, 0.5))
~ 0 + I(0.08 * rnorm(n=100, mean=0, sd=sqrt(9))),
family=binomial))$coef # approx. 0.8
plot(g1)
|
Call:
glm(formula = DFREE ~ AGE + NDRGFP1 + NDRGFP2 + IVHX + RACE +
TREAT + SITE + AGE:NDRGFP1 + RACE:SITE, family = binomial,
data = uis)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.3036 -0.7914 -0.5783 0.9902 2.6024
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -6.607764 1.177521 -5.612 2.00e-08 ***
AGE 0.116601 0.028859 4.040 5.34e-05 ***
NDRGFP1 0.690191 0.209629 3.292 0.000993 ***
NDRGFP2 -0.461492 0.123824 -3.727 0.000194 ***
IVHXprevious -0.633915 0.298774 -2.122 0.033862 *
IVHXrecent -0.705257 0.261631 -2.696 0.007026 **
RACEother 0.686261 0.264195 2.598 0.009389 **
TREATlong 0.433709 0.203791 2.128 0.033320 *
SITEB 0.516694 0.254937 2.027 0.042688 *
AGE:NDRGFP1 -0.015260 0.006026 -2.532 0.011329 *
RACEother:SITEB -1.431087 0.529872 -2.701 0.006917 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 653.73 on 574 degrees of freedom
Residual deviance: 597.92 on 564 degrees of freedom
AIC: 619.92
Number of Fisher Scoring iterations: 4
dev.new(): using pdf(file="Rplots1.pdf")
dev.new(): using pdf(file="Rplots2.pdf")
dev.new(): using pdf(file="Rplots3.pdf")
dev.new(): using pdf(file="Rplots4.pdf")
dev.new(): using pdf(file="Rplots5.pdf")
dev.new(): using pdf(file="Rplots6.pdf")
I(0.08 * rnorm(n = 100, mean = 0, sd = sqrt(9)))
0.8093208
dev.new(): using pdf(file="Rplots7.pdf")
dev.new(): using pdf(file="Rplots8.pdf")
dev.new(): using pdf(file="Rplots9.pdf")
dev.new(): using pdf(file="Rplots10.pdf")
dev.new(): using pdf(file="Rplots11.pdf")
dev.new(): using pdf(file="Rplots12.pdf")
dev.new(): using pdf(file="Rplots13.pdf")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.