plotSimDiags {DAAG} | R Documentation |
Diagnostic plots for simulated data
Description
This provides diagnostic plots, closely equivalent to those provided by
plot.lm
, for simulated data. By default, simulated data
are for the fitted model. Alternatively, simulated data can be
supplied, making it possible to check the effct of fitting, e.g.,
an AR1 model.
Usage
plotSimDiags(obj, simvalues = NULL, seed = NULL,
types = NULL, which = c(1:3, 5), layout = c(4, 1), qqline=TRUE,
cook.levels = c(0.5, 1), caption = list("Residuals vs Fitted",
"Normal Q-Q", "Scale-Location", "Cook's distance", "Residuals vs Leverage",
expression("Cook's dist vs Leverage " * h[ii]/(1 - h[ii]))),
...)
Arguments
obj |
Fitted model object - |
simvalues |
Optional matrix of simulated data. |
seed |
Random number seed - set this to make results repeatable. |
types |
If set, this should be a list with six elements, ordinarily with
each list element either |
which |
Set to be a subset of the numbers 1 to 6, as for |
layout |
Controls the number of simulations and the layout of the plots.
For example |
qqline |
logical: add line to normal Q-Q plot |
cook.levels |
Levels of Cook's statistics for which contours are to be plotted. |
caption |
list: Captions for the six graphs |
... |
Other parameters to be passed to plotting functions |
Details
Diagnotic plots from repeated simulations from the fitted model provide a useful indication of the range of variation in the model diagnistics that are consistent with the fitted model.
Value
A list of lattice graphics objects is returned, one for each value of
which
. List elements for which a graphics object is not
returned are set to NULL. Or if which
is of length 1,
a lattice graphics object.
residVSfitted |
Residuals vs fitted |
normalQQ |
Normal quantile-quantile plot |
scaleVSloc |
Scale versus location |
CookDist |
Cook's distance vs observation number |
residVSlev |
Standardized residuals (for GLMs, standardized Pearson residuals) vs leverage |
CookVSlev |
Cook's distance vs leverage |
For the default which=c(1:3,5)
, list items 1, 2, 3 and 5 above
contain graphics objects, with list elements 4 and 6 set to NULL
.
Note
The graphics objects contained in individual list elements can be
extracted for printing, or updating and printing, as required.
If the value is returned to the command line, list elements that
are not NULL
will be printed in turn.
Author(s)
John Maindonald, with some code chunks adapted from plot.lm
References
See plot.lm
See Also
Examples
women.lm <- lm(height ~ weight, data=women)
gphlist <- plotSimDiags(obj=women.lm, which=c(1:3,5))