user3036922 user3036922 - 21 days ago 8
R Question

Imputation for complex survey design (nhanesIII)

I would like to impute data for a complex survey design. I have replicate weights (about 50) and a sampling weight. Although I found an example of how to do imputations in R (see below), it has a place for sampling weight (

weight=~WTPFQX6
, see a line with “designs” below”) but there is no place for replicate weights. Could you please help me figure it out how to impute data using replicate weights?

library(mitools)

library(RSQLite)

impdata <- imputationList(c("set1","set2","set3","set4","set5"),
dbtype="SQLite", dbname="~/nhanes/imp.db")

designs <- svydesign(id=~SDPPSU6, strat=~SDPSTRA6,
weight=~WTPFQX6, data=impdata, nest=TRUE)

Answer

you need to use svrepdesign not svydesign for replication-backed designs, and you no longer need to specify the id= or strat= parameters, since that information should be contained in the replication weights. the two closest examples to multiply-imputed nhanes on asdfree.com should be

https://github.com/ajdamico/usgsd/blob/3ff408b6acc0971129d0435388ff13749d3f5129/Programme%20for%20the%20International%20Assessment%20of%20Adult%20Competencies/download%20import%20and%20design.R#L188

and

https://github.com/ajdamico/usgsd/blob/d300884bd63dd05c61e8a6fa76ed7293adae55c2/Consumer%20Expenditure%20Survey/2011%20fmly%20intrvw%20-%20analysis%20examples.R#L497

but svrepdesign has a bunch of other parameters that you need to confirm you are using correctly by matching some cdc-published statistic. good luck!

Comments