Site icon R-bloggers

analyze the national health and nutrition examination survey (nhanes) with r

[This article was first published on asdfree by anthony damico, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
nhanes is this fascinating survey where doctors and dentists accompany survey interviewers in a little mobile medical center that drives around the country.  while the survey folks are interviewing people, the medical professionals administer laboratory tests and conduct a real doctor’s examination.  the blood work and medical exam allow researchers like you and me to answer tough questions like, “how many people have diabetes but don’t know they have diabetes?”

conducting the lab tests and the physical isn’t cheap, so a new nhanes data set becomes available once every two years and only includes about twelve thousand respondents.  since the number of respondents is so small, analysts often pool multiple years of data together.  the replication scripts below give a few different examples of how multiple years of data can be pooled with r.

the survey gets conducted by the centers for disease control and prevention (cdc), and generalizes to the united states non-institutional, non-active duty military population.

most of the data tables produced by the cdc include only a small number of variables, so importation with the foreign package’s read.xport function is pretty straightforward.  but that makes merging the appropriate data sets trickier, since it might not be clear what to pull for which variables.  for every analysis, start with the table with ‘demo’ in the name — this file includes basic demographics, weighting, and complex sample survey design variables.  since it’s quick to download the files directly from the cdc’s ftp site, there’s no massive ftp download automation script.  this new github repository contains five scripts:

2009-2010 interview only – download and analyze.R

2009-2010 interview plus laboratory – download and analyze.R

replicate 2005-2008 pooled cdc oral examination figure.R

replicate cdc publications.R

replicate human exposure to chemicals report.R (user-contributed)


click here to view these five scripts


for more detail about the national health and nutrition examination survey (nhanes), visit:


notes:

nhanes includes interview-only weights and interview + mobile examination component (mec) weights.  if you only use questions from the basic interview in your analysis, use the interview-only weights (the sample size is a bit larger).  i haven’t really figured out a use for the interview-only weights — nhanes draws most of its power from the combination of the interview and the mobile examination component variables.  if you’re only using variables from the interview, see if you can use a data set with a larger sample size like the current population (cps), national health interview survey (nhis), or medical expenditure panel survey (meps) instead.


confidential to sas, spss, stata, sudaan users: why are you still riding around on a donkey after we’ve invented the internal combustion engine?  time to transition to r.  😀

To leave a comment for the author, please follow the link and comment on their blog: asdfree by anthony damico.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.