plotBrier {BayesSurvive} | R Documentation |
Time-dependent Brier scores
Description
Predict time-dependent Brier scores based on Cox regression models
Usage
plotBrier(
object,
survObj.new = NULL,
method = "mean",
times = NULL,
subgroup = 1
)
Arguments
object |
fitted object obtained with |
survObj.new |
a list containing observed data from new subjects with
components |
method |
option to use the posterior mean ( |
times |
maximum time point to evaluate the prediction |
subgroup |
index of the subgroup in |
Value
A ggplot2::ggplot
object. See ?ggplot2::ggplot
for more
details of the object.
Examples
library("BayesSurvive")
set.seed(123)
# Load the example dataset
data("simData", package = "BayesSurvive")
dataset <- list(
"X" = simData[[1]]$X,
"t" = simData[[1]]$time,
"di" = simData[[1]]$status
)
# Initial value: null model without covariates
initial <- list("gamma.ini" = rep(0, ncol(dataset$X)))
# Hyperparameters
hyperparPooled <- list(
"c0" = 2, # prior of baseline hazard
"tau" = 0.0375, # sd for coefficient prior
"cb" = 20, # sd for coefficient prior
"pi.ga" = 0.02, # prior variable selection probability for standard Cox models
"a" = -4, # hyperparameter in MRF prior
"b" = 0.1, # hyperparameter in MRF prior
"G" = simData$G # hyperparameter in MRF prior
)
# run Bayesian Cox with graph-structured priors
fit <- BayesSurvive(
survObj = dataset, hyperpar = hyperparPooled,
initial = initial, nIter = 100
)
# predict survival probabilities of the train data
plotBrier(fit, survObj.new = dataset)
[Package BayesSurvive version 0.0.2 Index]