plot.RoBSA {RoBSA} | R Documentation |
Plots a fitted RoBSA object
Description
plot.RoBSA
allows to visualize
posterior distribution of different "RoBSA"
object
parameters. See plot_survival
for plotting the survival
ways. See type
for the different model types.
Usage
## S3 method for class 'RoBSA'
plot(
x,
parameter = NULL,
conditional = FALSE,
plot_type = "base",
prior = FALSE,
dots_prior = NULL,
...
)
Arguments
x |
a fitted RoBSA object |
parameter |
a name of parameter to be plotted. Defaults to
the first regression parameter if left unspecified. Use
|
conditional |
whether conditional estimates should be
plotted. Defaults to |
plot_type |
whether to use a base plot |
prior |
whether prior distribution should be added to
figure. Defaults to |
dots_prior |
list of additional graphical arguments
to be passed to the plotting function of the prior
distribution. Supported arguments are |
... |
list of additional graphical arguments
to be passed to the plotting function. Supported arguments
are |
Value
plot.RoBSA
returns either NULL
if plot_type = "base"
or an object object of class 'ggplot2' if plot_type = "ggplot2"
.
See Also
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
plot(fit, parameter = "treatment")
## End(Not run)