Skip to contents

For each parameter flagged by der_classify(), rescales the posterior draws so that marginal variance matches the sandwich variance estimate. The correction preserves the posterior mean: draws are centered, scaled by sqrt(V_sand[i,i] / sigma_mcmc[i,i]), then re-centered.

Usage

der_correct(x, method = "cholesky")

Arguments

x

A svyder object with classification (from der_classify()).

method

Correction method (default "cholesky"). Currently only "cholesky" is supported.

Value

A svyder object with corrected_draws, scale_factors, and original_draws populated.

Details

Unflagged parameters retain their original draws without any modification.

See also

der_classify() for flagging parameters, der_compute() for computing DER, as.matrix.svyder() for extracting corrected draws.

Other core-pipeline: der_classify(), der_compute(), der_diagnose()

Examples

data(nsece_demo)
result <- der_compute(
  nsece_demo$draws,
  y = nsece_demo$y, X = nsece_demo$X,
  group = nsece_demo$group, weights = nsece_demo$weights,
  psu = nsece_demo$psu, family = "binomial",
  sigma_theta = nsece_demo$sigma_theta,
  param_types = nsece_demo$param_types
)
result <- der_classify(result, tau = 1.2, verbose = FALSE)
result <- der_correct(result)