Skip to contents

For each fixed-effect term with a corresponding case-level random effect, returns the posterior probability that the case-specific effect has the same sign across all cases — a Bayesian analogue of WWC's "consistency of effect" criterion derived from the joint posterior of the per-case effect (b + u_case, plus the study offset u_study for meta-analytic fits).

Usage

summarize_cross_case_consistency(
  model,
  case_var = "case",
  study_var = "study",
  ci_level = 0.95
)

Arguments

model

A fitted brmsfit.

case_var

Name of the case-level grouping factor in the model (default "case").

study_var

Name of the study-level grouping factor for meta-analytic fits (default "study"). When the model carries a study-level random effect on the term, the matching study offset is added so the case-specific posterior is the full b + u_study + u_case. Ignored for single-study fits.

ci_level

Credible interval width (default 0.95).

Value

A data frame with columns term, prob_all_positive, prob_all_negative, prob_consistent (= prob_all_positive + prob_all_negative).

Examples

if (interactive()) {
  dat <- simulate_scd_data()
  fit <- brms::brm(outcome ~ phase + (1 + phase | case),
                   data = dat, refresh = 0)
  summarize_cross_case_consistency(fit)
}