Skip to contents

Finds weights closest to the design weights, in chi-square distance, that reproduce known population margins EXACTLY. The chi-square solution is closed form and reproduces GREG: one adjusts the estimate, the other the weights.

Usage

morie_calibration_chi2(y, X, weights, totals)

Arguments

y

study variable.

X

calibration variables.

weights

design weights.

totals

population totals to reproduce.

Value

list: total, calibrated_weights, margins_reproduced, max_margin_error, n_negative, weight_ratio_range, distance, equals_greg, n, p, method.

Details

Chi-square calibration can produce NEGATIVE weights, which are awkward to defend; the count is returned rather than silently clipped. The bounded alternative already exists in this package as morie_calibration_weights, which rakes on categorical margins by iterative proportional fitting and cannot go negative. Mirrors morie.fn.calibr.

See also

Examples

set.seed(1)
X <- cbind(1, runif(50))
morie_calibration_chi2(rnorm(50), X, rep(10, 50),
                       c(500, 260))$margins_reproduced
#> [1] TRUE