| plot | R Documentation |
Plots bayesics objects.
## S3 method for class '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 class '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 class '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 class '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 class '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 class 'mediate_b'
plot(x, type, return_as_list = FALSE, ...)
## S3 method for class 'survfit_b'
plot(x, n_draws = 10000, seed = 1, CI_level = 0.95, ...)
x |
A bayesics object |
type |
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 |
variable |
character. If type = "pdp" , which variable should be plotted? |
exemplar_covariates |
data.frame or tibble with exactly one row. Used to fix other covariates while varying the variable of interest for the plot. |
combine_pred_cred |
logical. If type includes both "cred band" and "pred band", should the credible band be superimposed on the prediction band or plotted separately? |
variable_seq_length |
integer. Number of points used to draw pdp. |
return_as_list |
logical. If TRUE, a list of ggplots will be returned, rather than a single plot produced by the patchwork package. |
CI_level |
Posterior probability covered by credible interval |
PI_level |
Posterior probability covered by prediction interval |
backtransformation |
function. If a transformation of
the response variable was used, |
... |
optional arguments. |
bayes_pvalues_quantiles |
ADD description! |
seed |
ADD description! |
n_draws |
integer. Number of posterior draws used for visualization
of survival curves. Ignored if |
If return_as_list=TRUE, a list of requested ggplots.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.