Skip to content

Latest commit

 

History

History
79 lines (43 loc) · 4.06 KB

README.md

File metadata and controls

79 lines (43 loc) · 4.06 KB

Urban Forms Through the Lens of Human Mobility

Source code for "Urban Dynamics Through the Lens of Human Mobility"

Developed by Yanyan Xu (yanyanxu@sjtu.edu.cn) and Marta Gonzalez, Human Mobility and Networks Lab (http://humnetlab.berkeley.edu/), UC Berkeley

Data were analyzed using python 3.8.7, numpy 1.19.5, scipy 1.6.0, pandas 1.2.1, osgeo 2.2.3, lightgbm 3.1.1, shap 0.40.0, matplotlib 3.5.2, seaborn 0.11.1. The code were compiled in Ubuntu 18.04.

The estiamte of $R_t$ was implemented with R 4.1.2, using R packages EpiEstim 2.2-4, ggplot2 3.3.5, incidence 1.7.3. The code were compiled in Ubuntu 18.04.

This data analysis framework aggregates the individual mobility traces data, to quantify the collective mobility beahavior from two aspects,

(I) urban form metric $\Delta KS$, a metric to measure the spatial heterogeneity of mobility scale (Rg);

(II) "shelter-at-home" indicator $KS_{HBT}$, a metric to measure the "staying-at-home" of the population in a city.

For each user, we first calcualte her Raduis of Gyration ( $Rg$ ) to represent her mobility scale centering at home. If we consider one user's mobility behavior during a certain period as a sequence of visited locations sorted in time, $Rg$ is calculated as

where $n$ is the length of the sequence, $\mathbf{p}_i$ and $\mathbf{p}_h$ are the geographical coordinates of the $i$ th visited location and the home location, respectively. The average $Rg$ values in each census tract in Boston and Los Angeles are present in the following figure.

alt text

To understand the urban form from the respective of human mobility, we group population in one city with circiles centering at the CBD, as presented in the following figure. Then we define $\Delta KS$ as the slope of the $Rg$ difference with respect to the CBD, measure by the $KS$ index.

alt text

Next, we define another metric $KS_{HBT}$ to quantify the effectiveness of "shelter-in-place" order duing crisis events. $KS_{HTB}$ measures the distribution disparity between the actual $Rg$ values and the $Rg$ values if all population would be staying at or near home.

Struture of source code:

This work is implemented with Python3.9. Related packages include numpy, pandas, scipy, matplotlib, seaborn, lightgbm, shap, geojson, fiona, rtee.

step0_dataPreparation.py:

(1) cityGiniPopulation(cities): extracting the population information of a given city from LandScan data.

(2) RgDistribution(city): grouping and visualize the Rg values of users in a given city.

step1_mobilityMetrics.py

(1) KSIndexVSdistance(cities): calculation of KS index in rings centering at CBD for a given city.

(2) typicalBehavior(city): calculation of $\Delta KS$ and $KS_{HBT}$ for a given city.

step2_COVIDdataAnalysis.py

Process the covid-19 data in Spain and visualize the data.

step3_socioeconomicAnalysis.py

Socio-economic analysis for Boston, LA, and Bogota cities.

step4_SupplementaryFigures.py

Plot the figures in the Supplymentary Information for our paper.

dailyRt_modeling_GBM.ipynb

(1) Urban form changing during COVID-19 peroid (before Sep. 30th, 2020) in Spain.

(2) Modeling the spread of COVID-19 with mobility and urban form variables in 11 Spanish cities with GBM model, and explain the impacts of variables with SHAP package.

Estiamte of $R_t$ in the studies 11 Spanish cities:

We use the EpiEstim R package (https://cran.r-project.org/web/packages/EpiEstim/) to estiamte the time-varying reproduction number $R_t$ in each Spanish city. Please find the source code in "Rt_estimate.R". The covid data in Spain were obtained from https://github.com/montera34/escovid19data

Running the code with data in one specific city:

For one city, the required data to reproduce the results include:

(1) shapefile of the city region and its boundary, the geographic location of CBD

(2) popualtion distribution at 1km2 resolution

(3) the mobile traces (a sequence of stay locations) of a large number of residents or their daily $Rg$ and home locations