dataviz

Housing starts chart with special ggfx

I continue to experiment with ggfx. This week I made some charts showing U.S. housing starts. This chart emphasizes the fact that while housing starts have been increasing over the past decade, the absolute level of starts is only moderate when compared to pre-Great Recession (2008-2009) data. I like to use the ggfx::with_outer_glow functions to create a hazy glow around the density plot. Here is the R code for that chart.

Are we still in recession?

This morning the U.S. Bureau of Labor Statistics reported record high job openings in the JOLTS data. Using the code in this post I tweeted out this chart showing job openings are at a record high in the US. chart link With so many job openings you might be curious to ask whether or not the recession that started last year is well and truly over. Many indicators certainly seem to say say.

Watch your charts glow up with R and ggfx

Recently I’ve been doing some experiments with the new R package ggfx. Earlier this month I shared an example, using ggfx for good. Since then, new features have been added to ggfx and I’ve found new applications for them. In this post, we’ll take some standard charts and watch them glow up as we add new features from ggfx. Having our charts glow up might not be the best idea, Bob Rudis suggests we’re converging on Excel level graphs.

Using ggfx for good

I have been recently messing around with the new ggfx package. using #rstats ggfx::with_bloom and ggridges::geom_density left with ggfx, right without pic.twitter.com/L8yknjAJVw — 📈 Len Kiefer 📊 (@lenkiefer) March 4, 2021 Most of my applications (see below for a gallery) have maybe not been applying good dataviz guidelines. But I think I have found a good example. We can use the ggfx::with_blend function to layer a recession indicator with a time series and color code the lines.

Data visualization guidelines and a case study

Yesterday I gave a virtual lecture on data visualization at GMU. Here I’m posting the slides I used for that talk and including my discussion notes for the portion of the talk where I discussed guidelines for data visualization. At the beginning of the talk I spoke a bit about data visualization guidelines. I framed this part of my talk around Jon Schwabish’s five guidelines from his new book Better Data Visualizations see (on Amazon) and here for a blog summary.

House Prices Lift Off

Earlier today I tweeted out a chart of house prices using my inari color theme. House price growth lifting off pic.twitter.com/TvNJcOZrTF — 📈 Len Kiefer 📊 (@lenkiefer) January 26, 2021 Below is the R code to generate the plot. # load libraries library(tidyquant) library(tidyverse) # list of FRED Tickers tickers<- c("LXXRSA","SPCS20RSA","LVXRSA","SEXRSA", "SFXRSA","NYXRSA","BOXRSA","SDXRSA","CHXRSA", "DNXRSA","PHXRNSA","DAXRNSA","WDXRSA", "ATXRNSA","MIXRNSA","POXRSA","MNXRSA","DEXRNSA","TPXRSA","CRXRSA","CEXRSA") # list of city names cities <- c("Los Angeles","20-city","Las Vegas","Seattle", "San Francisco","New York","Boston","San Diego","Chicago", "Denver","Phoenix","Dallas","Washington DC", "Atlanta","Miami","Portland","Minneapolis","Detroit","Tampa","Charlotte","Cleveland") df.

Seasonally adjusted greetings and low low mortgage rates

Seasonally adjusted greetings to you and yours. For you I have an animated chart, a variation on our rate cloud with a wintry theme. R code below. We’ll grab mortgage rate data, make a few new variables and then plot the chart using ggridges::geom_density_ridges2. Using the raincloud option for the poisition argument in ggridges::geom_density_ridges2 places the individual data points below the density plots. Using various shades of white we can turn the rain cloud into a snow cloud.

Talking Dataviz

Today I got to talk #dataviz and shared a bunch of my charts, which always sort of feels like sharing my vacation photos. But it was fun to talk about why I made some of these charts, what they mean, and how different data visualization techniques can bring out new insights in familiar data. The pdf version is below or here. The pptx version has animations, get it here.

Visual Meditations on House Prices 2020 Edition

VISUAL MEDITATIONS are the analysis of repeated graphs of the same data with variations on a graphical theme. When altering the mapping of data to aesthetics sometimes interesting patterns emerge. I find it a useful practice. I made a series of these a few years ago with different charts. The chart images have been lost to past blog migrations, but the code should still work. In this post, I want to consider several alternative ways to visualize house prices.

y-axis on the right side

Recently I’ve been putting my y-axis labels on the right for some time series. I think this idea has been rattling around in my head since it was suggested on Twitter by Maarten Lambrechts: A y-axis on the left is almost always the default, while the most recent and usually most relevant data are on the right. Then shouldn't a y-axis on the right be the default (when there are no data labels), to improve legibility?

Powder blue charts

Yesterday I shared with you observations on the economy, which form the core of many of my recent economic outlook talks. In that article I used some charts with alternative formatting. No not spooky, but a blue theme kind of like those alternative road uniforms some sportsball teams wear. Here, I will share with you the R code for these delicious plots. Setup First we’ll need to set up our chart theme, tweak some ggplot2 defaults and load some libraries.

US house prices accelerate

Today the FHFA released their house price index for August 2020. Per the report house prices in August 2020 increased 1.5 percentage points over the prior month (19.6% at an annualized rate). Over the last 12-months US house prices have increased 8%, and over the last 3-months they have risen over 15% on an annualized basis. That is an acceleration of over 7.5 percentage points, the largest turnaround in house price growth since the inflection point in 2009.

Chart Style 1979

Earlier today I tweeted out an update of our skyline mortgage rate chart. Gray Kimbrough (follow him on Twitter to get all your Millennial Myths busted) pointed out that my chart style was close to famous art style of Joy Division’s 1979 album Unknown Pleasures. That was exactly right, because I arrived at the skyline mortgage rate chart by tweaking my original application of ‘ggridges::geom_density_ridges’ (formerly known as Joyplot) code to arrive there.

Text mining the 2020 Fed Beige Book

Let’s update our earlier analysis to examine the Federal Reserve’s Beige Book. Following my earlier post, we can construct a sentiment measure for each report. It turns out that after turning sharply negative in spring, the October 2020 report returned to positive territory. The sentiment index looks at all words and after adjusting for economics terms (like gross) we score them for sentiment. We could just count up the number of times we see words like “stong” vs words like “weak”.

Mortgage rate skyline chart

About a year ago I made a chart and Bob Rudis dubbed it a skyline chart. Here’s an updated version I made today. The chart shows a historgram over US weekly average 30-year mortgage rates by year broken into 1/8 percentage points buckets. We see that through this past week, 30-year mortgage rates had spend eight weeks around 2.875 percent. R code The R script below will generate it (using my darklyplot package’s theme_dark2 function).

Using darklyplot

Yesterday I announced that I wrote a simple R package darklyplot. This is a vignette I have built to help explain ways you can use the package. The goal of darklyplot is to create simple time series plots with a dark background. The miniminum and maximum values are highlighted, and color coded along with the y axis and x axis labels. This vignette walks through basic usage and explores some of the package options.

Gradient shading with ggplot2

Over on Twitter Grant McDermott shares a neat ggplot2 trick: A shortcut I like to use is calling multiple geoms in an lapply() call, since this automatically generates a list. Works well for investigating plotting variations, e.g. ggplot(diamonds, aes(carat)) + lapply(c(50,200), function(b) geom_histogram(bins=b, alpha=0.3)) https://t.co/hf0vtvDkbk pic.twitter.com/jmmqlyJEKo — Grant McDermott (@grant_mcdermott) June 22, 2020 I applied this trick to create a gradient fill for a chart. Looks kind of like Kool-Aid.

