plot_prediction {RoBSA} | R Documentation |
Survival plots for a RoBSA object
Description
Survival plots for a RoBSA object
Usage
plot_prediction(
x,
type = "survival",
time_range = NULL,
new_data = NULL,
predictor = NULL,
covariates_data = NULL,
conditional = FALSE,
plot_type = "base",
samples = 10000,
...
)
plot_survival(
x,
time_range = NULL,
new_data = NULL,
predictor = NULL,
covariates_data = NULL,
conditional = FALSE,
plot_type = "base",
samples = 10000,
...
)
plot_hazard(
x,
time_range = NULL,
new_data = NULL,
predictor = NULL,
covariates_data = NULL,
conditional = FALSE,
plot_type = "base",
samples = 10000,
...
)
plot_density(
x,
time_range = NULL,
new_data = NULL,
predictor = NULL,
covariates_data = NULL,
conditional = FALSE,
plot_type = "base",
samples = 10000,
...
)
Arguments
x |
a fitted RoBSA object. |
type |
what type of prediction should be created |
time_range |
a numeric of length two specifying the range for the
survival prediction. Defaults to |
new_data |
a data.frame containing fully specified predictors for which predictions should be made |
predictor |
an alternative input to |
covariates_data |
a supplementary input to |
conditional |
whether only models assuming presence of the specified
|
plot_type |
whether to use a base plot |
samples |
number of posterior samples to be evaluated |
... |
additional arguments. |
Value
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 survival for each level the treatment
plot_survival(fit, parameter = "treatment")
# plot hazard for each level the treatment
plot_hazard(fit, parameter = "treatment")
# plot density for each level the treatment
plot_density(fit, parameter = "treatment")
## End(Not run)