Tools › Statistics › Surveys and Sampling › Survey Weighting (Raking) › Method
Survey Weighting (Raking): Method
Open the free Survey Weighting by Raking Calculator
Survey Weighting by Raking: Weights That Match the Population Margins
The tool takes survey respondents and the known make-up of the population on a few variables (age groups, sex, region, education), and gives every respondent a weight so that the weighted sample matches the population on each of those variables. It reports how far the sample was from the targets, how the weights are spread, what the weighting costs in precision, and how the weights move the survey's answers.
The idea: fit one margin, then the next, and repeat
A sample rarely looks like the population: young adults answer less often than old ones, women more often than men. If the population share of every combination (young women with a degree in the north, and so on) were known and every combination had respondents, each respondent could simply be weighted by population share ÷ sample share of the combination. Usually only the margins are known, one variable at a time, and many combinations hold few respondents or none. Raking, published by Deming and Stephan (1940) and also called iterative proportional fitting, rim weighting or sample balancing, needs the margins only.

Start with every weight at 1 (or at a base weight). Multiply the weights of the women by one number and those of the men by another, so that the weighted shares of women and men equal the targets. Now do the same for the age groups. That second step disturbs the first a little, so go back to sex, then age again. Each round the disturbance is smaller, and after a few rounds every variable is on target at once. The 2025 weighting description of the CDC's Behavioral Risk Factor Surveillance System and the Census Bureau's American Community Survey documents describe production weighting of this kind, with more margins.
The equations
| Quantity | Formula | Note |
|---|---|---|
| Factor of category c in the pass over one variable | g = Tc × W ÷ Wc | Tc target share, W sum of all weights, Wc sum of the weights in the category before the pass |
| New weight of a respondent in category c | w ← w × g | one pass per variable; one iteration is a pass over every variable, in the order of the target rows |
| Margin gap after an iteration | largest |100 Wc ÷ W − 100 Tc| over all categories | in percentage points; the iteration stops when it is at or below the tolerance |
| Design effect from weighting (Kish) | deff = n Σw² ÷ (Σw)² = 1 + CV² | CV is the standard deviation of the weights over their mean |
| Effective sample size | neff = n ÷ deff = (Σw)² ÷ Σw² | the equally weighted sample of the same precision |
| Weighted share or mean | p = Σw y ÷ Σw | y is 0 or 1 for a share |
| Margin of error | z √(p (1 − p) ÷ neff) or z s ÷ √neff | s² = Σw (y − ȳ)² ÷ Σw × m ÷ (m − 1), m answers; neff over those who answered |
The final weight is a product. At convergence each respondent's weight is the starting weight times one factor for each variable's category. That is why, without base weights, everyone in the same combination of categories has the same weight, and why raking cannot give a combination a weight that the margins do not call for.
Design effect. Unequal weights make a weighted mean more variable than a plain mean of the same number of respondents. Kish's approximation puts the inflation at 1 + CV² of the weights; Kalton and Flores-Cervantes (2003) call it the variance inflation factor, and the BRFSS weighting description uses the same expression to form an effective sample size. A design effect of 1.44 means that 600 respondents are worth about 418 equally weighted ones.
Trimming. A few very large weights raise the design effect and let a handful of respondents steer the estimates. With bounds switched on, the page sets every weight beyond a bound to the bound (a multiple of the mean weight), rakes again so the margins hold, and repeats until no weight is beyond a bound or 50 rounds have passed. When a category is so scarce that its target needs a mean weight above the upper bound, bounds and targets cannot both be met; the page says so and keeps the margins. Survey organizations trim in different ways (the BRFSS truncates its design weights before raking, for instance); the procedure here is the page's own and is stated so that it can be reproduced.
Convergence rules differ. The page stops on the largest gap in percentage points (0.001 unless you change it). The American Community Survey research memorandum of Asiala (2011) describes a rule on the relative difference between each margin and its control (0.0001, loosened to 0.001, with at most 40 iterations). A different rule changes the last decimals of the weights, not their pattern.
What it assumes
- The population targets are right, refer to the same population as the survey, and use the same category definitions as the questionnaire.
- Within each category, the people who answered resemble the people who did not, on the things the survey measures. Weighting corrects the mix of categories and nothing else.
- The pattern of over- and under-representation is a product of one effect per variable (Kalton and Flores-Cervantes, 2003, describe this as the model behind raking). If young men are missing far more than "young" and "men" each suggest, raking on age and sex separately does not repair that; a combined age-by-sex variable does, if it has respondents in every category.
- Every respondent is one independent observation. The margins of error use the effective sample size and ignore clustering, stratification and the fact that the weights were estimated from the same sample.
When it misleads
- Raking on variables unrelated to the answers. The estimates do not move, and the design effect is pure loss of precision.
- A category with very few respondents. Five people then speak for a fifth of the population. The weights are correct arithmetic, and the estimate hangs on those five.
- A category with no respondent. No weight can stand in for people who are not in the sample. The page rakes the remaining categories to their targets rescaled to 100 % and says that the group is unrepresented.
- Targets that cannot all be met. If everyone in one category of a variable sits in a single category of another, some sets of targets are impossible. The gap then stops shrinking; the page reports the iteration cap and the gap that remains.
- Margins of error taken as exact. The effective-sample-size formula is an approximation. It overstates the error of an outcome closely related to the raking variables and understates it for a clustered sample.
Common mistakes
- Spelling a category one way in the data and another way in the targets ("18–29" with a dash from a word processor, "18-29" with a hyphen). The page leaves such respondents out and lists the lines.
- Using targets for a different population: all adults when the survey covered registered voters, or national figures for a state survey.
- Reading the weighted sample size as the sample size. The weights add to n by construction; the information in the sample is neff.
- Raking on many fine variables at once. Each added variable can only raise the spread of the weights; cells thin out and the design effect climbs.
- Trimming and forgetting that it was done. A trimmed weight under-corrects exactly the group that was scarcest.
- Applying the weights to a subset of respondents chosen after weighting and expecting the subset to match the targets.
- Stopping after one pass over each variable. Only the last variable is then on target; with two or more variables the passes need repeating.
Related tools
The Survey Analysis tool estimates shares, means and intervals from data that already carry a weight column; this tool is where such a weight column comes from. The Sample Size and Power tool sizes a survey before it is run; dividing its answer by the design effect expected from weighting shows what the weighted sample will be worth.
The page computes and describes weights. It does not say whether a sample, a set of targets or a weight is fit for a purpose. The data sets it opens with are made up for illustration.