The Coronavirus Recession

Coronavirus Recession Over on LinkedIn I posted a summary of recent economic talks I have been giving: The Coronavirus Recession. Read the whole things for analysis and lots of charts, but I leave off with three key questions: Recession was here, but is it already gone? Housing market indicators have rebounded, but will the recovery be sustained? After effects of shutdown and possible second wave to the pandemic remain as risks to the outlook, how big are these risks?

Presentation Quadfecta and Jobs Friday June 2020

Yesterday I completed the elusive presentation quadfecta. I did a talk on Zoom, Teams, WebEx and Skype. These communication apps are great, but after a few hours of maintaining “resting Zoom face” (you want to look interested as the camera is always rolling), I felt a bit exhausted. But it was totally worth it. The highlight for me was being able to join Jeffrey Shaffer, Steve Wexler, Amanda Makulec, and Andy Cotgreave for Chart Chat.

State unemployment rate dataviz

A couple years ago I posted R code for a remix of a remix of a US state unemployment rate chart. Post Working on a workout. Some of the images were lost in a blog transition. We’ll update below. Here’s an updated version: And another remix focusing just on April 2020 (latest data). R code ###################### ## Load Libraries ## ###################### library(data.table) library(quantmod) library(tidyverse) library(geofacet) # Download data big file ur.

Tornado Charts

Earlier this week, I made a boss chart: https://t.co/6wf40jtqHI pic.twitter.com/xlv3Uzpiv0 — 📈 Len Kiefer 📊 (@lenkiefer) May 12, 2020 While listening to Chart Chat I heard Jeffrey Shaffer, Steve Wexler, Amanda Makulec, and Andy Cotgreave discuss tornado charts. I decided it might be a good idea to make one. Because I’m not sure I can trust with the awesome power inherent in these charts I won’t post R code here.

Updated Favorite Data Visualizations

I’ve decided to create a post where I can regularly update some favorite data visualizations. Where I’ve previously discussed the data or shared code I will provide a link. Often I’ll update the charts and post them on Twitter soon after the data is released. I won’t be updating these that quickly, but I’ll do my best to keep up. As I update some more charts I may add to the list.

US Labor Market Update

Today the U.S. Bureau of Labor Statistics released its monthly employment situation summary for March 2020. While many were expecting the U.S. labor market to show some weakness as the U.S. economy shuts down to battle COVID-19, the magnitude of the contraction surprised many. Because the reference week for the employment report was March 8th through March 14th, before the nationwide shutdown took full effect, many were expecting a relatively mild report.

30 sigma

Earlier today I tweeted out a chart of the U.S. Labor Department’s estimate of initial jobless claims Link to pdf report. weekly jobless claims, a 30σ event pic.twitter.com/LEO7s5TXsH — 📈 Len Kiefer 📊 (@lenkiefer) March 26, 2020 Below I share R code to generate a chart like the one above. We can get data from the St. Louis Fed’s Federal Reserve Economic Data (FRED). Then it’s easy to make an animation.

Map of maps

On Friday a colleague showed me an interesting chart, a map of maps. I believe the original was made in Tableau, but I decided to spin one up in R. I tweeted out the picture: A map of maps, showing the correlation between state house price growth rates You see pretty strong spatial correlation, with some interesting exceptions. Florida correlated with AZ, NV pic.twitter.com/9hzwZLkb41 — 📈 Len Kiefer 📊 (@lenkiefer) March 6, 2020 In this post I will supply the R code to make one.

Location Quotient Map

I have been thinking about how the recent volatility could impact the economy. If travel and tourism contract due to fears of a pandemic, the impact will differ in markets around the United States. One way to think about this is to compute the Location Quotient, or the percentage of the employment in an area that is in the leisure and hospitality industry. Conside the graphic below: This map shows areas (states and core based statistical areas) color-coded by their location quotient.

Double Trouble Hazard of Dual Axis Charts

In a blog post the dual y-axis chart just say no Tim Duy asks analysts to give up dual y-axis charts for a new year’s resolution. Like with many resolutions, I predict most will fail at this challenge. I also predict few will take it up. Dual y-axis charts are super popular, especially in finance/economics. As you all know, I care a lot about data visualization. And I have been fighting a losing battle against dual y-axis charts for about a decade.

Shady housing market chart

I shared a chart recently on Twitter that got some attention: static version pic.twitter.com/vtD54nXGio — 📈 Len Kiefer 📊 (@lenkiefer) November 14, 2019 But not just any attention (though I do appreciate all your likes and retweets). This was special. Robert Allison [at]RobertAllison__ at SAS replicated the chart with SAS software and wrote a blog about it. These mortgage rates look shady to me. I worked on a lot of SAS stuff early in my days working at Freddie Mac, and Robert’s SAS graph examples were a resource I often used.

Visualizing consumer price inflation and mortgage rates

Today I tweeted something that turned out to be pretty popular: US consumer prices pic.twitter.com/LxIxvEnGFe — 📈 Len Kiefer 📊 (@lenkiefer) October 10, 2019 This was an update to a visualization we have talked about here. In this post I want to provide some updated R code to make this visualization taking advantage of the new gganimate api. I’ll also share some code for mortgage rate plots. The code for the inflation plot is pretty simple.

Tiny R Code for Smoothing Data

I’ve been thinking about smoothing time series data. I tweeted out a bite size bit of code. To fit it into a tweet, I had to squeeze things down a bit. Slightly more verbose, and using fredr to get data from FRED using their API. You’ll need an API key from FRED. These data happen to be for New Private Housing Units Authorized by Building Permits - in Structures with 1 Unit.

ARIMA for Ernie

Early last Friday morning I was sitting in Palm Springs International Airport waiting to catch a flight back to Virginia. I had traveled out west to speak at the 2019 NAGLREP Conference. This Friday happened to be jobs Friday, when the U.S. Bureau of Labor Statistics releases the employment situation. Jobs Fridays are busy on Twitter. Everybody seems eager to offer a perspective on what the latest jobs numbers mean for the U.

Theme Inari

Over the summer I spent a few weeks in Asia. One of the places I visited was Fushimi Inari-taisha in Kyoto, Japan. This shrine is situated on a beautiful mountain. What really struck me about this place was the vibrant colors used in the Torii gates and to decorate some of the fox statues like these: The color got stuck in my head, so I decided to look up the hex code here and created a modified ggplot2 theme using the color.

Crazy Yield Curve Charts

Earlier today I tweeted out some yield curve charts. I won’t go into great detail into the why, but here I will share some R code to make the charts. My Thread: hope you all are ready for some crazy yield curve charts, cuz you're about to get some crazy yield curve charts — 📈 Len Kiefer 📊 (@lenkiefer) August 7, 2019 We can get Treasury yield curve data from the U.

Housing usually heats up in summer

I have been exploring some visualizations for housing seasonality. In recent days I’ve tried out various ways of using tile plots to display seasonal patterns in home sales and other related data. In this post I want to share some of the R code I used to wrangle data and generate those plots. You can see some for example, in this thread (and others): though outside there's blistering heat

Real House Price Trends

