171 s

# Covid Cases per capita by state, against population density

I live in Rhode Island, which is one of the worst impacted states for covid per capita. We realized that, to be fair, it's also one of the densest states in the US (it's nearly a city-state around Providence - the metro population of Providence is twice the total population of Rhode Island because it bleeds over into Mass and Connecticut!).

But then, we wondered, is it actually fair to explain away our bad case rate by our high population density?

We found several articles arguing that in fact, no, there does not seem to be any correlation between cases per capita and population density:

However, most of the articles we found so far were using countries as data points, and we were interested in US states. So this notebook explores the data from states, and indeed draws the same conclusions:

There does not seem to be any correlation between population density and cases per capita.

The worst cases per capita are in fact mostly in the lowest-density, most rural states. However, among low-density states, there is no trend: some of the best states per capita are also in the lowest-density states. Rhode Island is an outlier, in that it is one of the worst states per capita, but also the second-most-dense state.

The color indicates how old the measurement is, with the darker colors most recent. You can see most states are getting worse over time (which makes sense because I'm plotting total historical cases per capita, so it can only increase).

The most-dense states are on the right, and the least-dense on the left.

39.0 μs
127 ms

I left DC out of the above plot, because it's so much more dense, it made the rest hard to read. Here's the plot that includes DC, in case you're interested:

7.7 μs
143 ms

## Implementation

The rest of this notebook includes the code to build the above plots.

I load the data from three separate CSVs, to get cases per state over time, area, and population, then combine them for the plots.

11.8 μs
xticks_states
8.9 μs
state_densities
212 ms
maxdays_ago
30
47.0 ns
points_no_dc
1.2 s
points
683 ms
color
885 ms
51
162 ns
state_population_density
302 ms
18462
55.0 ns
state_cases_per_capita_over_time
719 ms
state_cases_over_time
724 ms

## Covid Cases and Deaths per State over Time

https://healthdata.gov/dataset/united-states-covid-19-cases-and-deaths-state-over-time

7.7 μs
covid_cases_by_state_over_time_csv
submission_datestatetot_casesconf_casesprob_casesnew_casepnew_casetot_deathmore
StringStringInt64Int64Int64
1
"05/04/2020"
"KY"
5245
5245
0
115
0
261
2
"12/08/2020"
"OK"
205999
171497
34502
0
0
1752
3
"08/21/2020"
"MD"
103523
missing
missing
624
0
3685
4
"03/05/2020"
"GA"
2
missing
missing
-5
missing
0
5
"02/08/2020"
"WA"
1
missing
missing
0
missing
0
6
"06/28/2020"
"PA"
85988
83529
2459
492
13
6614
7
"05/04/2020"
"WV"
1224
1224
0
29
0
50
8
"12/02/2020"
"NY"
346492
missing
missing
5775
0
10117
9
"01/23/2020"
"WY"
0
missing
missing
0
missing
0
10
"05/05/2020"
"GA"
28196
28182
14
602
1
1258
more
21720
"07/20/2020"
"NH"
6249
missing
missing
46
0
398
14.0 s
state_abbreviations_csv
State/DistrictPostal Code
StringString
1
"Alabama"
"AL"
2
"Alaska"
"AK"
3
"Arizona"
"AZ"
4
"Arkansas"
"AR"
5
"California"
"CA"
6
"Colorado"
"CO"
7
"Connecticut"
"CT"
8
"Delaware"
"DE"
9
"District of Columbia"
"DC"
10
"Florida"
"FL"
more
51
"Wyoming"
"WY"
156 ms

## US State populations over time

https://www.kaggle.com/lucasvictor/us-state-populations-2018

7.9 μs
state_populations_2018_csv
State2018 Population
StringInt64
1
"California"
39776830
2
"Texas"
28704330
3
"Florida"
21312211
4
"New York"
19862512
5
"Pennsylvania"
12823989
6
"Illinois"
12768320
7
"Ohio"
11694664
8
"Georgia"
10545138
9
"North Carolina"
10390149
10
"Michigan"
9991177
more
51
"Wyoming"
573720
229 ms

## US State area

https://www.census.gov/geographies/reference-files/2010/geo/state-area.html

7.0 μs
state_land_area_csv
State and other areas2Land Area Sq. Km.
1
"Total3"
"9,158,022"
2
"United States4"
"9,147,593"
3
"Alabama"
"131,171"
4
"Alaska"
"1,477,953"
5
"Arizona"
"294,207"
6
"Arkansas"
"134,771"
7
"California"
"403,466"
8
"Colorado"
"268,431"
9
"Connecticut"
"12,542"
10
"Delaware"
"5,047"
more
61
"U.S. Virgin Islands"
"348"
164 ms
48.0 ns