rjMCMC {fkbma} | R Documentation |
Run Reversible Jump MCMC (rjMCMC) Procedure
Description
This function performs a Reversible Jump MCMC (rjMCMC) procedure to generate the posterior distribution, using Bayesian model averaging and free-knot B-splines.
Usage
rjMCMC(
data,
candsplinevars,
candbinaryvars,
candinter,
outcome,
factor_var,
mcmc_specs = NULL,
prior_params = NULL
)
Arguments
data |
A data frame containing the observations, including the following columns:
|
candsplinevars |
A vector of names for continuous predictive candidate variables (default = NULL). |
candbinaryvars |
A vector of names for binary predictive candidate variables (default = NULL). |
candinter |
A vector indicating which of the candidate variables are tailoring (default = NULL). |
outcome |
A string indicating the name of the continuous outcome variable in data. |
factor_var |
A string indicating the name of the binary exposure variable in data. |
mcmc_specs |
A list containing:
|
prior_params |
A list containing prior parameters:
|
Value
An rjMCMC object with the following components:
- accept_var
Matrix indicating the acceptance of variable inclusion/removal for each iteration.
- accept_add_knot
Matrix indicating acceptance of knot addition for each spline term across iterations.
- accept_remove_knot
Matrix indicating acceptance of knot removal for each spline term across iterations.
- accept_move_knot
Matrix indicating acceptance of knot movement for each spline term across iterations.
- splines_fitted
List of matrices, one per spline interaction term, containing fitted spline values across iterations.
- binary_param
Matrix containing posterior samples of binary variable parameters.
- inter_trt_param
Matrix containing posterior samples of the treatment intercept and main effect.
- sigma_sq
Matrix of posterior samples for the residual variance (sigma squared).
- vars_prop
Matrix indicating the inclusion of variables across iterations (1 for included, 0 for excluded).
- vars_prop_summ
Posterior inclusion probabilities for all candidate variables (spline and binary).
- k
Matrix indicating the number of knots for each spline term across iterations.
- trt_eff_posterior
Matrix of posterior treatment effect estimates, including spline effects.
- data_fit
The original dataset passed to the function.
- candsplineinter
A character vector indicating the spline interaction terms.
- candsplinevars
A character vector of candidate spline variables.
- candbinaryvars
A character vector of candidate binary variables.
- candinter
A character vector of interaction terms with treatment (can include splines and binary variables).
- mcmc_specs
The MCMC specifications used in the procedure.
- prior_params
The prior parameters used in the procedure.
References
Maleyeff, L., Golchi, S., Moodie, E. E. M., & Hudson, M. (2024) "An adaptive enrichment design using Bayesian model averaging for selection and threshold-identification of predictive variables" doi:10.1093/biomtc/ujae141
Examples
# Example dataset
data("simulated_data")
candsplinevars <- c("X_1")
candbinaryvars <- paste0("Z_", 1:5)
candinter <- c(candsplinevars, candbinaryvars)
results <- rjMCMC(simulated_data, candsplinevars, candbinaryvars, candinter,
outcome = "Y", factor_var = "trt")