Let us take a look at house price trends in the United States and across states and metro areas. Earlier this week I tweeted out a few charts on housing market trends. In most of the middle part of the country over the past 44 years there has been little growth in real (inflation-adjusted) house prices. In coastal states, a very different story. pic.twitter.com/PLbiNftha3 — 📈 Len Kiefer 📊 (@lenkiefer) July 10, 2019 In this post we’ll analyze real house prices since 1975, and per usual use R to wrangle data and make plots.

EPOP becomes Fedspeak

If I cannot send Adam Ozimek (at Modeled Behavior ) a Diet Pepsi, then the next best thing might be a chart about epop. epop is the term economists use to describe the employment-to-population ratio, a useful summary statistic about the labor market. Perhaps the summary statistic. Adam (and others) has been talking about epop as a key labor market statistic for years. It seems the Federal Reserve is catching on to the usage of the term epop (though many economists over there have been looking at the statistic for a long while too).

Charting the housing expansion with R

Last week I posted a long thread comparing trends in various housing market indicators over on Twitter: Assuming we aren't in recession right now, the current expansion will tie the 1990s expansion for longest in U.S. history. Let's take a look at how housing markets have behaved in this expansion relative to earlier ones a thread... pic.twitter.com/ovaiq3lsA8 — 📈 Len Kiefer 📊 (@lenkiefer) June 12, 2019 I followed it up with an article on LinkedIn with some more commentary The U.

Population Growth and House Prices 2010 to 2018

Recently the U.S. Census Bureau released updated population estimates through 2018 for the United States, states, counties, and metropolitan statistical areas (MSA). Press release I tweeted out the following chart comparing house prices and state population dynamics. demographics are an important driver of #housing market trends. here's a comparison of growth in state population and nominal house prices since the year 2000 left to right: more people bottom to top: higher home prices pic.

Housing construction and population growth

Earlier this month I attended the National Association for Business Economics (NABE) annual policy conference in Washington D.C. LINK. One of the keynote speeches was by Alan Greenspan. During his remarks, Greenspan mentioned that while economic forecasting was hard demographic projections were the surest thing in an uncertain business. Demographics of course are not easy, but it’s much easier to guess what the population of 30 years olds will be in 5 years than it is the predict the unemployment rate or GDP in 5 years.

Mortgage rates and housing construction

The U.S. housing market stalled out a bit in 2018 and we aren’t building enough homes to match demand. See my recent speech for details on what’s going on. Abbreviated version: in 2018 mortgage interest rates slowed housing activity, but demographic forces support housing demand and should provide a lift in years to come. Together with a recent moderation in mortgage rates there’s reason to be optimistic about housing market activity in 2019.

Vulnerable Economy Plots

Last week I gave a speech in Cincinnati, Ohio at the UC/PNC Economic Outlook program. My speech was titled “Forecasting in a Vulnerable Economy”. You can find slides and detailed notes over on LinkedIn: https://www.linkedin.com/pulse/forecasting-vulnerable-economy-leonard-kiefer/. In this post I want to share R code for the first three plots on the Vulnerable Economy. We’ll get the data via the St Louis Fed’s FRED. We’re going to grab the Fed Funds rate FEDFUNDS, the Unemployment Rate UNRATE the Congressional Budget Office’s estimate of the long-run natural rate of unemployment NROU and the spread between the 10-year and 2-year U.

Animated Labor Force Participation Chart

Here’s some R code for an animated chart of the U.S. prime working age (25-54) labor force participation rate. I tweeted it out last Friday: Labor force participation rate #dataviz made with #rstats #gganimate pic.twitter.com/uSICoLjbIf — 📈 Len Kiefer 📊 (@lenkiefer) February 1, 2019 We can go to the U.S. Bureau of Labor Statistics (BLS) webpage (https://www.bls.gov/) and get these data. For more details see my post Charting Jobs Friday with R.

Running Python from R with Reticulate

Because reasons I’ve been interested in picking up some Python. But I like the Rstudio IDE, so it sure would be nice if I could just run Python from R. Fortunately, that’s possible using the reticulate package. Let’s give it a try. Our strategy will be to use R to do the data wrangling and then pass the data to Python to make a plot. Is this a good idea?

Masters in Business

I went up to New York and spoke with Barry Ritholtz on his Masters in Business podcast. Some links: The podcast A transcript Bloomberg View: Every Graph Tells a Story I am really glad I got the chance to chat with Barry and share some of my story. Have a listen if you want to learn more about my work and background, the mortgage finance industry, and how I use data visualization.

Rstudioconf Poster

I really like R, but I love the R community. Since I’ve started using R intensively in the past couple of years, I’ve constantly been awed and inspired by all the amazing things that people are doing with R. The spirit of the open source community and people’s willingness to share their thoughts and code is fantastic. Many times in this space we’ve remixed different data visualizations with R, often relying on awesome new packages that others have developed.

Go Go Animate!

At the start of the year, the R package gganimate hit CRAN. See this announcement blog post with some examples. In this space, I’ve shared several posts on animation see tags. But I haven’t been using gganimate. Instead, I took a more direct approach building the animations via loops and trying to tween directly if I wanted a smooth animation. This level of control is nice, but frankly the defaults in gganimate work better than many of my attempts to hand craft it.

Forecasting is still hard

It’s the time of the year where everybody is dusting off their crystal balls and peering into the future. There’s even still time to send out your “Winter is Coming” newsletter. Let’s take a step back and look at how forecasts of U.S. macro variables have evolved. Is forecasting still hard? Last year we looked at historical forecasts of economic conditions in the post forecasting is hard. Let’s update it.

Housing Starts Stall

U.S. housing markets have slowed down in 2018. Housing construction, which is still running well below both historical averages and what the U.S. currently needs to meet rising demand has stalled out this year. The current level of housing construction is close to the level we’ve seen in recession periods. And the historical comparison stretching back decades is comparing a nation with significantly fewer households. Total U.S. households for example, in 1970 were about 1/2 (63 million) of what they were in 2017 (126 million) FRED chart.

JOLTS update

It’s been a while since I posted here. I’ve got some longer form things in the works, but let’s ease back into it. Let’s take a look at the latest Job Openings and Labor Turnover Survey (JOLTS) data via the U.S. Bureau of Labor Statistics. This post is an update of this post. Per usual we will make our graphics with R. First, let’s look at aggregate trends.

Facets in space and time

My studies involve a lot of data organized in space and across time. I look at housing data that usually captures activity around the United States, or sometimes the world, and almost always over time. In my data visualization explorations I like to study different ways to visualize trends across both space and time, often simultaneously. Let’s consider a couple here in this post. Per usual we will make our graphics with R.

Core Inflation Viz with Progress Bar

About a year ago I shared code for a dataviz with a progress bar. Let’s update that R code using gifski and tweener. The code below will generate this animated gif: Gif code. Click for details. # CPI VIz with progress bar---- # set up your directory mydir <- "PATH_TO_YOUR_DIRECTORY" # libraries ---- library(data.table) library(tidyverse) library(tweenr) library(gifski) library(ggridges) library(extrafont) library(scales) library(cowplot) # make plots ---- # Get data----- # CPILFESL is FRED mnemonic for CPI: All Items Less Food and Energy # https://fred.

State employment dataviz

Today was JOLTS Tuesday, when the U.S. Bureau of Labor Statistics releases updated data from the Job Openings and Labor Turnover Survey. I was talking about it earlier today, but before we get into that… If you care about dataviz check this out I saw this on Twitter today via Jon Schwabish. Link to a handy dataviz cheatsheet outlining Jon’s core dataviz principles. Prints out nicely on pdf. Back to the JOLTS.

