Federal Reserve Economic Data

The FRED® Blog

Employer-to-employer transitions

Data from the Philadelphia Fed

Workers switch employers for several reasons, including better opportunities and pay. Working for one employer one month and a different employer the next is known as employer-to-employer worker transition.

FRED recently added new data from Fujita, Moscarini, and Postel-Vinay (FMP) that track these transitions: The Employer-to-Employer (E2E) Transition Probability data, from the Philadelphia Fed, show how likely US workers are to engage in the practice of switching employers.

The FRED graph above shows the FMP-E2E data series presented in three formats: seasonally adjusted (orange line), not seasonally adjusted (greenish line), and a three-month moving average (blue line).

Between October 1995 and October 2024, when the data are available, the probability that a worker would transition from one employer to another employer in a given month ranged between 2% and 3%. The transition probability decreased during economic recessions, the shaded areas in the graph, and it seems to hover around 2.3% during most of the past decade.

This statistic helps gauge the pace of worker reallocation and its associated impact on worker bargaining power and wage differences in the labor market.

How this graph was created: Search FRED for and select “3-Month Moving Average of Average Probability of U.S. Workers Making Employer to Employer Transitions.” From the “Edit Graph” panel, use the “Add Line” tab to search for and select “Average Probability of U.S. Workers Making Employer to Employer Transitions, Percent, Not Seasonally Adjusted.” Repeat the last step to add ”Average Probability of U.S. Workers Making Employer to Employer Transitions, Percent, Seasonally Adjusted” to the graph.

Suggested by Diego Mendez-Carbajo.

Leveraging R for powerful data analysis

FRED is a treasure trove of economic data, offering a vast array of time series data on everything from GDP and unemployment rates to interest rates and housing prices.

R is a powerful and flexible open-source programming language, widely used in data science, statistics, and machine learning. Its extensive ecosystem of packages allows users to perform complex data analysis, visualization, and modeling tasks.

FRED is user friendly and a great starting point for many. Those looking for more advanced analysis and customization often turn to programming languages like R. Today we describe one R package that works especially well with FRED data: fredo

In general, the fredo R package streamlines the interaction with the FRED API, provides an accessible interface, and allows for much customization. 

Key features of fredo

  • Automated data retrieval: Retrieve FRED data (including historical data) directly from the API using the fredo package, simplifying the process of downloading and processing the data.
  • Flexible plotting: With plot_fredo, create individual or combined plots with extensive customization, including adding recession bars, changing plot dimensions, and generating LaTeX code.
  • Data filtering: Filter data based on start and end dates for focused analysis.
  • Export options: Save plots as PDFs for use in reports, papers, or presentations.

Installation

To install fredo, use the following command to get it directly from GitHub:

# Install devtools if you haven't already
install.packages("devtools")

# Install fredo package from GitHub
devtools::install_github("manutzn/fredo")

Once installed, load the packages into your R session:

library(fredo)
library(jsonlite)

Setting up your FRED API Key

To use fredo to fetch data from the FRED API, you need to obtain an API key:

  1. Register for an API Key:
  2. Store Your API Key Securely:
    • Option 1: Assign it directly in your R script (not recommended for shared code).
      api_key <- "your_api_key_here"
    • Option 2: Set it as an environment variable in your .Renviron file. Add the following line to your .Renviron file:
      FRED_API_KEY=your_api_key_here

      Then access it in R using:

      api_key <- Sys.getenv("FRED_API_KEY")

The fredo function

The main function in the package is fredo(), which allows you to fetch data from the FRED API. The function retrieves data for specified series IDs over a date range and returns a data frame for easy analysis.

Function Signature

fredo(api_key, series_ids, start_date, end_date)

Parameters
api_key: Your FRED API key as a string.
series_ids: A character vector of FRED series IDs to retrieve (e.g., c(“GNPCA”, “UNRATE”)).
start_date: The start date for data retrieval in ‘YYYY-MM-DD’ format.
end_date: The end date for data retrieval in ‘YYYY-MM-DD’ format.

