Raking, or Iterative Proportional Fitting (IPF), is the industry standard for weighting survey data to match known population targets (e.g., Census data).
The Algorithm
The goal is to find a set of weights w such that the weighted marginal sums of the sample match the population targets for all specified dimensions.
We use the standard IPF algorithm:
- Initialize all weights to 1.0 (or existing design weights).
- For each target dimension (e.g., Gender):
- Calculate the current weighted sum for each category (e.g., Male, Female).
- Calculate an adjustment factor:
Target / Current. - Multiply the weight of every respondent in that category by the factor.
- Repeat step 2 for all dimensions.
- Check for convergence (max difference between current and target proportions).
- Repeat steps 2-4 until convergence (tolerance < 1e-6) or max iterations (50) is reached.
Zero-Cell Handling
If a category exists in the target but has 0 respondents in the sample (a "zero cell"), it is impossible to weight it up. Krosstabs will warn you and skip adjustment for that specific category, which may result in targets not being met.
Weight Trimming
Extreme weights can increase the variance of your estimates (Design Effect). Krosstabs allows you to trim weights (e.g., cap at 3.0 or 0.3) and redistributes the excess weight to other respondents to maintain the total sample size.
Effective Sample Size
We calculate the Effective Sample Size (ESS) using Kish's approximation:ESS = (Σw)² / Σ(w²)