Skip to contents

Comprehensive Bayesian analysis for clinical research and medical decision making using tabular clinical data. Implements Bayesian hypothesis testing, parameter estimation, predictive modeling, and decision analysis. Provides intuitive interpretation of evidence, uncertainty quantification, and clinical decision support. Essential for evidence-based medicine, clinical guidelines, and personalized treatment decisions with proper uncertainty communication.

Usage

bayesianclinical(
  data,
  outcome_var,
  treatment_var,
  covariates,
  patient_id,
  time_var,
  center_var,
  analysis_type = "treatment_effect",
  outcome_type = "continuous",
  prior_type = "weakly_informative",
  prior_mean = 0,
  prior_sd = 1,
  historical_data_weight = 0.1,
  mcmc_chains = 4,
  mcmc_iterations = 2000,
  mcmc_warmup = 1000,
  mcmc_thinning = 1,
  credible_interval = 0.95,
  rope_lower = -0.1,
  rope_upper = 0.1,
  minimum_effect_size = 0.2,
  decision_analysis = FALSE,
  benefit_utility = 1,
  harm_utility = -0.5,
  cost_consideration = FALSE,
  model_diagnostics = TRUE,
  convergence_diagnostics = TRUE,
  posterior_predictive_checks = TRUE,
  leave_one_out_cv = FALSE,
  hierarchical_modeling = FALSE,
  mixture_modeling = FALSE,
  nonparametric_methods = FALSE,
  adaptive_design = FALSE,
  model_comparison = FALSE,
  bayes_factor_analysis = TRUE,
  evidence_thresholds = TRUE,
  probability_statements = TRUE,
  prediction_intervals = TRUE,
  sensitivity_to_priors = FALSE,
  posterior_plots = TRUE,
  trace_plots = TRUE,
  forest_plots = FALSE,
  decision_plots = FALSE,
  comprehensive_report = TRUE,
  clinical_interpretation = TRUE,
  regulatory_documentation = FALSE,
  layman_summary = TRUE
)

Arguments

data

the data as a data frame

outcome_var

Primary clinical outcome of interest

treatment_var

Treatment group or intervention variable

covariates

Clinical covariates and baseline characteristics

patient_id

Patient identifier for hierarchical models

time_var

Time variable for longitudinal Bayesian analysis

center_var

Center or site variable for hierarchical models

analysis_type

Type of Bayesian analysis to perform

outcome_type

Type of outcome variable

prior_type

Type of prior distributions to use

prior_mean

Prior mean for treatment effect or main parameter

prior_sd

Prior standard deviation for main parameter

historical_data_weight

Weight for historical data in prior (0=no weight, 1=full weight)

mcmc_chains

Number of MCMC chains

mcmc_iterations

Number of MCMC iterations per chain

mcmc_warmup

Number of warmup (burn-in) iterations

mcmc_thinning

Thinning interval for MCMC samples

credible_interval

Level for Bayesian credible intervals

rope_lower

Lower bound for Region of Practical Equivalence (ROPE)

rope_upper

Upper bound for Region of Practical Equivalence (ROPE)

minimum_effect_size

Minimum effect size considered clinically important

decision_analysis

Perform Bayesian decision analysis with utilities

benefit_utility

Utility value for treatment benefit

harm_utility

Utility value for treatment harm (negative)

cost_consideration

Include cost considerations in decision analysis

model_diagnostics

Perform MCMC diagnostics and model validation

convergence_diagnostics

Check MCMC convergence (R-hat, ESS, etc.)

posterior_predictive_checks

Perform posterior predictive model checking

leave_one_out_cv

Perform LOO-CV for model comparison

hierarchical_modeling

Use hierarchical/multilevel Bayesian models

mixture_modeling

Use Bayesian mixture models for heterogeneity

nonparametric_methods

Use nonparametric Bayesian approaches

adaptive_design

Perform adaptive trial design analysis

model_comparison

Compare multiple Bayesian models

bayes_factor_analysis

Calculate Bayes factors for hypothesis testing

evidence_thresholds

Classify evidence strength using standard thresholds

probability_statements

Generate clinically relevant probability statements

prediction_intervals

Calculate Bayesian prediction intervals

sensitivity_to_priors

Assess sensitivity to prior specifications

posterior_plots

Generate posterior distribution visualizations

trace_plots

Generate MCMC trace plots for diagnostics

forest_plots

Generate Bayesian forest plots for meta-analysis

decision_plots

Generate decision analysis visualization

comprehensive_report

Generate comprehensive Bayesian analysis report

clinical_interpretation

Provide clinical interpretation of Bayesian results

regulatory_documentation

Include regulatory-compliant documentation

layman_summary

Provide plain language summary of results

Value

A results object containing:

results$bayesian_overviewa table
results$posterior_summarya table
results$treatment_effect_analysisa table
results$bayes_factorsa table
results$model_diagnostics_summarya table
results$prior_posterior_comparisona table
results$decision_analysis_resultsa table
results$predictive_intervalsa table
results$sensitivity_to_priorsa table
results$probability_statementsa table
results$model_comparisona table
results$posterior_distribution_plotan image
results$trace_plotsan image
results$prior_posterior_plotan image
results$bayesian_forest_plotan image
results$decision_analysis_plotan image
results$predictive_checks_plotan image
results$comprehensive_reporta html
results$clinical_interpretation_reporta html
results$layman_summary_reporta html

Tables can be converted to data frames with asDF or as.data.frame. For example:

results$bayesian_overview$asDF

as.data.frame(results$bayesian_overview)

Examples

data('clinical_data')

bayesianclinical(
    data = clinical_data,
    outcome_var = "treatment_success",
    treatment_var = "treatment_group",
    covariates = c("age", "severity", "comorbidity")
)