plot_er {BayesERtools} | R Documentation |
Plot ER model simulations
Description
Plot ER model simulations
Usage
plot_er(x, ...)
## S3 method for class 'ersim_med_qi'
plot_er(
x,
show_orig_data = FALSE,
show_coef_exp = FALSE,
show_caption = FALSE,
options_orig_data = list(),
options_coef_exp = list(),
options_caption = list(),
...
)
## S3 method for class 'ersim'
plot_er(
x,
show_orig_data = FALSE,
show_coef_exp = FALSE,
show_caption = FALSE,
options_orig_data = list(),
options_coef_exp = list(),
options_caption = list(),
qi_width_sim = 0.95,
...
)
## S3 method for class 'ermod'
plot_er(
x,
show_orig_data = FALSE,
show_coef_exp = FALSE,
show_caption = FALSE,
options_orig_data = list(),
options_coef_exp = list(),
options_caption = list(),
n_draws_sim = if (marginal) 200 else NULL,
seed_sample_draws = NULL,
marginal = FALSE,
exposure_range = NULL,
num_exposures = 51,
qi_width_sim = 0.95,
...
)
Arguments
x |
an object of class |
... |
currently not used |
show_orig_data |
logical, whether to show the data points in the
model development dataset. Default is |
show_coef_exp |
logical, whether to show the credible interval
of the exposure coefficient. Default is |
show_caption |
logical, whether to show the caption note for the plot.
Default is |
options_orig_data |
List of options for configuring how original data is displayed. Possible options include:
|
options_coef_exp |
List of options for configuring how the exposure coefficient credible interval is displayed. Possible options include:
|
options_caption |
List of options for configuring the caption note. Possible options include:
|
qi_width_sim |
Width of the quantile interval to summarize simulated draws. |
n_draws_sim |
Number of draws to simulate response for each exposure value. Set to NULL to use all draws in the model object. Default is NULL unless marginal is set to TRUE (in that case 200 by default to reduce computation time). |
seed_sample_draws |
Seed for sampling draws. Default is NULL. |
marginal |
logical, whether to use marginal ER simulation. Default
to |
exposure_range |
Only relevant when the input x is an |
num_exposures |
Only relevant as with |
Details
Plotting with ermod
is done with some default values. If they are not
suitable, you can always perform the simulation manually and use
plot_er()
on the simulated data.
Value
A ggplot object
Examples
data(d_sim_binom_cov_hgly2)
ermod_bin <- dev_ermod_bin(
data = d_sim_binom_cov_hgly2,
var_resp = "AEFLAG",
var_exposure = "AUCss_1000"
)
ersim_med_qi <- sim_er_curve(
ermod_bin,
output_type = "median_qi"
)
plot_er(ersim_med_qi, show_orig_data = TRUE) +
# Use log10 scale for exposure
xgxr::xgx_scale_x_log10(guide = ggplot2::guide_axis(minor.ticks = TRUE))