Charts within charts

Maybe you are of the opinion that charts should have their y axis extend all the way down to 0, even if the data live far away from zero. I’m not sure if that’s always the right thing to do. But if you are strict about this, how can you use the space? One thing I experimented with in my Mortgage rates in the 21st century post was filling the area under a line with progressively fainter area.

Global house price trends

In this post I want to share updated plots comparing house price trends around the world. Or at least part of the world. Our view will be somewhat limited, based on data, but will at least allow us to see how U.S. house prices compare to a few other countries. The details behind these plots are explained in more detail in this post, but some of the images were lost due to my blog transition.

House price gif that keeps on giffing

This tweet turned out to be popular: 👀house price trends👀 pic.twitter.com/JXB5P0H84A — 📈 Len Kiefer 📊 (@lenkiefer) August 1, 2018 It’s a remix of a chart we made here, though it uses a different index. In the earlier post, we used the FHFA house price index, but this one used the Case-Shiller Index, which was released today. Let me just post two gifs and then below will be the R code I used to create them.

Getting animated about new home sales

Indications are that U.S. housing market activity in the middle part of 2018 has moderated. Home sales estimates for both new home sales and existing home sales declined on a seasonally adjusted basis in June relative to May. House price growth has also moderated recently. Some folks have gotten animated about the recent trends. I’m more sanguine about the recent data. Certainly a slowdown in housing market activity would be cause for concern.

House price gifski

I saw today, via Ropensci a blog post about a new package for making animated gifs with R called gifski now available on CRAN. Let’s adapt the code we shared last week to use the gifski package. See that post for additional details. If we run the R code below we’ll generate this animated plot: This plot shows the evolution of house prices in two states, California (CA) and Texas (TX) versus the United States (USA).

Connected scatterplot

On Twitter Claus Wilke asks: Dear Lazyweb: Is there an accepted name for a plot showing a two-variable time series as a path in the x-y plane? #dataviz@Elijah_Meeks @albertocairo @lenkiefer @sharoz @dataandme pic.twitter.com/N8Edmf8qii — Claus Wilke (@ClausWilke) July 21, 2018 I call them connected scatterplots, and we’ve made a few here. See for example this post. But we can intensify things and make a plot like this: hey @ClausWilke why stop at a 2-d connected scatterplot* when you could go to 3-d

Mortgage rates in the 21st century

Let’s compare two charts. “Your chart”, or a chart that might come virtually unedited from spreadsheet software versus the chart your boss told you not to worry about: Your chart is perfectly serviceable and for a quick exploration might be perfectly fine. However, why routinely generate such charts if you have the ability to make something a bit more dynamic? Being able to produce more interesting charts might not be necessary, but it also probably doesn’t hurt.

Exploring housing data with R and IPUMS USA

In this post I want to share some observations on housing in the United States from 1980 to 2016, share some R code for data wrangling, and tri (no that’s not a typo, just a pun) out a visualization techniques. Let’s get to it. I’ve been carrying a running conversation with folks on Twitter regarding the U.S. housing market and its future. Much of that depends on the evolution of demographic forces.

Plotting house price and income trends

In this post we will create some plots of house prices and incomes for the United States and individual states. We will also try out the bea.R package to get data from the U.S. Bureau of Economic Analysis. We’ll end up with something like this: Per usual we’ll do it with R and I’ll include code so you can follow along. Data We’re going to use two sources of data.

Pomological Plots

In the real world, when I give talks and use slides I am typically constrained in my aesthetic. Often I’m speaking at a work-related thing and we have a corporate template and color scheme. They serve us well and I’ve found restraint helps focus on the message. Usually I’m setting out to inform, so direct, repeatable and easy to follow are key. But I also like to explore new ideas and different themes on the side.

Spotlight on housing affordability

IN MY LINE OF WORK, (finance/economics) you see a lot of dual axis line charts. I am of the opinion that dual y axis charts are sort of evil. But in this post I’m going to make one. It’s for a totally legit reason though. Like in an earlier post we’ll make a graph similar to one I saw on xenographics. Xenographics gives examples of and links to “weird, but (sometimes) useful charts”.

Jobs Friday May 2018

TODAY WAS JOBS FRIDAY. LET’s create a couple plots to show the trend in employment growth. Each month the U.S. Bureau of Labor Statistics (BLS) releases its employment situation report. Let’s make a couple plots looking at trends in U.S. nonfarm payrolls. Per usual, let’s make a graph with R. Data We can easily get the data via the Saint Louis Federal Reserve’s FRED database. If you followed my post from back in April of last year you know what we can do if we combine FRED with the quantmod package.

What's up? VSUP, that's what's up.

IN THIS POST WE SHALL EXPLORE VALUE-SUPRESSING UNCERTAINTY PALETTES. One of my favorite new sites is xenographics that gives examples of and links to “weird, but (sometimes) useful charts”. The examples xenographics gives are undoubtedly interesting and might help inspire you if you’re looking for something new. One new (to me) graphic was something called Value-Suppressing Uncertainty Palettes (VSUP). See this research paper (pdf). VSUPs “allocate larger ranges of a visual channel when uncertainty is low, and smaller ranges when uncertainty is high”.

Expanding Expansions, Contracting Recessions

IN THIS POST I WANT TO SHARE A GRAPH looking at the length of economic expansions and recessions in the United State over time. Earlier today, Andrew Chamberlain (on Twitter), observed that at the end of this month the current economic expansion in the U.S. would be the second longest in history. Let’s explore. In the United States, the National Bureau of Economic Research (NBER) dates expansions and recessions. See for example http://www.

April 2018 Housing Market Update

LAST WEEK I POSTED A THREAD ON TWITTER COVERING RECENT HOUSING MARKET TRENDS AND THE OUTLOOK FOR MORTGAGE RATES: #Mortgage rates are now at their highest level since January 2014. Will these higher borrowing costs dampen the spring homebuying season? Some thoughts (+ charts)... pic.twitter.com/BegOb7p6iq — 📈 Len Kiefer 📊 (@lenkiefer) April 19, 2018 Let’s unpack that thread and add a few more charts I’ve tweeted out in the past week.

Rate Cloud

TIME FOR A FUN NEW MORTGAGE RATE CHART. This one: We’ll use R to plot a new visualization of mortgage rates. Let’s make it. Data As we did with our majestic mortgage rate plot post we’ll plot mortgage rates using the Freddie Mac Primary Mortgage Market Survey. We’ll get the mortgage rates data via the Saint Louis Federal Reserve’s FRED database. If you followed my post from back in April of last year you know what we can do if we combine FRED with the quantmod package.

Pipe Tweenr

I LIKE TO MAKE ANIMATIONS WITH R. Sometimes folks ask me how they add to understanding. They don’t always, but often, particularly when you are working with time series, I find they help visualize trends and understand the evolution of variables. I’ve written several posts on animation, see particularly this recent post on making a simple line plot and this post about improving animations with tweenr. Tweenr is a handy package that lets you interpolate data and make smooth animations.

Forecasting Game

LET’S PICK BACK UP where we left off and think about communicating forecast results. To help guide our thinking, let’s set up a little game. Basic setup Like last time we’re going to focus on a situation where a forecaster observes some information about the world and makes an announcement about a future binary outcome. A decision maker observes the forecaster’s announcement and takes a binary action. Then the outcome is realized and the forecaster receives a payoff.

