Plot of Posterior Model Fit Draws
plot_posterior_draws.Rd
A 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
bpfit
object resulting from fitting a BayesPharma model- newdata
data.frame
orNULL
of new data to use for predictions. Default data.frame with each predictor and treatment variable.- treatment_variable
character
orNULL
. IfNULL
the treatment variable name will be looked up in the model. The treatment variable themodel$data
ornewdata
if supplied must have a column corresponding to the treatment variable.- treatment_units
character
orNULL
. IfNULL
the 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
numeric
orNULL
, 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
numeric
orNULL
, 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
string
orNULL
. IfNULL
the response variable name will be looked up in the model. The response variable themodel$data
ornewdata
if supplied must have a column corresponding to the response variable.- response_units
character
orNULL
. IfNULL
the 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
numeric
value 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
logical
give 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")
} # }