This is a wrapper function for plot_er() with default options for
goodness-of-fit (GOF) plots for ER models.
plot_er_gof(
x,
add_boxplot = !is.null(var_group),
boxplot_height = 0.15,
show_boxplot_y_title = FALSE,
var_group = NULL,
n_bins = 4,
qi_width_obs = 0.95,
show_coef_exp = FALSE,
coef_pos_x = NULL,
coef_pos_y = NULL,
coef_size = 4,
qi_width_coef = 0.95,
qi_width_sim = 0.95,
show_caption = TRUE
)A ggplot object
an object of class ermod, ersim,ersim_med_qi,
or their subclasses
Logical, whether to add a boxplot of exposure values.
Default is TRUE if var_group is specified, otherwise FALSE.
Height of the boxplot relative to the main plot.
Default is 0.15.
Logical, whether to show the y-axis title
for the boxplot. Default is FALSE.
The column to use for grouping data for plotting.
If specified, observed data points and boxplot will be grouped
and colored by this column. Default is NULL.
Number of bins to use for observed probability
summary. Only relevant for binary models. Default is 4.
Confidence level for the observed probability
summary. Default is 0.95.
Logical, whether to show the credible interval
of the exposure coefficient. Default is FALSE. This is only available
for linear and linear logistic regression models.
x-coordinate of the text label. If NULL (default), it is
set to the minimum value for the exposure variable.
y-coordinate of the text label. If NULL (default), it is
set to 0.9 for logistic regression models and the maximum value of the
response variable in the original data for linear regression models.
Size of the text label. Default is 4.
Width of the credible interval for the exposure
coefficient. Default is 0.95.
Width of the quantile interval to summarize simulated
draws. Default is 0.95.
Logical, whether to show the caption note for the
plot. Default is TRUE.
The following code will generate the same plot:
plot_er(
x,
show_orig_data = TRUE,
show_coef_exp = show_coef_exp,
show_caption = show_caption,
options_orig_data = list(
add_boxplot = add_boxplot, boxplot_height = boxplot_height,
show_boxplot_y_title = show_boxplot_y_title,
var_group = var_group,
n_bins = n_bins, qi_width = qi_width_obs
),
options_coef_exp = list(
qi_width = qi_width_coef, pos_x = coef_pos_x, pos_y = coef_pos_y,
size = coef_size
),
options_caption = list(
orig_data_summary = TRUE, coef_exp = show_coef_exp
),
qi_width_sim = qi_width_sim
)
data(d_sim_binom_cov_hgly2)
ermod_bin <- dev_ermod_bin(
data = d_sim_binom_cov_hgly2,
var_resp = "AEFLAG",
var_exposure = "AUCss_1000"
)
plot_er_gof(ermod_bin, var_group = "Dose_mg", show_coef_exp = TRUE)
Run the code above in your browser using DataLab