Skip to contents

For each case and each fixed-effect term that has a corresponding case-level random effect, returns the case-specific posterior (b + u) summarized with decision quantities. Case-specific posteriors are on the link scale.

Usage

summarize_per_case_effects(
  model,
  case_var = "case",
  study_var = "study",
  threshold = NULL,
  rope = NULL,
  intervention_goal = c("increase", "decrease"),
  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.

threshold

Numeric. A positive magnitude expressed on the improvement-oriented scale (i.e., after any decrease reflection). If supplied, the posterior probability that the effect meets or exceeds this magnitude in the goal direction is reported as prob_meaningful_change.

rope

Numeric length-2. ROPE bounds on the link scale, expressed on the native coefficient scale. For intervention_goal = "decrease" the bounds are reflected together with the draws, so an asymmetric ROPE stays attached to the same parameter region. If supplied, posterior probability inside the ROPE is reported as rope_prob.

intervention_goal

"increase" (default) or "decrease". For "decrease", every reported coefficient is sign-flipped so that a positive value denotes improvement (full reflection onto an improvement-oriented scale); pd is unchanged and the ROPE is reflected with the draws. Intercept and ordinal threshold terms (b_Intercept) are excluded from the table, so only treatment, trend, and moderator slopes are reported.

ci_level

Credible interval width (default 0.95).

Value

A data frame with columns case, term, mean, sd, lower, upper, pd, prob_meaningful_change, rope_prob.

Examples

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