Forecasting gentrification in city neighborhoods, with R

February 28, 2017

(This article was first published on Revolutions, and kindly contributed to R-bloggers)

If you've lived in a big city, you're likely familiar with the impact of gentrification. For longtime residents of a neighbourhood, it can represent a decline in the culture and vibrancy of your community; for recent or prospective residents, it can represent a financial opportunity in rising home prices. For those that live in a gentrifying neighbourhood, it's one of those you-know-it-when-you-see-it things, but for economists and urban planners it can be difficult to identify. So a team of analysts at Urban Spatial to build a longitudinal model based on census tract data to quantify gentrification. Their motivation?

Neighborhoods change because people and capital are mobile and when new neighborhood demand emerges, incumbent residents rightfully worry about displacement.

Acknowledging these economic and social realities, policy makers have a responsibility balance economic development and equity. To that end, analytics can help us  understand how the wave of reinvestment moves across space and time and how to pinpoint neighborhoods where active interventions are needed today in order to avoid negative outcomes in the future.

They also provide a detailed data visualization tutorial showing how they used R to visualize the results, like this sequence of panels showing the dramatic rise in prices for homes in the Mission District of San Francisco over the last eight years.


The R full code behind this and other interesting charts is included, often making extensive use of the ggmap package.  

Zooming out from neighbourhoods to cities, the full report describes the analysts built a model to predict gentrification within "legacy" US cities (and even produced detailed maps within those cities showing where gentrification was likely to occur). At the city level, the impact is shown in rising or declining average housing values:

City bar chart

If you're into the economic aspect, check out the full report for lots of interesting analysis of housing trends in US cities. Or, if you just want to learn how all the charts and maps were made, click the link below to see the tutorial.

Urban Spatial: #Dataviz tutorial: Mapping San Francisco home prices using R (via Sharon Machlis)

To leave a comment for the author, please follow the link and comment on their blog: Revolutions. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


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)