1
$\begingroup$

I run rake function from the survey package of R in my data and got the weights by calling the weights() function. Sample code

small.svy.unweighted <- svydesign(ids=~1, strata = ~HZIP ,data=HHdata, weights=~Weights_1)

small.svy.rake <- rake(design = small.svy.unweighted, 
                   sample.margins = list(~agecats, ~zip),
                   population.margins = list(age.dist, zip.dist))

Questions:

  1. Are the weights return by weights(small.svy.rake) function become the new samplings weights? That is, if i run the analysis in the eg. SPSS, the weights will be my input weights?

  2. How does the algorithm manually computes the weights? I tried to manually compute it but I could not get the same weights return by weights().

$\endgroup$

closed as off-topic by mdewey, gung - Reinstate Monica, Michael R. Chernick, John, Peter Flom - Reinstate Monica Jan 16 '17 at 11:04

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – mdewey, gung - Reinstate Monica, Michael R. Chernick, John, Peter Flom - Reinstate Monica
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ What is survey package, what language? Language specific questions can be off-topic. $\endgroup$ – ttnphns Jan 15 '17 at 18:58
  • $\begingroup$ Rim or raking weighting is a way to compute frequency weights for 2+ categorical features, i.e. for multiway frequency table. It is based on proportional fitting algorithm which is quite simple. Iteratively bring marginal profiles to the wanted (target) ones by multiplying by coefficient target freqs / currently observed freqs. The method is called "rim" because it goes though marginals (sides) of the table on each iteration. $\endgroup$ – ttnphns Jan 15 '17 at 18:59
  • $\begingroup$ (cont.) Rim weighting assumes that "disproportions" in the cells of the input table were due to affected main effects only, and it aims to recover the situation "going same way back". In SPSS, you can use advanced (with options) rim-weighting macro found on my web-page (package called "weighting groups"). There is also an extension command Rake written by Jon Peck and included right with SPSS. $\endgroup$ – ttnphns Jan 15 '17 at 18:59
  • 1
    $\begingroup$ Did you read the help file...? It says it operates by repeated calls to postStratify(); if you look there there is an associated paper (Valliant R (1993) Post-stratification and conditional variance estimation. JASA 88: 89-96) that could quell some of your confusion. $\endgroup$ – gammer Jan 15 '17 at 19:32
  • 1
    $\begingroup$ hi, if you don't find the answer you are looking for in the documentation, you will need to either view the code by typing survey:::rake or step through the function with debug(rake). you can also type debug(weights) to view what happens inside of that function $\endgroup$ – Anthony Damico Jan 16 '17 at 10:43