Skip to content

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

EducationPrimary962 / 962Secondary1,448 / 1,448Tertiary590 / 590RegionWest1,572 / 1,572East1,428 / 1,428
Calibration margins: Primary Σw = 962 / N = 962; Secondary Σw = 1,448 / N = 1448; Tertiary Σw = 590 / N = 590; West Σw = 1,572 / N = 1572; East Σw = 1,428 / N = 1428.

mean age: 48.3 → 47.8 · N: 47.8

Converged after 4 steps

Newton step 4
Iteration log
  1. step 1: max relative margin error 6.08e-2
  2. step 2: max relative margin error 1.73e-3
  3. step 3: max relative margin error 1.52e-6
  4. step 4: max relative margin error 1.16e-12

Weight distribution

calibration factors g = w/d; before adjustment every g = 1 (dashed line)

0.551.001.55n_eff = 190.0 / 202
Weight distribution: g from 0.55 to 1.55; Kish n_eff 190.0 of 202.

Estimates and variance by outcome

outcometruthunweightedcalibratedmodel-basedSE (weights fixed)SE (calibration)variance change
Trust in science (0–100)49.1649.5447.7747.761.1750.889−43 %
Hours online per week18.8119.1618.8018.800.4630.295−60 %
Life satisfaction (0–10)6.566.466.416.410.1200.119−3 %

Trust: estimates ± 1.96 SE (calibration SE) against the truth

Ȳ = 49.16unweightedcalibratedmodel-based
Trust: estimates ± 1.96 SE (calibration SE) against the truth: truth 49.16; unweighted 49.54; calibrated 47.77; model-based 47.76.

Bias over repeated samples

200 new samples with the same nonresponse; mean error = average estimate − truth

outcomeunweighted biascalibrated biasSD of calibrated estimate
Trust2.980.000.808
Online hours0.300.020.268
Life satisfaction0.04-0.000.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.

Method: Seeded synthetic population (N = 3 000) and nonresponse. Weights: survey::postStratify / calibrate algorithms (Newton iterations of grake, MASS::ginv pseudo-inverse). Variance: Hájek mean with the calibration correction (influence values replaced by d-weighted regression residuals), with-replacement SRS design of the respondents. The model-based estimate is the unweighted OLS prediction at the population totals. · Synthetic, seeded data. Illustrative, not an empirical finding.

Validation: Weights, calibrated means and calibration SEs match R survey 4.2.1 (postStratify, calibrate linear / raking / bounded) on nine respondent sets of this lab (tests/unit/calibration.test.ts). The 'weights fixed' SE ignores the calibration step on purpose, for comparison. · numerically validated