View source: R/cat_cox_bayes_joint.R
cat_cox_bayes_joint | R Documentation |
This function performs Bayesian estimation for a catalytic Cox proportional-hazards model (COX) using RStan by using adaptive tau. It allows users to estimate the coefficients and cumulative baseline hazard increments over specified time intervals with Bayesian sampling.
cat_cox_bayes_joint(
formula,
cat_init,
hazard_beta = 2,
tau_alpha = 2,
tau_gamma = 1,
chains = 4,
iter = 2000,
warmup = 1000,
...
)
formula |
A formula specifying the Cox model. Should at least include response variables (e.g. |
cat_init |
A list generated from |
hazard_beta |
Numeric, default |
tau_alpha |
Numeric, defaults |
tau_gamma |
Numeric, defaults |
chains |
Integer, default |
iter |
Integer, default |
warmup |
Integer, default |
... |
Additional arguments passed to RStan’s |
A list containing the values of all the arguments and the following components:
stan_data |
A data list used for fitting RStan sampling model. |
stan_model |
Compiled RStan model object for Cox regression. |
stan_sample_model |
Fitted RStan sampling model containing posterior samples. |
tau |
Mean posterior estimates of tau value from |
coefficients |
Mean posterior estimates of model coefficients from |
increment_cumulative_baseline_hazard |
Mean posterior estimates of Estimated
cumulative hazard increments over time intervals from |
library(survival)
data("cancer")
cancer$status[cancer$status == 1] <- 0
cancer$status[cancer$status == 2] <- 1
cat_init <- cat_cox_initialization(
formula = Surv(time, status) ~ 1, # formula for simple model
data = cancer,
syn_size = 100, # Synthetic data size
hazard_constant = 0.1, # Hazard rate value
entry_points = rep(0, nrow(cancer)), # Entry points of each observation
x_degree = rep(1, ncol(cancer) - 2), # Degrees for polynomial expansion of predictors
resample_only = FALSE, # Whether to perform resampling only
na_replace = stats::na.omit # How to handle NA values in data
)
cat_model <- cat_cox_bayes_joint(
formula = ~., # Should at least include response variables
cat_init = cat_init, # Only accept object generated from `cat_cox_initialization`
hazard_beta = 2, # Shape parameter for the Gamma distribution in the hazard model
tau_alpha = 2, # Shape parameter of the Gamma-like function for tau
tau_gamma = 1, # Scale parameter of the Gamma-like function for tau
chains = 1, # Number of Markov chains to be run in the RStan sampling
iter = 10, # Number of iterations per chain in the RStan sampling
warmup = 5 # Number of warm-up (or burn-in) iterations for each chain
)
cat_model
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.