Returns
A data frame containing the combined data for all specified series, with columns including ‘date’, ‘value’, ‘id’, and ‘title’.

Basic Usage of fredo
Here’s how to use fredo to fetch data from the FRED API:

# Set your FRED API key
api_key <- Sys.getenv("FRED_API_KEY")  # Recommended method

# Define the series IDs and date range
series_ids <- c("GNPCA", "UNRATE")
start_date <- "1950-01-01"
end_date <- "2024-12-31"

# Fetch the data

Sample Output:

        date    value    id                        title
1 1950-01-01  2198.50 GNPCA Real Gross National Product
2 1951-01-01  2373.70 GNPCA Real Gross National Product
3 1952-01-01  2474.70 GNPCA Real Gross National Product
4 1953-01-01  2607.70 GNPCA Real Gross National Product
5 1954-01-01  2635.10 GNPCA Real Gross National Product
6 1955-01-01  2808.50 GNPCA Real Gross National Product

Advanced features and customization with plot_fredo
The plot_fredo function offers several parameters to customize the generated plots:

Combining multiple series
To combine multiple series into one plot, set the combine parameter to TRUE:

plot_fredo(
  dataset = fred_data,
  path = "output_directory/",
  combine = TRUE
)

Adding or removing recession bars
You can include recession bars in your plots by default. To remove them, set show_recessions to FALSE:

plot_fredo(
  dataset = fred_data,
  path = "output_directory/",
  show_recessions = FALSE
)

Adjusting plot size
Customize the dimensions of your plot by setting plot_width and plot_height in centimeters:

plot_fredo(
  dataset = fred_data,
  path = "output_directory/",
  plot_width = 20,
  plot_height = 15
)

Example workflow

# Define the series IDs and date range
series_ids <- c("GNPCA", "UNRATE")
start_date <- "1950-01-01"
end_date <- "2024-12-31"

# Fetch the data
data <- fredo(api_key, series_ids, start_date, end_date)

plot_fredo(
  dataset = data,
  path = "output_directory/",
  plot_width = 20,
  plot_height = 15
)

For more information, examples, and updates, visit the GitHub repository.

Suggested by Manu Garcia and Carlos Garriga.

Unemployment flows and labor dynamics

Recent research from the St Louis Fed

The FRED Blog has discussed the four possible reasons for being (and being categorized as) unemployed: From most to least prevalent, they are involuntarily losing a job, voluntarily leaving a job, looking for work after being out of the labor force for a while, and looking for work for the first time.

The FRED graph above shows data from the US Bureau of Labor Statistics breaking down the headline unemployment rate into these four reasons. The data are stacked to easily observe the change in the unemployment rate, and we can see a gradual rising trend between April 2023 and August 2024.

Recent research by Maximiliano A. Dvorkin and Serdar Ozkan at the St. Louis Fed offers new insights into unemployment flows during that period. They find that more-frequent job separations are the main reason behind the rising unemployment rate. Moreover, their research puts this trend in context by comparing inflows and outflows in the labor market during three different recessions: 1990-91, 2001, and 2007-09. They conclude that upticks in the proportion of people losing their jobs have been observed before the start of past recessions and that keeping an eye on labor dynamics may provide an early indication of a change in broad economic conditions.

For more about this and other research, visit the publications page of the St. Louis Fed’s website, which offers an array of economic analysis and expertise provided by our staff.

How the graph was created: Browse FRED data by Release and navigate to “Employment Situation > Release Tables > Current Population Survey (Household Data) > Table A-11. Unemployed persons by reason for unemployment.” Next, click on the boxes to the left of three categories of “Unemployed as a Percent of the Civilian Labor Force” at the bottom of the page. Last, click on the “Add to Graph” button.

Suggested by Diego Mendez-Carbajo.



Subscribe to the FRED newsletter


Follow us

Back to Top