What R package is needed for IPUMS USA for weighting? Is it "survey"? Do you have sample code?


#1

I don’t have the “strata” or “cluster” variables in my dataset. I want to do person level analysis. I am using an ACS 2012-2016 microsample.


#2

The ipumsr R package includes a few vignettes which can be accessed with the vignette() command like so: vignette(‘ipums’) (you can also see the contents in the files on the github page here: https://github.com/mnpopcenter/ipumsr/blob/master/vignettes/ipums-cps.Rmd)
Under the “grab bag” header there is a brief discussion of weights. the survey package is likely the most popular way to apply weights, and while STRATA and CLUSTER are available for many IPUMS USA datasets and can improve variance estimation, they are not required by the survey package, as you can see in these helpful examples from a survey package vignette.

I hope this helps!


#3

In the “survey” vignette for R, it shows that you’re supposed to enter ID, weights, data set name, and fpc. In the example it shows the following:

dclus1 <- svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc)

FPC is supposed to be the population size, but I do not have this variable in my dataset. When I tried the following, I got an error “object ‘fpc’ not found”:

ipums.design <- svydesign(id = ~SERIAL, weights=~PERWT, data=data_CA, fpc= ~fpc)

What variables should I be using for id and fpc?


#4

See this answer to a related question.