Implementing weights in R


I’m researching changes in employment and wage across race from Jan 2019 - Nov 2020 using CPS Basic Monthly (for employment) and Outgoing Rotation (for wage). It’s my understanding that I need to use (WTFINL/# of samples) for analysis of employment and (EARNWT/# of samples) for analysis involving wages. However, I have linked respondents across months using CPSIDP creating a panel dataset. Should I use weights other than WTFINL and EARNWT since I have created a panel dataset across many months? If so, how should I do this in R?

Relating to this previous question, thus far, I have found trouble implementing the EARNWT and WTFINL in R. I used the svydesign function and specified the necessary weight, but I cannot figure out what the parameters – cluster, strata, and nesting – are in the context of my data. I have reviewed this description so I’m aware they appear in my data, but I’ve found trouble identifying them. Are there better ways to implement weights in R for both descriptive statistics and regression analyses?


Your understanding of how to weight pooled Basic Monthly samples (using WTFINL/# of samples) and Outgoing Rotation Group (Earner Study) samples (using EARNWT/# of samples) is correct. An analysis in which Earner Study variables are linked to Basic Monthly variables for a subset of observations using CPSIDP should be weighted using EARNWT. More resources on Linking the CPS are available here.

As for your question about how to implement weights in R, you might find some of the example code provided on these exercises helpful (specifically the ones written for CPS which utilize R). The CPS microdata does not include any sample design variables (STRATA or PSU) that are needed for variance estimation (the source that you linked to is for IPUMS USA data, not IPUMS CPS), though survey and srvyr packages can be used to analyze replicate weights. This forum post provides syntax for using these packages in R, though I don’t believe you will be able to use replicate weights because they are only available for ASEC and some supplement files; they are not available in the basic monthly samples.