
Posterior probability of consistent intervention direction across cases
Source:R/utils-posterior-decisions.R
summarize_cross_case_consistency.RdFor each fixed-effect term with a corresponding unit-level random
effect, returns the posterior probability that the unit-specific
effect (b plus the random effects of the unit and every enclosing
grouping, as in summarize_per_case_effects()) points in the expected
direction for every unit, from the joint posterior of the unit effects.
Usage
summarize_cross_case_consistency(
model,
case_var = "case",
ci_level = 0.95,
intervention_goal = c("increase", "decrease")
)Arguments
- model
A fitted
brmsfit.- case_var
Name of the case-level grouping column in the model (default
"case").- ci_level
Credible interval width (default 0.95).
- intervention_goal
"increase"(default) or"decrease". The expected direction of a term is the goal direction, reversed for reversal withdrawal steps (seesummarize_fixed_effect_decisions()).
Value
A data frame with columns term, prob_all_positive,
prob_all_negative (both on the native coefficient scale), and
prob_consistent, the probability that every case changes in the
expected direction (prob_all_positive when that direction is an
increase, prob_all_negative when it is a decrease).
Examples
if (interactive()) {
dat <- simulate_scd_data()
fit <- brms::brm(outcome ~ phase + (1 + phase | case),
data = dat, refresh = 0)
summarize_cross_case_consistency(fit)
}