Skip to contents

Snapshot shared parameter summaries from a narrowly supported Bayesian Gaussian MLM for use by repair(), repair_data(), and repair_ranef_gls().

Usage

repair_bayes_plugin(model)

Arguments

model

An already sampled brms::brm() Gaussian identity-link fit or rstanarm::stan_lmer() / Gaussian identity-link rstanarm::stan_glmer() fit.

Value

A repair_bayes_plugin snapshot containing the original fit, Gaussian likelihood components, backend/version, priors, sampler diagnostics, summary convention and explicit inference limitations. Recreate the snapshot after changing a fit. The brms/rstanarm packages are optional dependencies.

Details

This is an explicit experimental opt-in, not Bayesian REPAIR. The initial scope is a univariate numeric response, additive numeric columns, exactly one ordinary (terms | group) random-effects block, a bare grouping column, and constant independent Gaussian residual variance. Factors in the measurement equation, transformations, interactions, offsets, weights, independent multiple blocks (||), nuisance groups, nonidentity links, distributional/nonlinear models, residual extensions and custom Stan code are unsupported. Precompute numeric transformations before fitting.

The snapshot uses posterior means of fixed coefficients and complete random-effect covariance matrices, and mean(sigma^2), not mean(sigma)^2. Likelihood-only GLS predictions are reconstructed from native designs; marginal posterior random-effect means/SDs never enter the correction. REPAIR scores remain deviations from fitted fixed effects. Each unit must have an identifiable likelihood-only random-coefficient design even when its Bayesian posterior is proper.

Structural SEs, tests and confidence intervals remain conditional and model-based. Step-1 parameter uncertainty, its induced cross-unit dependence, and prior sensitivity are not propagated. Full refitted-workflow coverage has not been established. Sampler diagnostics are recorded and warnings retained; they cannot establish structural coverage or model adequacy. Priors on shared parameters still affect the inputs. repair_refit() and repair_bootstrap() do not yet support Bayesian plug-in snapshots. See vignette("bayesian-plugin", package = "repair").

Examples

if (FALSE) { # \dontrun{
library(rstanarm)
growth <- rstanarm::stan_lmer(Reaction ~ Days + (Days | Subject),
  data = lme4::sleepstudy, chains = 4, seed = 42)
measurement <- repair_bayes_plugin(growth)
people <- data.frame(Subject = levels(lme4::sleepstudy$Subject), x = 1:18)
fit <- repair(re("Days") ~ x, measurement, people, "Subject")
summary(fit)
} # }