Update prior distributions using interim survival data
update_priors.RdThis function updates elicited priors (defined through SHELF objects and parametric prior distributions) using interim survival data under a delayed-effect, piecewise-exponential model for the treatment arm and an exponential or Weibull model for the control arm.
Arguments
- data
A data frame containing interim survival data with columns:
survival_timeObserved time from randomisation to event/censoring.statusEvent indicator (1 = event, 0 = censored).groupGroup identifier (e.g., "Control", "Treatment").
- control_model
A named list specifying the control arm survival distribution:
dist: Distribution type ("Exponential" or "Weibull")parameter_mode: Either "Fixed" or "Distribution"fixed_type: If "Fixed", specify as "Parameters" or "Landmark"lambda,gamma: Scale and shape parameterst1,t2: Landmark timessurv_t1,surv_t2: Survival probabilities at landmarkst1_Beta_a,t1_Beta_b,diff_Beta_a,diff_Beta_b: Beta prior parameters
@param effect_model A named list specifying beliefs about the treatment effect:
delay_SHELF,HR_SHELF: SHELF objects encoding beliefsdelay_dist,HR_dist: Distribution types ("hist" by default)P_S: Probability that survival curves separateP_DTE: Probability of delayed separation, conditional on separation
- n_samples
Number of posterior samples to generate (default: 1000).
Value
A data frame containing Monte Carlo samples from the updated (posterior) distribution of the model parameters. Columns normally include:
lambda_cPosterior samples for the control hazard parameter.delay_timePosterior samples for the delay/changepoint time \(T\).HRPosterior samples for the post-delay hazard ratio.gamma_c(only ifcontrol_distribution = "Weibull") Posterior samples for the Weibull shape parameter.
Details
The function performs Bayesian updating under a delayed-effect model: $$ h_T(t) = \begin{cases} \lambda_c, & t \le T \\ \lambda_c \times HR, & t > T \end{cases} $$
Priors for lambda_c, T, and HR are constructed from
elicited distributions using the SHELF framework, then updated through
sampling-based posterior inference.
Examples
if (FALSE) { # \dontrun{
posterior_df <- update_priors(
data = interim_data,
control_distribution = "Exponential",
control_model = control_prior_list,
delay_SHELF = delay_shelf_obj,
HR_SHELF = hr_shelf_obj,
delay_param_dist = "lognormal",
HR_param_dist = "lognormal",
n_samples = 2000
)
} # }