BayesSurvive {BayesSurvive}R Documentation

Fit Bayesian Cox Models

Description

This is the main function to fit a Bayesian Cox model with graph-structured selection priors for sparse identification of high-dimensional covariates.

Usage

BayesSurvive(
  survObj,
  model.type = "Pooled",
  MRF2b = FALSE,
  MRF.G = TRUE,
  g.ini = 0,
  hyperpar = NULL,
  initial = NULL,
  nIter = 1,
  burnin = 0,
  thin = 1,
  output_graph_para = FALSE,
  verbose = TRUE
)

Arguments

survObj

a list containing observed data from n subjects with components t, di, X. For graphical learning of the Markov random field prior, survObj should be a list of the list with survival and covariates data. For subgroup models with or without graphical learning, survObj should be a list of multiple lists with each component list representing each subgroup's survival and covariates data

model.type

a method option from c("Pooled", "CoxBVSSL", "Sub-struct"). To enable graphical learning for "Pooled" model, please specify list(survObj) where survObj is the list of t, di and X

MRF2b

logical value. MRF2b = TRUE means two different hyperparameters b in MRF prior (values b01 and b02) and MRF2b = FALSE means one hyperparamter b in MRF prior

MRF.G

logical value. MRF.G = TRUE is to fix the MRF graph which is provided in the argument hyperpar, and MRF.G = FALSE is to use graphical model for leanring the MRF graph

g.ini

initial values for latent edge inclusion indicators in graph, should be a value in [0,1]. 0 or 1: set all random edges to 0 or 1; value in (0,1): rate of indicators randomly set to 1, the remaining indicators are 0

hyperpar

a list containing prior parameter values

initial

a list containing prior parameters' initial values

nIter

the number of iterations of the chain

burnin

number of iterations to discard at the start of the chain. Default is 0

thin

thinning MCMC intermediate results to be stored

output_graph_para

allow (TRUE) or suppress (FALSE) the output for parameters 'G', 'V', 'C' and 'Sig' in the graphical model if MRF.G = FALSE

verbose

logical value to display the progess of MCMC

Value

An object of class BayesSurvive is saved as obj_BayesSurvive.rda in the output file, including the following components:

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 (spike) for coefficient prior
  "cb"     = 20, # sd (spike) 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
)

# show posterior mean of coefficients and 95% credible intervals
library("GGally")
plot(fit) +
  coord_flip() +
  theme(axis.text.x = element_text(angle = 90, size = 7))



[Package BayesSurvive version 0.0.1 Index]