Charting Jobs Friday with R

LAST FRIDAY WAS JOBS FRIDAY, the day when the U.S. Bureau of Labor Statistics (BLS) releases its monthly employment situation report. This report is blanketed with media coverage and economist and financial analysts all over the world pay close attention to the report. The employment situation gives a read on trends in the world’s largest economy’s labor market. It also provides a clue about how monetary policy might unfold, affecting bond yields around the world.

Rock that dadbod plot!

Spring is nearly upon us, or at least we can hope. Let’s examine how housing activity typically rounds into shape as the weather warms up. We’ll make some fun plots with R. Seasonality in housing data Housing market activity in the United States is highly seasonal. Consider this animated plot. This plot shows U.S. new home sales. Often the data are presented seasonally adjusted, but this plot is for non seasonally adjusted data.

Employment growth and house price trends

LET US TAKE A LOOK AT HOUSE PRICE AND EMPLOYMENT TRENDS. House prices in the Unitest States have been increasing at a rapid pace, about 7 percent on an annual basis. How does that relate to employment growth? And how do those trends vary by geography. Let’s take a look. Per usual, I will post R code and you can follow along. Data Following recent posts (see here and here for example), we will use the Freddie Mac House Price Index an Excel spreadsheet can be downloaded here.

More house price plots

SO TODAY I SPENT SOME TIME WITH THE KIDDOS and contemplated the Enlightenment, so I didn’t have time to write up some code. But I will post a couple images that I think are interesting. I’ve got two plots for you, both using geofacets. See this post on using the geofacet package in R to make plots like these. The first plot shows U.S. house price trends by metro area from January 2015 to December 2017.

February 2018 housing market update

EARLIER THIS WEEK I TWEETED out a poll asking whether or not folks wanted to see a thread/tweetstorm with slides from an upcoming presentation on the economy and housing markets that I’m giving. Over 90 percent voted for a thread. So I shared it. In this post let me add a little more commentary on the individual slides. Here’s the thread I ended up posting: Thread (0/5). I'm giving an update on economy, #housing and #mortgage market trends.

Comparing recent periods of mortgage rate increases

THIS MORNING I SAW AN INTERESTING CHART OVER ON BLOOMBERG. In this post they compared recent 10-year Treasury yield movements with the Taper Tantrum in 2013. The chart you can see here was an area chart with overlapping line plots. I thought it would be a fun exercise to remix a similar chart with R. Eventually it will look like this: Let’s make our remix and try out a few alternative plots.

Me on a podcast

Hey check it out! Me on a podcast: https://policyviz.com/podcast/episode-111-len-kiefer/. We talk about data visualization and how I use it at work. A bit about using R too. I got the opportunity to talk with Jon Schwabish on the Policyviz podcast. Jon’s PolicyViz blog has a lot of cool data visualization stuff, including chart remakes and thoughtful discussion. There’s a bunch of other neat stuff on the page too. So check out the podcast and take a look around the page, there’s a lot of useful stuff there.

Simple animated line plot with R

IN THIS POST I WANT TO SHARE R code for a simple animated line plot using ggplot2. In the past I’ve shared similar code, but over time my workflow has evolved. So I thought it would be good to post an updated bit of code. We’ll use economic data from the St. Louis Federal Reserve Economic Database (FRED). See for example this post for more on using FRED with the tidyquant package.

Plotting U.S. Macroeconomic Trends with FRED and R

LET’S TAKE A LOOK AT RECENT U.S. macroeconomic trends by making a couple plots with R code. Since we’re going to be looking at U.S. macroeconomic data, the data we’ll need is available in the St. Louis Federal Reserve Bank Economic Database FRED. Below I’ll walk you through creating the plots. Where are we in the business cycle After the BLS released their employment situation report (the Jobs report) last week I tweeted out:

Housing market dataviz: week of November 22, 2017

IT IS THANKSGIVING WEEK HERE IN THE UNITED STATES. I’m getting ready to go out for a nice casual drive down Interstate I-95. Should be fun. After I get back stuffed with turkey and whatnot, we’ll get back to data visualizations and analysis. But let me leave you a couple animated gifs showing recent housing and mortgage market trends. Mortgage rate trends First, let’s just look at a line plot of trends in the 30-year fixed mortgage rate:

Majestic mortgage rate plot

COME AND MAKE A MAJESTIC MORTGAGE RATE PLOT WITH ME. We’ll use R to plot a few visualizations of mortgage rates. I recently gave a number of talks about the economic outlook and housing. One point I like to make is that mortgage rates are low. I’ve shown this through a variety of visualizations. But one of my favorites looks like this: Let’s make it. Data We’ll plot mortgage rates using the Freddie Mac Primary Mortgage Market Survey.

Tour of U.S. metro area house price trends

HEY! HERE IS A VIDEO SHOWING HOUSE PRICE TRENDS around the United States. Earlier this year we looked at how to get the data and plot it using R. I made the video using the PowerPoint to .mp4 workflow I outlined here. Below I’ll review how to build this file. Get data We are going to use house price data from the publicly available Freddie Mac House Price Index.

JOLTS a dataviz trilogy

LET’S TAKE A LOOK AT RECENT LABOR MARKET TRENDS IN THE UNITED STATES. Below we’ll plot labor market trends using the U.S. Bureau of Labor Statistics Job Openings and Labor Turnover Survey (JOLTS). Last year we looked at how to get the data and plot it using R. Look to that post for more details, though I’ll include all the code we need below at the bottom. A trilogy of plots First, let’s look at some static plots.

Combining PowerPoint and R's tweenr for smooth animations

IN THIS POST I WANT SHARE A METHOD FOR MAKING SMOOTH POWERPOINT ANIMATIONS USING R. Also see other posts in this series: Crafting a PowerPoint Presentation with R LINK PURRRTY PowerPoint with R LINK PURRRtier PowerPoint with R LINK Motivation Why would you want to do this? We’ve covered how to make an animated gif with R and that works pretty well. But there are a couple advantages with this approach.

Purrrtier PowerPoint with R

WE ARE ON OUR WAY TOWARDS BUILDING a tidy PowerPoint workflow. In this post I want to build on my earlier posts (see here for an introduction and here for a more sophisticated approach) for building a PowerPoint presentation with R and try to make it even purrrtier. I saw that somebody shared my posts on reddit and I thought I would take a look at the comments. Folks on the internet are known for kindness and offering helpful advice right?

Mortgage rates are low!

MORTGAGE RATES ARE LOW IN THE UNITED STATES. How low? Let’s take a look. We’ll use R to plot a few visualizations of mortgage rates. We’ll also try out some of the nice features in the tibbletime package that help when working with time series data. For more on using tibbletime see this post and this one on making animated plots. Since I was already called out for alleged chartcrimes, I’m going to go ahead and let loose here.

Time to animate with tibbletime

IN THIS POST I WANT TO SHARE SOME CODE TO CREATE AN ANIMATED CHART of housing starts. Per usual we’ll use R and we’ll also use the tibbletime package. Running the code below will generate: (see this post for more on animations with the R package tweenr) ##################################################################################### ## Load libraries ## ##################################################################################### library(tidyquant) library(tibbletime) library(tweenr) ##################################################################################### ## Get housing starts data ## ##################################################################################### df <- tq_get("HOUST1F",get="economic.data",from="1959-01-01") ##################################################################################### ## function for rolling windows ## ##################################################################################### mys <- function(win=12){ rolling_mean <- rollify(mean, window = win) #function creates rolling average based on win df %>%mutate(dy=rolling_mean(price), w=as.

