Mobility: Data On The Effect of COVID-19 on Our Mobility

Posted on Aug 2, 2020
The skills I demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

I just moved to NYC in January 2020. My reason for moving was to enjoy the socially rich community and the plethora of activities that I could explore, such as museums, cute little theaters, Broadway shows, fancy stores, riding the subway and watching people, restaurants and the fun nightlife. And I did for two months. Then in March, the pandemic hit the city hard. WOW! All the fun activities and sights that I had hoped for were closed.

Many places were forced to close due to lockdown measures, and some businesses chose to close even if they were allowed to remain open. I was curious about how the numbers of the daily COVID cases are increasing and how those numbers controlled our mobility and decisions. The change in mobility is defined by how the number of visitors or the time spent at places such as parks or transit stations, etc., changed compared to a baseline.

The baseline used for this data is the median value of the corresponding day of the week in the 5-week period from January 3 to February 6 of 2020. The mobility data was collected by Google Community Mobility Reports. To understand how COVID-19 affected our mobility and some businesses, I developed a Shiny App to provide some visualization of the mobility data and to interpret the data as well.

This post presents some of the answers that the app can provide. There are six studied mobility types; grocery and pharmacy, retail, park, transit, workplace, residential, and public transit. Details on  each category is available at the mobility data documentation.

How has COVID-19 changed mobility across the US?

The mobility in the US by type (either grocery and pharmacy, retail, park, workplace, residential and public transit) can be visualized in the app by the selection of date and mobility type. For example, the following map shows the percentage change in mobility at residential places on March 25th.

As shown, how strictly people observed sheltering at home varied by state. Northeastern states have the greatest relative increase, which can be attributed to the high level of severity in those states. Also the number of daily cases were higher in those states. The box plots show the top and bottom 5 states/districts for the selected mobility type (which is residential mobility in this example).

Comparing the median change in residential mobility of the counties in each region (a measure of citizens staying at home), the District of Columbia, New Jersey, Massachusetts, Michigan and New York had the highest relative increase on March, 25th, while Arkansas, Arizona, Idaho, Mississippi and Oklahoma had the lowest. 

Another interesting change is in the mobility at retail stores on May 28th when the number of daily cases were decreasing in the US as shown in the following map. Of course, some states decided to close retail stores, but not all.

Effects of Retail Closure

Retail closure may have affected other mobility types such as residential mobility, since people may have chosen to stay more at home because stores are closed as shown in the previous map of residential mobility on the same day. This is noticeable in the District of Columbia. It had the highest decrease in retail mobility (-58% from previous box plots) and the highest increase in residential mobility (28% from the following box plots).

The District of Columbia and New Jersey have the highest decrease in mobility at the retail stores, while states like Alaska, Oklahoma, Wyoming, Mississippi and South Dakota did not show a considerable change in mobility at retail stores because the state governments did not enforce the closing of retail stores as strictly as the other states and the COVID situation was not as severe.


Similar visualizations are available per day for the other mobility types, including public transit, workplaces, parks, and grocery stores during the period between March 1st and July 29th. This period is chosen based on the availability of the most updated mobility data until the date of this post. Percentage change in mobility in each state is a daily median of the mobility change of the counties over  the whole measured time-frame.

How do mobility types correlate to one another?

Studying the correlation between the change in mobility by type from March 1st to July 29th, 2020 nationwide shows each of the mobility types is correlated to the other as expected. There is a strong direct correlation between retail, grocery, transit, and workplace mobility types.

Due to COVID-19, offices are closed and people are going to work less. They also use less mass transit and reduce their trips for retail and groceries because of both restrictions imposed by the governors and personal safety choices. The correlation is also positive but weaker between the change in park mobility and the rest of the other mobility types because some people still went to the parks even when there were mobility limitations.

The closure of parks was not imposed by the governors in most of the states. Thus, the choice to visit the parks was left to the people.

Moreover, the correlation between the change in residential mobility and the rest of the mobility is inverted; the more people limit their mobility, the more they stay at home.

How have the reported daily cases affected mobility in each state?

The app also addresses how the daily cases and the mobility trends are correlated on a state-by-state basis. The following is an example of the visualization that shows the trends of daily cases in the state of NY. As you see, the reported daily cases peaked around the middle of April, then started to decrease. The daily cases visualization is available until August 1st.

The percentage change in mobility for the state of NY is also reported as shown in the following graph.

The percentage change in mobility trends are different for each mobility type. Parks, grocery, retail, transit and workplace mobility types were decreasing until the middle of April when they started to increase. The residential mobility trend is the opposite: It was increasing until the middle of April then it started to decrease. This indicates that as the number of daily cases were increasing, more people stayed home.

Daily Case Decrease

But when the number of daily cases started to decrease, people started to leave home and to increase the rest of the six mobility types (parks, grocery, retail, transit and workplace). Quantifying that relationship between the number of daily cases and the change in people’s mobility can be insightful. We want to know how strongly people responded to the daily new cases.

This can be expressed by the correlation coefficient between the reported daily cases and the change in the mobility in the following day. It takes values between -1 and 1. A negative value indicates that as the reported daily cases increased, people's mobility decreased the following day. A positive value indicates that as the reported daily cases increased, people's mobility increased the following day.

Zero indicates that there is no response, and one indicates that there is a strong response. The values of these correlation coefficients are also reported in the app in the small boxes below the trends’ plots as shown in the following figure.

Data on NY

As presented by the numbers in NY, people react inversely to the increase in the number of daily cases for retail, grocery, transit, park and workplace. As the daily cases increase, people limit their mobility in the previous categories because of either their personal choice or the closure of some places. However (for residential mobility), as the daily cases increase, people stay home and the correlation is about 27%. 

