plot_models {RoBSA} | R Documentation |
Models plot for a RoBSA object
Description
plot_models
plots individual models'
estimates for a "RoBSA"
object.
Usage
plot_models(
x,
parameter = NULL,
conditional = FALSE,
plot_type = "base",
order = "decreasing",
order_by = "model",
...
)
Arguments
x |
a fitted RoBSA object |
parameter |
a name of parameter to be plotted. Defaults to the first regression parameter if left unspecified. |
conditional |
whether conditional estimates should be
plotted. Defaults to |
plot_type |
whether to use a base plot |
order |
how the models should be ordered.
Defaults to |
order_by |
what feature should be use to order the models.
Defaults to |
... |
list of additional graphical arguments
to be passed to the plotting function. Supported arguments
are |
Value
plot_models
returns either NULL
if plot_type = "base"
or an object object of class 'ggplot2' if plot_type = "ggplot2"
.
Examples
## Not run:
# (execution of the example takes several minutes)
# example from the README (more details and explanation therein)
data(cancer, package = "survival")
priors <- calibrate_quartiles(median_t = 5, iq_range_t = 10, prior_sd = 0.5)
df <- data.frame(
time = veteran$time / 12,
status = veteran$status,
treatment = factor(ifelse(veteran$trt == 1, "standard", "new"), levels = c("standard", "new")),
karno_scaled = veteran$karno / 100
)
RoBSA.options(check_scaling = FALSE)
fit <- RoBSA(
Surv(time, status) ~ treatment + karno_scaled,
data = df,
priors = list(
treatment = prior_factor("normal", parameters = list(mean = 0.30, sd = 0.15),
truncation = list(0, Inf), contrast = "treatment"),
karno_scaled = prior("normal", parameters = list(mean = 0, sd = 1))
),
test_predictors = "treatment",
prior_intercept = priors[["intercept"]],
prior_aux = priors[["aux"]],
parallel = TRUE, seed = 1
)
# plot posterior distribution of the treatment effect from each model
plot_models(fit, parameter = "treatment")
## End(Not run)