plot.distfreereg {distfreereg} | R Documentation |
Summary and diagnostic plots for distfreereg
objects
Description
This is a plot
method for objects of class distfreereg
. It automates the creation of three summary and diagnostic plots for distfreereg
objects. See the Plotting with the distfreereg
Package vignette for examples.
Usage
## S3 method for class 'distfreereg'
plot(x, which = "dens", stat = NULL, density_args = NULL, polygon_args = NULL,
confband_args = NULL, abline_args = NULL, shade_col = rgb(1,0,0,0.5),
text_args = NULL, ...)
Arguments
x |
Object of class |
which |
Character string. Acceptable values are "
|
stat |
Character vector of length one specifying the name of the statistic to plot
when |
density_args |
An optional list of arguments to pass to |
polygon_args |
An optional list of arguments to pass to |
confband_args |
An optional list of values that control the calculation and plotting of confidence bands. Any of the following named elements are allowed.
Setting equal to |
abline_args |
An optional list of arguments to pass to |
shade_col |
Character string or other value specifying the color to use to shade the upper tail of the distribution. Default value is red with 50% transparency. This is a convenience argument, and the same functionality is available by defining a |
text_args |
An optional list of arguments to pass to |
... |
Additional arguments to pass to |
Details
This function produces one of three specified plots, depending on the value of which
.
When which
is "dens
", a plot of the estimated density of the simulated statistics is produced, including a vertical line at the value of the observed test statistic with the p-value displayed.
The default placement of the p-value text is on the left side of the line indicating the statistic value. Specifically, the default values of x
and y
passed to text
are the statistic value itself and the midpoint between zero and the maximum value of the density curve. The default value passed to adj
is c(1,0.5)
, meaning that the text is aligned to the left of the value (x,y)
and centered vertically on it. (The default value for the text itself, which can be modified via the label
argument of text
, includes a space on the left and the right for padding so the text does not overlap the vertical line itself.) To align the text so it appears on the right side (for example, to avoid overlapping the density curve), use text_args = list(adj = c(0,0.5))
. See documentation for text
for details on this and other arguments.
When which
is "residuals
", a time-series-like plot is produced showing transformed residuals in the order given by x$res_order
. In the case that the null hypothesis is rejected, this plot can help determine where (in terms of the linearly ordered covariates) a discrepancy between the model and the data occurs.
When which
is "epsp
", a plot of the empirical partial sum process is produced; that is, the y
-values are
y_j = {1\over\sqrt{n}}\sum_{i=1}^j\hat e_i
where \hat e_i
is the i
th transformed residual in the order given by x$res_order
. Similar to the case when which
is "residuals
", this plot can help determine where (in terms of the linearly ordered covariates) a discrepancy between the model and the data occurs.
Value
When which
is "dens
", the values used to create the density plot are returned invisibly in a list with two named elements, x
and y
. If the confidence band is plotted, then it is included as an element named confband
.
For other values of which
, nothing is returned.
Author(s)
Jesse Miller
References
Flegal, James M. et al. Simultaneous confidence bands for (Markov chain) Monte Carlo simulations, forthcoming.