Plot of Posterior Model Fit Draws
plot_posterior_draws.RdA plot of a sample of model fit draws from the posterior distribution from the expected mean and median quantile intervals.
Usage
plot_posterior_draws(
model,
newdata = NULL,
treatment_variable = NULL,
treatment_units = NULL,
treatment_from = NULL,
treatment_to = NULL,
response_variable = NULL,
response_units = NULL,
title = "Dose-Response Posterior Draws",
n = 50,
point_size = 0.75,
jitter_height = 0,
jitter_width = 0,
verbose = FALSE
)Arguments
- model
bpfitobject resulting from fitting a BayesPharma model- newdata
data.frameorNULLof new data to use for predictions. Default data.frame with each predictor and treatment variable.- treatment_variable
characterorNULL. IfNULLthe treatment variable name will be looked up in the model. The treatment variable themodel$dataornewdataif supplied must have a column corresponding to the treatment variable.- treatment_units
characterorNULL. IfNULLthe treatment units will be looked up in the model. The treatment units will be used to label the X-axis of the plot.- treatment_from
numericorNULL, for the lower bound on the treatment range. IfNULL, then use the (finite) lower bound of the treatment variable in the model data.- treatment_to
numericorNULL, for the upper bound on the treatment range. IfNULL, then use the (finite) upper bound of the treatment variable in the model data.- response_variable
stringorNULL. IfNULLthe response variable name will be looked up in the model. The response variable themodel$dataornewdataif supplied must have a column corresponding to the response variable.- response_units
characterorNULL. IfNULLthe response units will be looked up in the model. The response units will be used to label the Y-axis of the plot.- title
character name for the plot
- n
numericvalue of the number of draws to show.- point_size
numeric.ggplot2::geom_jitter()point size.- jitter_height
numeric. the height distance between overlapping points.- jitter_width
numeric. the width distance between overlapping points.- verbose
logicalgive verbose output
Value
ggplot2::ggplot object.
Examples
if (FALSE) { # \dontrun{
# Consider a model named my_model and data named my_data with a column
# named predictors containing multiple different perturbations.
plot_posterior_draws(
model = my_model,
newdata = my_data,
lower = -12,
upper = -3,
n = 50,
facet_var = predictors,
jitter_width = 0.10,
title = "Dose-Response Posterior Draws",
xlab = "Log[Molar]",
ylab = "Response")
} # }