summary.rjMCMC {fkbma}R Documentation

Summarize Results from Reversible Jump MCMC (rjMCMC)

Description

This function provides a detailed summary of the results from the rjMCMC procedure, including model information, parameter estimates, posterior inclusion probabilities, convergence diagnostics, and plots for spline terms. The function also prints the model formula with fbs() notation for spline terms, indicating the use of free-knot B-splines.

Usage

## S3 method for class 'rjMCMC'
summary(object, digits = 3, level = 0.95, pip_cutoff = 0.1, ...)

Arguments

object

An object of class rjMCMC containing the output from the rjMCMC procedure, which includes:

fixed_param

Matrix of posterior samples for exposure intercept and main effect.

binary_param

Matrix of posterior samples for binary variable parameters.

sigma_sq

Matrix of posterior samples for the residual variance (sigma squared).

vars_prop_summ

Posterior inclusion probabilities for candidate variables.

splines_fitted

List of matrices containing fitted values for spline terms across iterations.

data_fit

Original dataset used in the rjMCMC procedure.

candsplineinter

Names of continuous candidate predictive spline variables.

candsplinevars

Names of continuous candidate spline variables.

candbinaryvars

Names of binary candidate variables.

candinter

Names of interaction terms, which can include spline variables.

mcmc_specs

MCMC sampler specifications, including the number of iterations, burn-in, thinning, and chains.

digits

Number of digits in summary output (default = 3)

level

Credible interval level (default = 0.95)

pip_cutoff

Posterior inclusion probability cutoff for reporting effective sample size and R-squared (default = 0.10)

...

Additional arguments to be passed to other methods or functions.

Details

The function produces detailed summaries similar to those from brms, including diagnostics, estimates, posterior inclusion probabilities, and spline effects. The spline terms are wrapped in fbs() notation, indicating the use of free-knot B-splines in the model. If the sampler did not converge, a warning is issued. The function also allows the user to view diagnostic plots for fitted exposure effects.

Value

Prints the following summary information:

Model Formula

The model formula with spline terms wrapped in fbs(), indicating free-knot B-splines, and interaction terms appropriately formatted.

Convergence Diagnostics

Reports any convergence issues based on Geweke diagnostics.

MCMC Sampler Arguments

Displays MCMC sampler arguments, including the number of posterior samples, burn-in, thinning, and chains.

Parameter Estimates

Posterior mean, standard error, 95% credible intervals, effective sample size (ESS), Gelman-Rubin statistic (Rhat), and posterior inclusion probabilities (PIP) for binary parameters, exposure intercept, and exposure effect.

Gaussian Family Parameters

Posterior summary for the residual standard error (sigma).

Posterior Inclusion Probabilities for Splines

Prints the posterior inclusion probabilities for spline terms.

Plots for Fitted Exposure Effects

Plots the mean and 95% credible intervals for each spline term vs fitted exposure effects.

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")
summary(results)



[Package fkbma version 0.2.0 Index]