HOW IS YOUR SUMMER GOING? Well okay, it’s not summer yet, but it sure is hot around where I am. Haven’t posted recently, so I’m going to share a couple of visualizations.

Per usual, we’ll use R to generate the plots and I’ll share the code below.

# Visualizing affordability

Last week the Joint Center for Housing Studies (JCHS) of Harvard University released their annual State of the Nation’s Housing report. The report is full of useful information about housing markets in the United States.

# Data

The JCHS makes data available in an excel spreadsheet (LINK .xlsx). The code below will presume that you’ve saved this spreadsheet somewhere.

We’ll have to use *readxl* (see this post for more on wrangling Excel data with R) to get the data ready to use. It’s going to involve understanding the structure of the Excel file and using some of readxl’s nice features.

The spreadsheet is pretty well organized so using the patterns described in the links above we can pretty easily get the data ready.

We are going to use two of the worksheets. Worksheet W-9 contains estimates of metro area median monthly mortgage payments and worksheet W-11 contains estimates of metro area median house price-to-median household income estimates.

Let’s go get that data and wrangle it into shape:

# Make some plots

Now that we have our data loaded and tidied we are ready to make a couple of plots. I’m going to use ggbeeswarm plots to show the distribution of our stats across metro areas. See this post) for more on ggbeeswarm plots.

For additional context we’ll add a thick black line showing trends in the U.S. level statistics over time.

## Discussion

These two plots show two ways of looking at housing affordability trends. To understand, let’s reconstruct these charts bit by bit.

First, let’s just focus on the national trends.

Consider this chart of national trends in monthly mortgage payments.

For the U.S. as a whole, monthly mortgage payments for the median-priced home ranged between $1,500 and $1,750 from 1990 through the middle part of last decade (all these estimates are in inflation-adjusted 2016 dollars). From 2004 onwards, payments reached up to nearly $2,000 before collapsing during the crash. Since then, they have recovered, but are still below historical averages.

Contrast this chart with trends in home price-to-income ratios.

The charts shows how median home prices have evolved after adjusting for trends in median house prices but not adjusting for lower mortgage rates. Here the trend is upward.

### Adding metro distributions

We’d like to compare how the distribution of these statistics evolved over time. First, let’s just consider a single year for the mortgage payment:

Each dot represents a single metro area with the black line the U.S. as a reference.

Now let’s compare just two points in time, 2015 and 2016.

By adding another year we can see that the distribution has shifted up ever so slightly.

And now that we have two, the small multiple we started with should make more sense:

# Follow-up

There’s a lot more interesting data compiled in the JCHS report. If you are interested in U.S. housing market trends, then you definitely should check out the full report (LINK pdf). The JCHS has also prepared some interesting interactive maps see for example here that have a bunch of interesting information.