An interesting question to ask would be whether or not any states respond anomalously to the trend in diagnosed cases, such as Florida. The difference is noticeable. As the daily cases increase, people do not stay home after the middle of April. People stopped going to the beaches and to the parks until the middle of April when the number of daily cases were almost constant.

However, they kept going out even though the daily cases were increasing since June. Note that grocery, parks, retail, transit, and workplace mobility types increased right after the middle of April, and that is when the state started to open. That also has a great effect on the large increase in the number of daily cases--a positive feedback loop.

States outside New York

People in states outside New York reacted to the number of daily cases in NY because New York’s daily cases dominated the total number in the US at the start of the crisis. Therefore, people in the other states used those numbers as their reference to decide how to mobilize. As shown from the figure above, in FL people started to increase their mobility outside their houses when the daily cases in NY started to decrease while the daily cases in FL were plateauing. FL residents reacted more to the numbers in NY than in FL itself.

Another example is California in the figure below. Though California had not  reached its peak by the middle of April, people still decided to go out when NY daily cases started to drop which also supports that previous analysis.

How did people react to daily cases in NYC? 

Now let’s look at NYC. The more daily cases were reported, the more people stayed home—53% correlation—and the more they limited their other mobility types (~ -46% correlation on average). Part of the decrease in mobility was due to the lockdown orders, and the other part of it was due to people’s voluntary actions. The decrease in retail, transit and workplace mobility types was more probably due to the lockdown order.

On the other hand, the decrease in grocery and park mobility types was more probably due to people’s voluntary actions. However, NYC residents started to go to the parks after mid-April when the reported daily cases started to decrease. After staying home for so long, they felt the need to get out, especially as warmer weather lured them outdoors. There was a huge increase in park-related mobility during weekends and on holidays like Memorial Day weekend.

The number of daily cases and the positive reaction to mobility could have been different if people in other states had considered their local daily cases rather than the global daily cases.

Percentage change in mobility

The percentage change in mobility in the different NYC counties has shown a significant difference during the period between March 1st and July 29th. The following map shows, as an example, the change in retail mobility on June 15th in the five NYC counties (The Bronx, Manhattan, Richmond, Queens and Kings counties). Retail mobility also includes restaurants and theaters.

P.S. June 15th is used as an example date for the following analysis. The user of the app can change the date to any day between March 1st and July 29th,

Data on Retail Mobility

The biggest decrease in retail mobility was in Manhattan (70%) where most retail businesses, theaters and restaurants exist in NYC. The lowest decrease on that day was in the Bronx (30%). From these data, it is clear just how hard Retail businesses in NYC have been hit, especially in the Manhattan area. 

Similar decrease was also observed in workplace mobility on  June 15th. The decrease ranged from 45% in the Bronx to 65% in Manhattan. Similarly, Manhattan got the biggest hit of -65%, since Manhattan has most of the business offices in NYC.

Decrease in Grocery and Pharmacy Mobility

The decrease in grocery and pharmacy mobility ranged from 10 to 30% on June 15th in NYC. Manhattan was the biggest hit county (-30%), while the lowest change was in Queens (-10%).  People generally tried to limit their trips to the grocery and drug stores in the five counties because of the pandemic. Manhattan had the highest decrease, and that can be because of the less human activity in the area.

When Manhattan was open, it was the main business and entertainment destination in NYC, and people would visit the nearby grocery and drug stores as they are in Manhattan for work or for entertainment activities. But, when Manhattan was on lockdown (offices and retail were closed), it lost its significance as a main business and entertainment destination in NYC and People would visit Manhattan much less and accordingly the grocery and drug stores.

Data from Maps

The mobility change percentages in the previous three maps highlight how much the mobility in retail, workplaces, grocery and drug stores were affected by COVID-19. They also show how this effect varies in the five NYC counties. The drop in these three mobility types had its great impact on the economy of NYC in return, and Manhattan was the most affected county.

The following map shows how the mobility in public transportation such as the subway and the bus systems changed on June 15th. The change is similar to the above maps, which explains the strong correlation between retail, workplace, grocery,  and transit mobility types. Since people limited their mobility to go to work, to shop, to entertain or to get groceries, they use the transit system less. As expected, Manhattan had the highest decrease in transit mobility (-65%).

Mobility at parks

The mobility at the parks had a different distribution on June 15th as shown on the following map. It ranged from -20 to 100%. Manhattan had the greatest decrease in parks mobility (-20%). That can be attributed to that there are less parks in Manhattan, people preferred not to go to the parks in Manhattan, people generally chose to avoid going out in Manhattan or it was very restricted to go out in Manhattan. On the contrary, Queens had an increase in park mobility of 100%.


That can be attributed to that there are more or better parks in queens, residents from the other counties visited those parks or there were less restrictions on parks in Queens. Moreover, since entertainment destinations such as theaters and restaurants that are mostly in Manhattan were closed, people may have decided to visit the parks in different parts of the city like Queens, Kings and Richmond counties where there was an increase in parks mobility as shown on the map.

Mobility in NYC has been dramatically affected by the pandemic. There are variations in how each mobility changed in each county, and that change is related the kind of the prominent activities and businesses in each of these counties. The application provides visualizations of these variations that can be helpful to understand how the pandemic affected our mobility, behavior and different businesses.

And hopefully one day, we will get to enjoy the city again!

The application is available for use at COVID-MOBILITY 2020.

Data Sources

Google LLC "Google COVID-19 Community Mobility Reports"

Johns Hopkins Daily Reports

New York Times COVID-19 Reports

Geocodes from

About Author

Related Articles

Leave a Comment

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI