
Posterior decision summary for fixed-effect coefficients
Source:R/utils-posterior-decisions.R
summarize_fixed_effect_decisions.RdFor each fixed-effect coefficient (b_*) in the model, returns
posterior mean, SD, credible interval, probability of direction (pd),
and optional probability of meaningful change and ROPE-probability.
Posteriors are on the link scale (Stan parameterization).
Usage
summarize_fixed_effect_decisions(
model,
threshold = NULL,
rope = NULL,
intervention_goal = c("increase", "decrease"),
ci_level = 0.95
)Arguments
- model
A fitted
brmsfit.- threshold
Numeric. A positive magnitude expressed on the improvement-oriented scale (i.e., after any
decreasereflection). If supplied, the posterior probability that the effect meets or exceeds this magnitude in the goal direction is reported asprob_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 asrope_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);pdis 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 one row per fixed-effect term and columns
term, mean, sd, lower, upper, pd,
prob_meaningful_change, rope_prob. For a log link, the
response-scale incidence-rate ratio columns irr, irr_lower,
irr_upper are attached; for a logit link, the odds-ratio columns
or, or_lower, or_upper. These ratios are exp() of the native
(unreflected) coefficient, so they carry the conventional definition
regardless of intervention_goal; only the mean/lower/upper
columns are reflected for direction. An identity link attaches nothing,
since link scale equals response scale.
Examples
if (interactive()) {
dat <- simulate_scd_data()
fit <- brms::brm(outcome ~ phase + (1 | case), data = dat, refresh = 0)
summarize_fixed_effect_decisions(fit, threshold = 0.5,
rope = c(-0.1, 0.1))
}