I have some survey data and would like to address non-reponse bias by raking on 3 demographic variables for which I have decent population estimates from the American Community Survey.

The problem I am running into is that a few of the surveys are missing responses on one or more of the demographic variables (for example one survey is missing the 'Annual Household Income' entry and I am trying to rake on 'Annual Household Income'), and so these entries are NAN in the data.frame.

So far when I try to rake with a call like

csr_raked = rake(design=csr_design, 
                 population.margins = list(HHI_marginals))

where I am simply trying to rake on a single variable, I get the following error message:

Error in postStratify.survey.design(design, strata[[i]], population.margins[[i]],  : 
Strata in sample absent from population. This Can't Happen

From reading the anesrake documentation it looks like the anesrake package can handle this type of issue, so I thought that the survey package would as well and I just don't know how to tell it to (I would prefer to perform all analysis using a single package if possible).

  • $\begingroup$ Can you point to where anesrake documentation says what it does in this setting? $\endgroup$ Commented May 15, 2021 at 0:07
  • 1
    $\begingroup$ I was not reading the documentation it turns out, but a description of the anesrake package by the author which can be found here: web.stanford.edu/group/iriss/cgi-bin/anesrake/resources/… The relevant text is at the bottom of page 6 in the Missing Data section. $\endgroup$ Commented May 15, 2021 at 0:28
  • $\begingroup$ Thanks. That's a reasonable approach, and it would actually be easier to implement inside rake than inside calibrate, though it might be a pain for standard error estimation $\endgroup$ Commented May 15, 2021 at 0:34

1 Answer 1


It's not clear what you want the rake function to do here: you have a NaN category in the sample and you don't have it in the population; what scaling do you want for the weights where the value is NaN to match the sample to the population?

If you're happy to have no change in the weights for NaN observations you can use the sum of the weights for those observations as the population total for the NaN stratum. Or if you want them scaled up in proportion to total non-response, you can take the sum of the weights, scale it up for total non-response, and use that as the population total for the NaN stratum. But rake isn't going to guess.

If any function in the package were to have a feature for guessing the desired rescaling with missing strata, it would be calibrate. It currently doesn't, but if you sent the package author a request, with documentation of what you think it should do (and ideally an example with, eg, anesrake) there's an excellent chance it would be in the next version.

  • $\begingroup$ To be honest I am not clear on what I would want the rake function to do in this situation. I am new to surveys and survey analysis, and this is my first time grappling with this issue, so I was hoping that someone else had encountered this issue before me and had an idea of what to do in this situation. $\endgroup$ Commented May 15, 2021 at 0:45

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.