Unemployment Flexdashboard

IN THIS POST I WANT TO REVISIT FLEXDASHBOARDS. Back in January we made several Flexdashboards with R to display economic data. See my guide to building a flexdashboard for some examples. In this post, I want to use the tidyquant package to wrap some of the plots we made earlier into a flexdashboard. I’ll have more to say about this in the near future, but I just wanted to make a simple flexdashboard (partially to remind myself how to do it).

Bivariate tilegridmaps with R

I HAVE BEEN EXPERIMENTING WITH A NEW WAY TO VISUALIZE DATA, a bivariate tilegridmap. When I get around to rolling out my tidyPowerPoint workflow we’re going to want something other than bars and lines to fill it up. A graph like this might be a fun option. We’ll build one, but first, just let me show you one I tweeted earlier today: bivariate #tilegridmap map anyone? pic.twitter.com/y3G5XExzoN — 📈 Len Kiefer 📊 (@lenkiefer) October 11, 2017 In this post, let’s go over how to make this plot with R.

quick geofacet plots

WHILE I WAS TRYING TO MAKE TIME FOR TIBBLETIME yesterday I got distracted and made this plot: hey! here's a #dataviz: tile plot of U.S. state unemployment pic.twitter.com/vH8fSu63ve — 📈 Len Kiefer 📊 (@lenkiefer) October 10, 2017 In this post, let’s go over how to make this plot with R. And we’re going to make it quick. Setup In order to create a plot like this we’ll need several packages, including the tidyverse, geofacet and the tidyquant package.

What time is it? Time for tibbletime!

WHAT TIME IS IT? TIME FOR TIBBLETIME! In this post, I’m going to take the tibbletime package out for a spin. Turns out this package is quite useful for things I tend to do. We’ll use the tibbletime package to write some R code to extend our ongoing analysis of trends in the U.S. mortgage market (see here for example). Davis Vaughan (on Twitter) one of the authors of the tibbletime package suggested I take a look:

Analyzing mortgage data with R

TIME FOR ANOTHER DATA WRANGLING AND VISUALIZATION EXTRAVAGANZA. This time we are going to work hard to turn some big data into little data. That is, we’re going to work hard to aggregate several million loan level records into useful summary graphics to tell us about the U.S. mortgage market in 2016. I’ve been working on a lot of different ways to visualize trends in the mortgage market (see here and here for examples).

Arizona housing market trends

I AM HEADED OUT TO ARIZONA to talk with mortgage professionals. I wanted to share some charts I’ve put together for the Arizona and Phoenix metro economy. These charts were put together using R and tidyquant as I described here. I am working on applying tidy data principles to constructing presentation slides, something I’m calling “tidy PowerPoint”. Preparing these charts, or ones like them, would fall under that workflow. Hopefully I’ll be able to tell you about them more later.

ggplot as it was meant to be

I’ve BEEN MESSING AROUND MORE WITH R and OFFICER and having too much fun for a Monday. I’m going to dive into some details later, but I’ll just leave a couple files here. See the attached PowerPoint .pptx file for all the charts. Here’s a gif version I started with: Then after I created the PowerPoint I started messing around with the drawing tools and made increasingly ill-advised edits.

Charting housing starts with R

IN THIS POST I WANT TO SHARE SOME R CODE to create charts of U.S. housing starts we studied last week. Get data We’ll use tidyquant (see e.g. this post for more) to go get our data from the St. Louis Federal Reserve Economic Database (FRED). We’ll also use cowplot to arrange multiple ggplot2 graphs on one page. Let’s load libraries and grab the data. ##################################################################################### ## Step 0: Load Libraries ## ##################################################################################### library(tidyquant) library(tidyverse) library(cowplot) library(lubridate) library(scales) library(ggridges) # replaces ggjoy ##################################################################################### ## Step 1: Prepare for data ## ##################################################################################### tickers=data.

Crafting a PowerPoint Presentation with R

LOOK I DON’T HAVE ANYTHING BAD TO SAY about PowerPoint. Others have said it (see for example Tufte and Harvard Business Review). It’s a tool and a fact of life for many of us. I am interested in making better PowerPoints. In this post we’ll use some R tools to generate a PowerPoint deck. OfficeR The package officer allows you to access and manipulate ‘Microsoft Word’ and ‘Microsoft PowerPoint’ documents from R.

Housing market update September 2017

THIS WEEK WAS BUSY, with a lot of data releases. Earlier this week we talked about housing starts, but there were a bunch of other key releases. Let’s review some of them here. We’ll just do a quick description of the data and then follow up with a static chart and an animated gif. Mortgage rates are still super low U.S. weekly average mortgage rates ticked up this week, but remain down from the start of the year.

Housing starts grinding higher or grinding to a halt?

ARE HOUSING STARTS GRINDING HIGHER, OR GRINDING TO A HALT? Today the U.S. Census Bureau joint with the U.S. Department of Housing and Urban Development published updated estimates of housing starts through August of 2017. Per the report privately-owned housing starts in August were at a seasonally adjusted annual rate of 1.18 million, down 0.8 percent from July’s revised estimate and up 1.4 percent from a year ago. Neither the month-over-month or year-over-year changes were significant.

Ticks out!

YOU HAVE SPOKEN and we will go with ticks out, at least 54% of the time. In a graph, should axis ticks face in or out? — Leonard Kiefer (@lenkiefer) February 5, 2017 To celebrate, let’s make an animated gif where the axis expands over time. We’ll use data we used in our mortgage rate post. Let’s start by loading the data and plotting a static graph (with ticks out of course).

Visual meditations on house prices, Part 6: state recovery

Introduction HOUSE PRICES HAVE NOW RECOVERED BACK TO THEIR PRE-RECESSION PEAK, at least according to some indices. The Freddie Mac House Price Index, for example, surpassed its pre-2008 peak in the latest release for data through September 2016. In this post I’ll be exploring trends in house prices and exploring different ways of showing how far house prices have come, and in some cases, how far they still have to go.

Some animated gifs: Week of Oct 14, 2016

A couple of views of mortgage rates: Mortgage Rates in 2016 This chart shows the weekly average for the 30-year fixed rate morrtgage. Comparing mortgage rates by week This viz compares weekly mortgage rates (30-year fixed rate mortgage) by year. Each line represents a different year. The x-axis display the week of the year (from 1 to 52). Homeownership gif A homeownership rate viz. This shows the U.S. homeownership rate and breaks it out by the age of householder:

Distribution of mortgage loan amounts in 2015

IN THIS POST I WANT TO CREATE some data visualizations with R using the recently released Home Mortgage Disclosure Act (HMDA) data. For this post I’m going to return to the 2015 HMDA that you can get from the Consumer Financial Protection Bureau (CFPB) webpage and I discussed earlier. Check out my prior post for more discussion of how we build these data visualizations. R code for graphs posted below

Data visualizations for the week of September 22, 2016

IT WAS A BUSY WEEK FOR ECONOMIC AND HOUSING DATA this week. Below are some data visaulizations I made tracking key trends in economic and housing market data. Homeowner equity increases to $12.7 Trillion in the second quarter of 2016 With house prices rising by nearly 6 percent on a year-over-year basis, homeowners are building back equity. According to the Federal Reserve’s Flow of Funds, owners' equity in real estate was $12.

