Solved – Post stratification weights and the survey package in R

rstratificationsurveysurvey-weights

I have survey data that needs to be weighted, and to help me with this task, I have access to the full joint distributions of the variables I want to use. As I understand it, I should use the postStratify() function in the survey package for this task, but I must admit that I am quite lost when it comes to the required syntax.

I have tried to use marginal distributions and the rake() function, this is quite straight-forward:
http://www.r-bloggers.com/survey-computing-your-own-post-stratification-weights-in-r/

But how do I incorporate all my joint distributions into the postStratify() function? The manual only lists a simple example and is a bit vague, to me at least. I have full joint distributions for 5 different variables.

Moreover, if want to use my weighted result with a function that does not take weight as an input, how should I go about and "duplicate" my rows in the final data? When I tried the rake() function I could only trim weights to an interval with a min value of 0.87. I was thinking I could round all weights to integers.

Best Answer

If you are having syntax trouble calculating post stratification weights and trimming I can recommend using www.spinnakerresearch.nl. No syntax needed. I believe you can trim max weights. However rounding weights to integers does not make sense as you will need to weight some cases down. Meaning a weight factor between 0 and 1.

Related Question