Plots bayesics objects.
# S3 method for lm_b
plot(
x,
type,
variable,
exemplar_covariates,
combine_pred_cred = TRUE,
variable_seq_length = 30,
return_as_list = FALSE,
CI_level = 0.95,
PI_level = 0.95,
backtransformation = function(x) {
x
},
...
)# S3 method for aov_b
plot(
x,
type = c("diagnostics", "cred band", "pred band"),
combine_pred_cred = TRUE,
return_as_list = FALSE,
CI_level = 0.95,
PI_level = 0.95,
...
)
# S3 method for lm_b_bma
plot(
x,
type = c("diagnostics", "cred band", "pred band"),
variable,
exemplar_covariates,
combine_pred_cred = TRUE,
bayes_pvalues_quantiles = c(0.01, 1:19/20, 0.99),
variable_seq_length = 30,
return_as_list = FALSE,
CI_level = 0.95,
PI_level = 0.95,
seed = 1,
backtransformation = function(x) {
x
},
...
)
# S3 method for glm_b
plot(
x,
type,
variable,
exemplar_covariates,
combine_pred_cred = TRUE,
variable_seq_length = 30,
return_as_list = FALSE,
CI_level = 0.95,
PI_level = 0.95,
seed = 1,
...
)
# S3 method for np_glm_b
plot(
x,
type,
variable,
exemplar_covariates,
variable_seq_length = 30,
return_as_list = FALSE,
CI_level = 0.95,
seed = 1,
backtransformation = function(x) {
x
},
...
)
# S3 method for mediate_b
plot(x, type, return_as_list = FALSE, ...)
# S3 method for survfit_b
plot(x, n_draws = 10000, seed = 1, CI_level = 0.95, ...)
If return_as_list=TRUE, a list of requested ggplots.
A bayesics object
character. Select any of "diagnostics" ("dx" is also allowed),
"pdp" (partial dependence plot), "cred band", and/or "pred band".
NOTE: the credible and prediction bands only work for numeric
variables. If plotting a mediate_b object, the valid
values for type are "diagnostics" (or "dx"), "acme",
or "ade".
character. If type = "pdp" , which variable should be plotted?
data.frame or tibble with exactly one row. Used to fix other covariates while varying the variable of interest for the plot.
logical. If type includes both "cred band" and "pred band", should the credible band be superimposed on the prediction band or plotted separately?
integer. Number of points used to draw pdp.
logical. If TRUE, a list of ggplots will be returned, rather than a single plot produced by the patchwork package.
Posterior probability covered by credible interval
Posterior probability covered by prediction interval
function. If a transformation of
the response variable was used, backtransformation
should be the inverse of this transformation function. E.g.,
if you fit lm_b(log(y) ~ x), then set backtransformation=exp.
optional arguments.
ADD description!
ADD description!
integer. Number of posterior draws used for visualization
of survival curves. Ignored if x is not a survfit_b object.
# \donttest{
set.seed(2025)
N = 500
test_data <-
data.frame(x1 = rnorm(N),
x2 = rnorm(N),
x3 = letters[1:5])
test_data$outcome <-
rnorm(N,-1 + test_data$x1 + 2 * (test_data$x3 %in% c("d","e")) )
fit1 <-
lm_b(outcome ~ x1 + x2 + x3,
data = test_data)
plot(fit1)
# }
Run the code above in your browser using DataLab