Industry-specific Beveridge Curves

IN MY PREVIOUS POST we looked at the Job Openings and Labor Turnover Survey (JOLTS) data and plotted a Beveridge Curve. In this post I want to add some more code that allows us to plot Beveridge Curves by industry. For more on the analysis of industry-specific Beveridge Curves, see this paper published in the June 2012 Monthly Labor Review that decomposes shifts in the Beveridge Curve and looks at it by industry.

JOLTS! Job openings and labor turnover trends

IN THIS POST WE’LL LOOK AT recent job openings and hires data from the Bureau of Labor Statistics Job Openings and Labor Turnover Survey (JOLTS). R code for selected graphs posted below Job openings and labor turnover Total nonfarm trends Let’s start by looking at aggregate national trends for total nonfarm sector. The plot below compares hires, job openings and separations (the sum of quits, layoffs and discharges, and other separations) over time.

What we spend: Consumer Expenditures in 2015

EARLIER THIS WEEK THE U.S. BUREAU OF LABOR STATISTICS released data on consumer expenditures in 2015. In this post I want to examine these data and make a few visualizations. R code for graphs posted below One area I pay close attention to is housing. Housing is the largest single category of expenditure, averaging about 1/3 of total consumer expenditures. The BLS breaks the data out by tenure, so we can see how expenditures vary by owners versus renters.

Recent economic and housing market trends: August 2016

IN THIS POST WE’LL REVIEW some recent economic and housing market trends. R code for graphs posted below Low mortgage rates Mortgage rates remain low, with the 30-year fixed mortgage averaging 3.43 percent for the week of 8/25. That’s nine consecutive weeks with rates under 3.5 percent. Ever since Brexit. One way I like to look at rates is to compare the weekly rates by week of year (e.g. first week of 2016 compared to first week of 2015).

Density squared

WE ARE GOING TO EXAMINE THE DISTRIBUTION OF US POPULATION and make an animated gif combining a map and a kernel density estimate of the distribution of county population densities. Density of densities, or density squared. We are going to use the same US County Population Estimates 1790-2010 we used in my previous post. We’ll end up with this: How do we do it? Code First, we’ll load the data and do some manipulations.

More map visualizations

IN THIS POST I’M JUST GOING TO share a few data visualizations I’ve been working on today. For most, no code, but these build off my previous posts here and here so you can check there for hints and I’ll post some more examples with code later. Population maps This one shows the evolution of population by county without the distribution plots I included last time. We discussed these data in our last post.

U.S. county population: 1790-2010

SOMETIMES YOU ACTUALLY LEARN SOMETHING from social media. Today on Twitter I happened across this Tweet via @kyle_e_walker: Seems somebody posted estimates of the U.S. population by county (defined by 2010 county definitions) going back to 1790. This is a perfect dataset to practice my mapping with R. The data are conveniently available via the University of Minnesota. The data come in a nice spreadsheet that we can easily import into R and manipulate.

Maps, mortgages and me

IN THIS POST I WANT TO DOCUMENT some R code I’ve recently been working on combining maps and distribution plots. As I discussed earlier lots of interesting data will be released in the fall and I want to be ready for it. Some of these snippets can be recycled when the new data is available. Maps One area of data visualization with R I haven’t explored much is mapping. Part of this reason is because I’ve had other tools to use, but usually it’s because I’m in a hurry.

Data swarms: Your firearms are useless against them!

AUGUST IS ALMOST OVER, and it’s nearly back to school season. And that means one thing. No, not that we’re about to get a chance to watch the #1 NCAA football program of all time dominate the gridiron (though that’s awesome too). No, it’s data release season! A data swarm is on its way. From American Community Survey to the American Housing Survey to the annual Home Mortgage Disclosure Act Data many statistical data releases come out in September and October.

Consumer Credit Trends Part 2: Data doesn't drive, it's lucky to be in the car

A FEW DAYS AGO I POSTED on trends in household debt using data from the the New York Federal Reserve Bank’s Consumer Credit Panel. The post got many responses, some observing that while student debt has grown a lot the absolute level of it is small relative to mortgage debt. I had made that point in my post, but the pictures caught the attention of many who didn’t read the post or catch the point.

Visual meditations on house prices, Part 5: distributions

OVER THE PAST THREE MONTHS I HAVE MADE several new house price visualizations. In these meditations I’ll consider some recent graphs and provide R code for them. For reference, prior meditations are available at: Part 1: data wrangling Part 2: sparklines and dots (animated) Part 3: bubbles and bounce Part 4: graph gallery Meditation 1: Median sales price trends Earlier this week, the National Association of Realtors (NAR) released their quarterly update on metro area median house prices (data here).

Consumer Credit Trends

TODAY the NEW YORK FEDERAL RESERVE BANK released its Quarterly Report on Household Debt and Credit. These data come from the Center for Microeconomic Data based on credit records from Equifax. R code for the graphs are posted at bottom of page Trends in household debt balances One of the key statistics tracked in the report (full data can be found here) is household debt balances. They break debt balances out by loan type:

Let's make a dot plot

IN THIS POST WE’RE GOING to make an animated version of the famous Federal Reserve dot plot comparing the dots in March 2016 to June 2016. As far as celebrity charts go, the dot plot has to be up there. Check out how much “dot plot” has grown in search popularity since the Fed introduced their dot plot in 2012: Ultimately, it will look something like this: The dot plot is a special chart that shows the distribution of expectations of the Federal Open Market Committee (FOMC) for the federal funds rate.

Dataviz Remix: Housing Trilemma

A dataviz remix I came across some interesting analysis from Josh Lehner at the Oregon Office of Economic Analysis about the “Housing Trilemma”. The Housing Trilemma, captured in the chart below is based on the following claim: Every city wants to have a strong local economy, high quality of life and housing affordability for its residents. Unfortunately these three dimensions represent the Housing Trilemma. A city can achieve success on two but not all three at the same time.

Visualizing the U.S. housing stock

