1. Migration
In this lesson, we will work with migration data. The ACS asks people about their residence one year ago. We will investigate domestic migration, immigration, and flows between US states.
2. ACS Mobility Tables - Common Columns
The ACS mobility subject code is "07". There are many tables in this subject area, but most of them have columns that break down into movers and nonmovers.
A total column is followed by...
...those living in the same house one year ago.
Additional columns count those moving within their current county of residence...
...moving within the state...
...from a different state
...or from abroad
3. ACS Mobility Tables - Additional Features
Additional mobility tables show mobility by various demographic and economic characteristics,
such as age,
educational attainment,
income, and
citizenship status.
Many of these tables are also available in versions that count the population where it *was* one year earlier, and break it down into those who have moved out of their house, county, state, or the country.
Finally, there are special tables for Puerto Rico, which end in the letters "PR". These tables can distinguish between movers who arrive from or leave Puerto Rico for the United States, and those who do so from other countries.
4. Going to California
Let's look at the broadest categories of mobility for one state, California. The data comes from a table showing *Current Residence* in 2016, and therefore represents people who have moved into this area.
The data have been downloaded, and the DataFrame has been melted so that we have the move_status, "same_house", "within_county", etc. in a categorical column, and the number of persons who moved in a value column.
We then create a simple barplot to compare these categories.
Unsurprisingly, the vast majority of people do not move in a given year, and in-movers are progressively less likely to have moved from a different county, different state, or different country.
5. Migration Flows
Since ACS gathers current residence, and residence one year ago, it is also possible to determine flows between areas. The Census Bureau publishes migration flows between states, counties, and metropolitan areas. Unfortunately, these tables are only available as formatted Excel spreadsheets. A snippet is displayed here.
The Census does not provide flows broken down by characteristics, such as age or education. This can be calculated using the Public Use Microdata Sample, or "PUMS", but working with PUMS is beyond the scope of this course.
6. State-to-State Migration Matrix
Here is the data from the spreadsheet in the previous slide. The spreadsheet has been cleaned up and imported as a pandas DataFrame. The state names appear as both the DataFrame index (i.e. row labels) and as column names. The row labels indicate the state moved *to*, while the column names indicate the state moved *from*. So, for example, this indicates that in 2016, 423 people moved from Alabama to Alaska, and 576 people moved in the opposite direction.
We refer to this as a "matrix" in the mathematical sense of "a rectangular array of values". We are *not* referring to the numpy matrix class. Flow matrices like this are common in demographic and geographic analysis.
7. State-to-State Migration Heatmap
A matrix like this is perfect for a heatmap!
This example shows flows between all pairs of states in the country. Due to the number of states, many labels are missing, and it's a little hard to detect broad patterns. You'll look at a smaller set of states in the exercises.
8. Let's practice!
In the exercises, you'll get experience with examining characteristics of people moving into states, flows between states, and people moving out of states. Let's migrate to the exercises!