This question is both about the "survey" package in R and about the mechanics behind it. I'm more interested in the mechanical reasons why this package fails to create weights when combinations of values are missing in the sample.

So my specific problem is this: I have a survey that I would like to post-stratify on age and gender. Since the sampling procedure was difficult, I don't have values for each age-gender combination (gender is coded as binary and age has 5-year brackets). When I use the rake function to post-stratify my sample, I receive the error message Some strata absent from sample: use partial=TRUE to ignore them. and when I use partial=TRUE, I receive the error message unused argument (partial = TRUE). I did some research, and found here that this is the expected behavior. I assume that the program runs into problems when calculating weights for observations that don't occur. Is this assumption correct?

Does this mean that post-stratification isn't possible?

What would be a work-around for such a case?


1 Answer 1


If some strata don't exist in the sample then it's not possible to reweight the sample to give the same stratum proportions as in the population. Computationally, you'd end up dividing by zero. From a common-sense point of view, if there's no-one under 18 in your sample it doesn't make sense to try to get the same age distribution as a population where there are people under 18.

The best you can hope do to is match the population stratum distribution for strata that are present in the sample, and that's what partial=TRUE asks for.

One scenario where partial=TRUE makes sense is when your sample deliberately doesn't contain some strata, so you really are doing post-stratification on a subset of strata. Another is when you were just unlucky in sampling, so you are trying to do post-stratification to the whole population, but it won't work very well.

Or, you might try collapsing some strata into larger strata so that they are all present in the sample.

  • $\begingroup$ Assuming that the missing strata are not deliberate, is collapsing the only way to go? Most observations in the sample would fit so neatly into the frequency table of the population with relatively narrow age brackets. Increasing the size of the age brackets would lead to so much information being lost that could be used to create the weights. Is interpolation or multiple imputation feasible? $\endgroup$
    – Tea Tree
    Jan 8, 2021 at 4:42
  • $\begingroup$ There isn't a uniformly good solution. Collapsing strata will approximately preserve the proporties of post-stratification, but lose information. Multiple imputation requires an accurately specified imputation model that matches the analysis, but will work well if you have that. $\endgroup$ Jan 9, 2021 at 6:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.