Learn R Programming

BayesPiecewiseICAR (version 0.2.1)

ICARBHSampler: This function fits a piecewise hazard using a hierarchical model with a ICAR dependence applied to the hazard heights

Description

This function fits a piecewise hazard using a hierarchical model with a ICAR dependence applied to the hazard heights

Usage

ICARBHSampler(Y, I, B, hyper)

Arguments

Y
This is a n-vector containing patient survival times
I
This is a n-vector containing patient censoring indicators (0 for censored patient)
B
Number of iterations to run the sample
hyper
Vector of hyperparameters. In order, this contains a1, b1 which are the inverse gamma hyperparameters on sigma^2. Phi which is the hyperparameter on the mean number of split points. Jmax which is the maximum allowed number of split points. cl1 which is a tuning parameter greater than 0. J1 is the starting number of split points for the MCMC. Finally, clam1 which is between 0 and 1 and characterizes the spatial dependency of the baseline hazard heights.

Value

Returns a list containing the posterior samples of the split points, split point locations, log hazard rates and hierarchical samples

References

https://adventuresinstatistics.wordpress.com/2016/07/29/bayespiecewiseicar-tutorial-and-details/

Lee, K. H., Haneuse, S., Schrag, D. and Dominici, F. (2015), Bayesian semiparametric analysis of semicompeting risks data: investigating hospital readmission after a pancreatic cancer diagnosis. Journal of the Royal Statistical Society: Series C (Applied Statistics), 64: 253-273.

Examples

Run this code
####This generates random survival data
 Y=rexp(100,1/20)
 I=rbinom(100,1,.5)
 ###Sets hyperparameters
 a1=.7
 b1=.7
 phi=3
 Jmax=20
 cl1=.25
 clam1=.5
 J1=3
 ###Combines the hyperparameters in to a vector
 hyper=c(a1,b1,phi,Jmax,cl1,J1,clam1)
 ###Set Number of iterations
 B=100
 ###Run the Sampler
 X=ICARBHSampler(Y,I,B,hyper)
 X

Run the code above in your browser using DataLab