Weighting & Calibration Lab
Raking matches each margin (education, region, total age) without needing the joint table. Step through the Newton iterations of survey::calibrate(calfun = "raking") and watch the margin error shrink.
Trust: calibrated 47.77, truth 49.16
Calibration margins
bar = weighted count Σw; tick = population count N_c; pale bar = before adjustment
mean age: 48.3 → 47.8 · N: 47.8
Converged after 4 steps
Newton step 4
Iteration log
- step 1: max relative margin error 6.08e-2
- step 2: max relative margin error 1.73e-3
- step 3: max relative margin error 1.52e-6
- step 4: max relative margin error 1.16e-12
Weight distribution
calibration factors g = w/d; before adjustment every g = 1 (dashed line)
Estimates and variance by outcome
| outcome | truth | unweighted | calibrated | model-based | SE (weights fixed) | SE (calibration) | variance change |
|---|---|---|---|---|---|---|---|
| Trust in science (0–100) | 49.16 | 49.54 | 47.77 | 47.76 | 1.175 | 0.889 | −43 % |
| Hours online per week | 18.81 | 19.16 | 18.80 | 18.80 | 0.463 | 0.295 | −60 % |
| Life satisfaction (0–10) | 6.56 | 6.46 | 6.41 | 6.41 | 0.120 | 0.119 | −3 % |
Trust: estimates ± 1.96 SE (calibration SE) against the truth
Bias over repeated samples
200 new samples with the same nonresponse; mean error = average estimate − truth
| outcome | unweighted bias | calibrated bias | SD of calibrated estimate |
|---|---|---|---|
| Trust | 2.98 | 0.00 | 0.808 |
| Online hours | 0.30 | 0.02 | 0.268 |
| Life satisfaction | 0.04 | -0.00 | 0.110 |
Formula
w_i = d_i exp(x_i'λ)Σ w_i x_i = T_xV̂(ȳ_cal) ≈ V̂(Σ w_i e_i / N), e_i = residual of y on x (d-weighted)
Raking uses margins, not the joint table: useful when only marginal population counts are published.