analyze the pesquisa mensal de emprego (pme) 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.

whether or not you hit the snooze button, once every month your morning radio station probably announces the latest employment statistics for the nation.  in the united states, those headlines come from the bureau of labor statistics’ current population survey.  meanwhile down in rio de janeiro, the brazilian institute of geography and statistics (ibge) releases a staggeringly similar pesquisa mensal de emprego.  simply translated: monthly employment survey.  my friend djalma pessoa at ibge co-authored this post and the dutifully-commented code, so let me loosely paraphrase beyonce and recommend, “if you like it then you shoulda [sent him a nice thank-you note]..wuh-uh-oh..”

the primary tool to assess the brazilian labor force, this household-level survey only covers the metropolitan areas of the six largest cities (about a quarter of the nationwide population).  though there’s plenty of information about the income and circumstances of active workers, this data set contains plenty of detail about what the unemployed are trying in order to get a job themselves (employment agencies, entrance exams).  and, although this sample gets conducted as a panel, the individuals surveyed over multiple months cannot be connected across public-use files.  so there you have it.  when you’re ready to fire up your formal research of the brazilian labor market, well, this new github repository contains four scripts:

download all microdata.R
  • download each monthly zipped file, plus documentation
  • import each individual microdata table directly into r, short and sweet
  • store quick-to-load copies of each microdata table for easy access later

analysis examples.R
  • load a single month of data into working memory
  • construct the complex sample survey object, post-stratifying according to ibge specifications
  • run example analyses that calculate perfect means, medians, quantiles, totals, even ratios

unemployment rate.R


click here to view these four scripts

for more detail about the pesquisa mensal de emprego, visit:


starting in march of 2014, the pme will be re-weighted in order to hit population projections from their 2013 revision and maintain trendability over the past decade. ibge will also begin publishing weight variables that contain the same number of decimal places as are used internally to compute the published tables.  for reproducibility’s sake: manero!

although undergoing a few revisions after its preliminary launch in the early eighties, the file structure of the pme has not changed since 2002, the first month of downloadable microdata.  therefore, the code that worked on a mid-2002 microdata month should also work on mid-2012 month.  and if you’re a serious pme user, you likely also seriously speak portuguese.  in that case, you might as well get started on the portuguese-language version of their homepage.

confidential to sas, spss, stata, sudaan users: leave those bananas for the monkeys.  to r is human. 😀

To leave a comment for the author, please follow the link and comment on their blog: asdfree by anthony damico. 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.

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)