plot.clarify_setx {clarify} | R Documentation |
Plot marginal predictions from sim_setx()
Description
plot.clarify_sext()
plots the output of sim_setx()
, providing graphics similar to those of plot.clarify_est()
but with features specifically for plot marginal predictions. For continues predictors, this is a plot of the marginal predictions and their confidence bands across levels of the predictor. Otherwise, this is is a plot of simulated sampling distribution of the marginal predictions.
Usage
## S3 method for class 'clarify_setx'
plot(
x,
var = NULL,
ci = TRUE,
level = 0.95,
method = "quantile",
reference = FALSE,
...
)
Arguments
x |
a |
var |
the name of the focal varying predictor, i.e., the variable to be on the x-axis of the plot. All other variables with varying set values will be used to color the resulting plot. See Details. Ignored if no predictors vary or if only one predictor varies in the reference grid or if |
ci |
|
level |
the confidence level desired. Default is .95 for 95% confidence intervals. |
method |
the method used to compute confidence intervals or bands. Can be |
reference |
|
... |
for |
Details
plot()
creates one of two kinds of plots depending on how the reference grid was specified in the call to sim_setx()
and what var
is set to. When the focal varying predictor (i.e., the one set in var
) is numeric and takes on three or more unique values in the reference grid, the produced plot is a line graph displaying the value of the marginal prediction (denoted as E[Y|X]
) across values of the focal varying predictor, with confidence bands displayed when ci = TRUE
. If other predictors also vary, lines for different values will be displayed in different colors. These plots are produced using ggplot2::geom_line()
and ggplot2::geom_ribbon()
When the focal varying predictor is a factor or character or only takes on two or fewer values in the reference grid, the produced plot is a density plot of the simulated predictions, similar to the plot resulting from plot.clarify_est()
. When other variables vary, densities for different values will be displayed in different colors. These plots are produced using ggplot2::geom_density()
.
Marginal predictions are identified by the corresponding levels of the predictors that vary. The user should keep track of whether the non-varying predictors are set at specified or automatically set "typical" levels.
Value
A ggplot
object.
See Also
summary.clarify_est()
for computing p-values and confidence intervals for the estimated quantities.
Examples
## See help("sim_setx") for examples