IN THIS POST I wanted to share a few data visualizations I made using the American Housing Survey (AHS). For this exercise I used the metro summary tableswhich you can download from American Fact Finder. Distribution by year unit built Distribution by units in stucture Distribution by bedrooms in unit Distribution by square footage of units {% include JB/setup

More tweenr animation examples

IN THIS POST I WANT TO PROVIDE some additional examples of using tweenr and gganimate to create nice smooth transitions in an animated GIF. In this post we’ll look at an animated waterfall chart. For this data I’m going to use the National Income and Products Accounts from the U.S. Bureau of Economic Analysis (BEA). Specifically we’ll be looking at the contributions to growth in Real Gross Domstic Product, which you can find here.

Improving R animated GIFs with tweenr

RECENTLY I HAVE MADE several animated GIFs, primarily using the animation package. These gifs usually work pretty well, coming out something like this (code here). Unfortunately, these gifs tend to come out rather choppy. I tried to get around that by using variable length sequences to alter the timing of each frame. My primitive approach involves loops and business like this: {% highlight r for (i in c(seq(1,365,6),seq(378,716,13),seq(1145,1574,26),seq(1587,2003,13),seq(2016,2185,6),2196) ) { {% endhighlight

Population growth, housing supply, and house prices

EARLIER THIS WEEK THE U.S. CENSUS BUREAU released dataon population and housing units for counties across the U.S. in 2015. These data reveal important trends in population growth, and help shed light on recent house price trends. Housing unit growth One key factor driving housing market dynamics is the expansion of housing supply (or lack thereof). The updated estimates from Census allow us to see which areas have added the most housing units and how that relates to population and house price trends.

Mortgage rates and the Fed Funds rate

YESTERDAY THE FEDERAL RESERVE RELEASED minutes from their last Federal Open Market Committee (FOMC) meeting in April. The big news was that the FOMC still considered a June rate hike a possibility. How much does Fed policy impact mortgage rates? I put together a few gifs comparing the history of the 30-year mortgage rate, the Fed Funds rate and the 10-year constant maturity Treasury. {% include JB/setup

Mortgage rates, some perspective

Another mortgage rates animated gif IN THE PAST I’ve told you how I made my mortgage rates gif. In this post I’m make an extension that uses stop motion techniques to reverse course. We’ll end up with this: For reference, here’s the standard gif I share each Thursday after mortgage rates come out: Stop motion animation While thinking about the week-to-week movements in rates it’s easy to lose longer-term perspective. Rates in the week of May 12, 2016 were the lowest in three years.

House price data viz

TO HELP UNDERSTAND TRENDS in house prices, I have a couple of data visualizations for the Freddie Mac house price index. Viz 1: House Price Dynamics The first compares the quarterly and annual appreciation for house prices across the 50 states plus the District of Columbia. In this visualization, each dot represent a state (or D.C.). The horizontal X axis measures the quarter-over-quarter annualized percentage change in the Freddie Mac house price index.

Annotated chartbook, Tufte style

I finally got around to putting together an annotated chartbook, Tufte style, using the Tufte packagefor Rmarkdown. Check it outSome screenshots: Screenshot 1 Screenshot 2 Screenshot 3 Screenshot 4 {% include JB/setup

Data Viz: Occupation Wages and Regional Cost of Living

A new data viz TODAY THE BLS released dataon metro level wages, employment concentration and regional costs of living. I put together a quick plot and sent out the following tweet: This post provides a link to interactive versions of the same plot and a discussion. The data The BLS data is quite interesting. It combines estimates of the average annual wages by occupation in metro areas with estimates of the relative price level in those areas.

dot plots and distributions

We’re going to make this chart (and talk about it) Wait, what is this? Let’s pause the animation and look at the last frame: This plot shows the distribution of metro area unemployment. These data are available here. Each dot represents a metro area with its unemployment rate depicted on the x axis. The data are bucketed into 0.25 percentage point buckets and stacked when more than one metro falls within that range.

Real house prices and population growth

EARLIER THIS WEEK the U.S. Census Bureau releasedupdated population figures for 2015. These data revealed changes in population across the country. Jed Kolko published a nice summaryof these data, and it got me thinking about the relationship of population growth rates and house prices. In this post I want to consider a few key things I found by exploring these data. First, let’s have a look at the history of real house prices, relative to the year 2000 for 30 large metro areas:

Tight Inventory: Data Viz Remixed

Tight Inventory EARLIER THIS WEEK, Trulia published a post by Chief Economist Ralph McLaughlincalled “House Arrest: How Low Inventory Is Slowing Home Buying”. The article analyzed trends in housing inventory. Trulia broke housing inventory into “starter homes”, “move-up homes”, and “premium homes”. They found that the inventory of available homes for-sale has shifted towards premium homes and away from starter homes that first time homebuyers would typically be buying. We’re not here to talk housing inventory, but I recommend you take a look.

The week (so far) in charts

Mid-week chart update With existing home sales, house prices, and new home sales being released, this is one of the busiest weeks of the month for housing data. We’ll catch new home sales tomorrow morning, but let’s catch our breath and recap what we’ve learned so far this week. Existing home sales disappoint The National Association of Realtors (NAR) reportedon existing home sales (EHS) on Monday. Existing home sales for February surprised most by dropping 7.

The week that was in charts

This past week I tracked several data releases that give us an idea of the health and vibrancy of the economy and housing markets. State employment trends positive Consistent with the national employment numbers state employment trends are positive. The BLS reportedon employment trends by state for January 2016 this week. Eleven states plus DC had a statistically significant month-to-month increases in employment and five states experienced month-to-month declines. One state I’ve been focused on is Texas due to its reliance on oil and gas drilling.

What the February jobs numbers mean for housing

Resilient job growth SPRING IS ALMOST HERE, and housing market activity will start to accelerate as we enter the peak homebuying season in the spring and summer months. The latest jobs report shows the U.S. labor market continues to pick up steam, adding 242,000 jobs month-over-month and beating expectations. Job growth has been resilient since the end of the Great Recession in June 2009, with monthly job growth averaging over 200,000 since 2011.

Recent House Price Trends

{% include JB/setup National house prices rise 6.2% Freddie Mac released its full year 2015 house price index and an interactive data visualization. The seasonally-adjusted national index increased 6.2 percent year-over-year and is now 29.6 percent above the post-recession low, and just 4.1 percent below the (nominal) pre-recession peak (see graph below). While national house price growth has been strong, there is considerable variation across the country. Some states and metro areas are already well above their pre-recession (nominal) peak, while other still have lots of ground to make up.

Annotated Data Viz 2

BELOW IS A VISUALIZATION of household size and composition and homeownership from the Census1going back to 1980. With this visualization, we can see how household size and tenure choice (own vs rent) has varied by age over time. 1Data from Ipums: IPUMS-USA, University of Minnesota, www.ipums.org. See my data visualizations on Tableau Public

Annotated Data Viz 1

Homeownership and the Jobs Outlook BELOW IS A VISUALIZATION of job growth and homeownership by occcupation. This viz details expected job growth by occupation compared to homeownership rate by occupation. This viz was originally published on Freddiemac.com. This viz shows compares variation in homeownership rates by occupation with expected job growth for those occupations. The size of the bubbles correspond to the expected number of job openings for that occupation. Projected job openings come from the Bureau of Labor Statistics, while the homeownership rate comes from the American Community Survey, public use microdata.

How I make my mortgage rates gif

{% include JB/setup Making a data viz SOMETIMES ANIMATION CAN BE USEFUL, though it is often misused. I’ve been tracking the week-to-week changes in mortgage rates, and animating with a GIF. Example animated gif with mortgage rates from 1/1/2013 to 3/10/2016 I build my gif using the R statistical package. Perhaps I’ll explain more of the details later, but the R code below uses the ggplot2, ggthemes and animation packages to create the plots, style them, and save the animation.

The week (so far) in charts

Mid-week chart update THERE HAVE NOT been a lot of data releases this week, but that’s no excuse not to get busy charting. I tweeted out several charts so far this week. Here’s a recap of my favorites for this half-week. Are wages increasing…or is it merely a trick of the light? We got this week’s charting started with some data from last week. The jobs report came out last Friday (see our discussion from last week) .

The week ahead: housing starts and housing market index

{% include JB/setup The week ahead Next week there are several data releases but the two that I’m paying especially close attention to are the NAHB/Wells Fargo Housing Market Index (HMI)and Housing Starts, part of the New Residential Constructionjoint release by Census and HUD. Will builders maintain their sunny outlook? The HMI is a diffusion index based on survey questions about homebuilder’s attitudes. Values of the index above 50 indicate that on balance, more respondents feel positive than negative about the current conditions in and direction of the single-family housing market.