Learn R Programming

clarify (version 0.2.1)

plot.clarify_adrf: Plot marginal predictions from sim_adrf()

Description

plot.clarify_adrf() plots the output of sim_adrf(). For the average dose-response function (ADRF, requested with contrast = "adrf" in sim_adrf()), this is a plot of the average marginal mean of the outcome against the requested values of the focal predictor; for the average marginal effects function (AMEF, requested with contrast = "amef" in sim_adrf()), this is a plot of the instantaneous average marginal effect of the focal predictor on the outcome against the requested values of the focal predictor.

Usage

# S3 method for clarify_adrf
plot(
  x,
  ci = TRUE,
  level = 0.95,
  method = "quantile",
  baseline,
  color = "black",
  ...
)

Value

A ggplot object.

Arguments

x

a clarify_adrf object resulting from a call to sim_adrf().

ci

logical; whether to display confidence bands for the estimates. Default is TRUE.

level

the confidence level desired. Default is .95 for 95% confidence intervals.

method

the method used to compute confidence bands. Can be "wald" to use a Normal approximation or "quantile" to use the simulated sampling distribution (default). See summary.clarify_est() for details. Abbreviations allowed.

baseline

logical; whether to include a horizontal line at y = 0 on the plot. Default is FALSE for the ADRF (since 0 might not be in the range of the outcome) and TRUE for the AMEF.

color

the color of the line and confidence band in the plot.

...

for plot(), further arguments passed to ggplot2::geom_density().

Details

These plots are produced using ggplot2::geom_line() and ggplot2::geom_ribbon(). The confidence bands should be interpreted pointwise (i.e., they do not account for simultaneous inference).

See Also

summary.clarify_est() for computing p-values and confidence intervals for the estimated quantities.

Examples

Run this code
## See help("sim_adrf") for examples

Run the code above in your browser using DataLab