Measuring short-term mobility patterns in North America using Facebook Advertising data, with an application to adjusting Covid-19 mortality rates
This repository contains all materials relating to our paper exploring short-term mobility in North America using data scraped from Facebook's advertising platform.
This is joint work by Lindsay Katz, Michael Chong, and Monica Alexander.
This folder contains all the data used in our analysis.
The clean-fb-data folder contains the cleaned Facebook data and resulting travel rates data.
pop_data_clean_age.csvandpop_data_clean_no_age.csvhave the cleaned daily and monthly population count data disaggregated by age and not disaggregated by age, respectivelytravel_data_clean_age.csvandtravel_data_clean_no_age.csvhave the cleaned daily and monthly traveller count data disaggregated by age and not disaggregated by age, respectivelyrates_age.csvandrates_no_age.csvcontain data on rates of travel, disaggregated by age and not disaggregated by age, respectively. Each CSV has the observed rate (obs_rate) and the estimated rate and its associated standard error (loess_rateandloess_se), where the smoothed estimates were extracted from a loess model fit individually for each age/sex group for each region.rates_age_filtered.csvandrates_no_age_filtered.csvare subsets ofrates_age.csvandrates_no_age.csv(respectively). To filter these data, we computed the root mean square error (RMSE) for each demographic grouping, and filtered out those data with a RMSE greater than the 95th quantile value.rates_age_monthly.csvcontains travel rates data at the monthly level, disaggregated by age. This file was used for our Covid-19 mortality rate adjustment application.
The flight_data_aggregate.csv file contains the cleaned daily inbound flight volume data for each state, aggregated by airline. The raw data are from the Bureau of Transportation Statistics database.
The census_pop_all_ages.csv file contains the cleaned population estimates data by state, age, and sex, for 1 July 2020 and 1 July 2021. The raw data are from the Census Bureau's State Population by Characteristics: 2020-2022 dataset.
Further, the covid19_deaths_all_ages.csv contains the cleaned monthly Covid-19 deaths data by age group, sex and state. This includes death counts for a number of uniquely classified causes of death. The raw data are available for download from the CDC data catalog.
Finally, the age_specific_death_rates.csv file contains our computed age-specific death rates, calculated using the census_pop_all_ages.csv and covid19_deaths_all_ages.csv data.
-
01_fb_data_clean.R- read in and clean the scraped Facebook marketing API data. -
02_get_daily_travel_rates.R- compute daily travel rates, extract smooth estimates and produce time series plots for these travel rates. -
03_travel_rate_analysis.R- analyze daily travel rates data both empirically and with more visualizations. In this script, we compute and explore 3 summary metrics. This script produces the gender ratio plots found in theplotsfolder. -
04_flight_data_analysis.R- clean the flight volume data, and create plots comparing temporal trends in flight volume to those in travel rates. -
05_mortality_data_clean.R- clean the Census population data for each state, and the Covid-19 deaths data, in preparation for computing monthly Covid-19 mortality rates. -
06_get_monthly_travel_rates.R- compute monthly travel rates using the same methods in the second script, which will be used for adjusting monthly Covid-19 mortality rates in the final script. -
07_covid_deaths_analysis.Rmd- this Rmd file (and it's corresponding PDF) contain the code used to perform our Covid-19 mortality rate adjustment application.
-
fb_travel_rates_age.pdfcontains the plots of traveler rates for each region over time, disaggregated by age group and sex. -
fb_gender_ratio.pdfcontains plots of the male to female ratio of travel rate for each region over time. -
flights_time_series.pdfcontains time series plots for flight volume and aggregated travel rate for each state.