Solved – Post stratification weights in survey package in R

rsurvey

I have data collected from a survey administered on a subset of the population. I also have the population proportions of variables such as gender, race and housing type. I would like to combine the weights from each separate cross tab (of gender, race and housing type) such that the weighted proportions of my survey data matches that of the population.

I have tried the following:

library(survey)

gender.population <- read.table("http://dl.dropbox.com/u/822467/Gender.csv", header = TRUE, sep = ",")
housing.population <- read.table("http://dl.dropbox.com/u/822467/Housing.csv", header = TRUE, sep = ",")
race.population <- read.table("http://dl.dropbox.com/u/822467/Race.csv", header = TRUE, sep = ",")
survey.sample <- read.table("http://dl.dropbox.com/u/822467/survey.sample.csv", header = TRUE, sep = ",")

survey.object.sample <- svydesign(id = ~1, data = survey.sample)
survey.object.sample.weighted <- rake(survey.object.sample, list(~gender, ~housing, ~race), list(gender.population, housing.population, race.population))

str(survey.object.sample.weighted$postStrata)

I see from survey.object.sample.weighted$postStrata that weights have been assigned separately for each of the variable. My question is: Is it possible to get 1 weight for each subject instead of 3 weights as shown in the package?

Best Answer

Ok Professor Lumley of the survey package answered my question on the R-help mailing list. Here is what he said:

There *is* only one weight for each subject.

You are misinterpreting the internal structures of the package: if you
want to see the weights, use the weights() function.

The components of $postStrata are used in standard error computations.

So that wraps up this question.

Related Question