predict.rjMCMC {fkbma} | R Documentation |
Predict from Reversible Jump MCMC (rjMCMC) Model Results
Description
This function generates posterior predictions from an rjMCMC model based on the provided data. It combines the fixed effects, spline terms, and binary parameters, and includes residual variance in the predictions.
Usage
## S3 method for class 'rjMCMC'
predict(object, newdata = NULL, ...)
Arguments
object |
An object of class rjMCMC containing the output from the
|
newdata |
A data frame for which predictions are to be made. If NA, the original fitted data is used. |
... |
Additional arguments to be passed to other methods or functions. |
Value
A matrix of predicted values.
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")
predict(results)