analyze the pesquisa nacional de saude (pns) with r

January 25, 2016

(This article was first published on asdfree, and kindly contributed to R-bloggers)

starting in 1988, the brazilian institute of geography and statistics (ibge) quinquennially included a health supplement questionnaire alongside their annual pesquisa nacional de domicilios (pnad) to monitor public health and inform the ongoing debate both in brasilia and within each municipalidade.  that setup worked for a while, but the survey experts at ibge knew that policymakers could only learn so much from a sidekick questionnaire.  rather than continue that second banana setup, the health survey methodologists in rio de janeiro fashioned a new instrument to work alongside the integrated system of household surveys – chief among them, the continuous pnad – in order to replace, maintain, expand that old medical module.

the pesquisa nacional de saude (pns) monitors the performance of the brazilian healthcare system, with disease surveillance, risk behavior assessment, and a familiar battery of access-to-care questions that health services researchers might be seeing for the first time in portuguese.  this is brazil’s healthcare survey.  now that ibge has published the first collection, you (yes you) have the publicly-available person-level data to begin a serious study of brazilian medicine.  individuals responding to the pns offer up information like tobacco use, sedentary lifestyles, diabetes diagnosis.  if you follow our examples, you’ll be able to draw statistically-valid conclusions along linhas like age, race, education, and yes even estado.  thanks to djalma pessoa for teaching both you and me how to work with this primary (and ultra-current) source to understand most anything about the health status of the brazilian people.  this new repository contains three scripts:

download and import.R

  • download the latest zipped household- and person-level microdata ascii files
  • import each table directly into a data.frame object with sascii
  • post-stratify each survey design according to the official documentation, so you don’t have to

analysis examples.R

  • run the well-documented block of code reviewing most of the syntax configurations you’ll need for basically any breakout that you might imagine or desire

replicate tableas.R

  • prove that r will precisely match the ibge-produced statistics and standard errors because we are thorough like that

click here to view these three scripts

for more detail about the pesquisa nacional de saude (pns), visit ibge’s pns landing page and go from there.  it’s got everything that we do not.  this is a brand new survey for you to fall in love with.

confidential to sas, spss, stata, and sudaan users: purchasing statistical software may be hazardous to your wallet.

To leave a comment for the author, please follow the link and comment on their blog: asdfree. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)