Closed-form linear calibration to match population totals on auxiliary X.
When survey is installed, defers to survey::calibrate() for a fully
design-aware result; otherwise computes the linear adjustment in base R.
Arguments
- weights
Numeric vector of unit-level design weights.
- X
A numeric matrix or
data.frameof auxiliary variables (one row per unit) used by GREG / nonresponse propensity models.- population_totals
Named numeric vector of target totals to calibrate to.
- max_iter
Iteration cap for calibration / IPF.
- tol
Convergence tolerance for calibration.
Examples
set.seed(1)
X <- cbind(intercept = 1, x = runif(30))
res <- morie_weights_greg(rep(1, 30), X, c(intercept = 35, x = 18))
str(res, max.level = 1)
#> List of 5
#> $ weights : num [1:30] 1.15 1.16 1.17 1.19 1.15 ...
#> $ converged : logi TRUE
#> $ iterations : num 1
#> $ max_adjustment: num 7.11e-15
#> $ diagnostics :List of 14
