Description Usage Arguments Value Examples
View source: R/Main_Functions.R
Posterior hazard function estimation using Gibbs MCMC results
1 2 |
mcmc |
A list-The MCMC output from mcmc_Gibbs |
new_pat |
A matrix consisting of the covariates of new sample points. Each row represents one sample point. It can also be vector consisting of the covariates of a new sample point. |
range |
A vector consisting of the values to be evaluated in the plot for hazard estimation. |
if_plot |
A logical variable indicating whether the hazard estimation should be plotted. 1 means estimation should be plotted; 0 means otherwise. Defualt value is 0, i.e. not plotted. |
quantiles |
A two-dimensional vector determining the quantiles for the confidence bounds to be plotted. The first value is the lower quantile and the second value is the upper quantile. Default is (0.025,0.975) |
color |
A string determining the color of the plot. |
A list composed of the estimation for the hazard across the given range. The Hazard_estimation is the mean across all iterations, and the Hazard_lower_quant and Hazard_upper_quant are the hazard function estimations for the specified quantiles.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | ########################################
#Source dependent packages
library(MASS)
library(mc2d)
library(mvnfast)
library(survival)
#Simulate Data using built-in data generation
##
seed=1
set.seed(seed)
Npat=5
data <- simulate_data(Npat)
########################################
#Run MCMC
########################################
#Inputs for mcmc
response <- log(data$OS)
covariate <- cbind(scale(data$Age),data$AUC,data$CR)
censor_status <- data$death
mcmc_settings<-NULL
mcmc_settings$nskip<-10
mcmc_settings$nburn<-50
mcmc_settings$ndisplay<-100
mcmc_settings$nsave<-20
mcmc_settings$sigma_jump<-c(0,4,2.5,4,2.6)
###################
#Run MCMC function
mcmc_Gibbs<-mcmc_DDPGP(response,covariate,censor_status,mcmc_settings)
########################################
#Plotting Hazard Estimation
########################################
#Parameters in Plotting Estimation for Functions
range=seq(2,8,1)
example_AUC <- 5
example_CR <- 1
example_Age <- 1
new_pat<-cbind(example_Age,example_AUC,example_CR)
if_plot=1
###################
#Plot DDP-GP Hazard Esimation
c=DDPGP_Haz(mcmc_Gibbs,new_pat,range, if_plot)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.