BLS API Employment and Unemployment

Kris Eberwein

2024-03-14

The BLS Data Landscape

The most difficult thing about working with BLS data is gaining a clear understanding on what data are available and what they represent. Some of the more popular data sets can be found on the BLS Databases, Tables & Calculations website. The selected examples below do not include all series or databases.

##Categories you will find useful are:

Note: The hyperlinks above link to lists of the most popular seriesIDs, but are only a small sample of all the data tracked by the BLS.

##CPS

An example of employment statistics from is a comparison of two different unemployment rates from the CPS.

Below is the U-3 Unemployment Rate (the “official” rate) vs. the U-6 Unemployment Rate, which includes all persons marginally attached to the labor force, plus total employed part time for economic reasons, plus all persons marginally attached to the labor force.

# U3 Unemployment vs. U6 Unemployment
# More information on unemployment rates here:
# http://www.bls.gov/news.release/empsit.t15.htm
library(blscrapeR)
library(tidyverse)
df <- bls_api(c("LNS13327709", "LNS14000000"), startyear = 2000, endyear = 2015) %>%
    spread(seriesID, value) %>%
    dateCast()

tail(df)

Another example from the CPS deals with median weekly earnings by occupation. In this case, database administrators vs. software developers.

library(blscrapeR)
library(tidyverse)
df <- bls_api(c("LEU0254530800", "LEU0254530600"), startyear = 2000, endyear = 2015) %>%
    spread(seriesID, value) %>%
    dateCast()

tail(df)

##ATUS

The ATUS is a survey of how Americans use their time. A simple analysis could be how much time Americans spend watching television vs. how much time they spend socializing and communicating in a given day.

library(blscrapeR)
library(tidyverse)

df <- bls_api(c("TUU10101AA01014236", "TUU10101AA01013951"), startyear = 2005, endyear = 2015) %>%
    spread(seriesID, value) %>%
    dateCast()

tail(df)

##CES

An example from the CES would be to calculate the penetration rate of a certain industry. We can do this by dividing the number of people employed in an industry by the total employed workforce.

For example, to determine the workforce penetration rate for the Education and Health Services industry in the state of Alabama:

library(blscrapeR)
library(tidyverse)
df <- bls_api(c("SMS01000000000000001", "SMS01000006500000001"),
                startyear = 2006, endyear = 2016)

df <- spread(df, seriesID, value)
df$penetration_rt <- df$SMS01000006500000001 / df$SMS01000000000000001
tail(df)

##QCEW

The QCEW is a quarterly report that focuses primarily on specific cities, states and industries. For example, we could look at the total workforce in the Software Publishing industry in Santa Clara County, CA as compared to Orange County, FL:

library(blscrapeR)
library(tidyverse)

df <- bls_api(c("ENU0608510010", "ENU1209510010"), startyear = 2005, endyear = 2015) %>%
    spread(seriesID, value) %>%
    dateCast()

tail(df)