Coronavirus (COVID-19 2019-nCOV) Pandemic Statistics

Here we will be working with data from the CDC, Johns Hopkins University, and the NYT database covering the 2019/2020 novel coronavirus pandemic.You can acquire these data from the following sites:

ADD FOLDERS TO YOUR PATH

% ADD FOLDERS TO YOUR PATH (THIS IS UNIQUE TO YOUR MATLAB SETUP)
clc; close all; clear;
P.home = '/Users/bradleymonk/Documents/MATLAB/GIT/COVID19'; cd(P.home)
P.data = [P.home filesep 'DATA'];
P.funs = [P.home filesep 'FUNS'];
P.imgs = [P.home filesep 'IMGS'];
P.figs = [P.home filesep 'FIGS'];
P.geos = [P.home filesep 'GEOS'];
addpath(join(string(struct2cell(P)),':',1))
clearvars -except P; P.f = filesep;

IMPORT HOSPITAL DATA

clc; clearvars -except P
% DATA IS ONLINE AT:
% https://bit.ly/UShospitals
P.hosp = [P.data P.f 'US_HOSPITAL_DATA.xlsx'];
opts = detectImportOptions(P.hosp,'Sheet','US_Hospital_Beds');
HOSP = readtable(P.hosp,opts);
head(HOSP)
ans = 8×19 table
 LATLONIDHOSPITALTYPEADDRESSCITYSTATESTATENAMEZIPCOUNTYSTATE_FIPSCNTY_FIPSFIPSBEDSSTAFFED_BEDSICU_BEDSFULL_BEDSROOM_FOR_BEDS
133.2524-86.813092'Shelby Baptist Medical Center''Short Term Acute Care Hospital''1000 1st St N''Alabaster''AL''Alabama'35007'Shelby'11171117252212320.542440
232.9316-85.968797'Russell Medical Center''Short Term Acute Care Hospital''3316 Highway 280''Alexander City''AL''Alabama'35010'Tallapoosa'11231123813460.460547
333.3723-86.990665'Medical West Hospital''Short Term Acute Care Hospital''995 9th Ave Sw''Bessemer''AL''Alabama'35022'Jefferson'1731073310187210.4735123
432.9512-87.148122'Bibb Medical Center''Short Term Acute Care Hospital''208 Pierson Ave''Centreville''AL''Alabama'35042'Bibb'1710073525NaN0.376210
532.8803-86.62266332'St Vincents Chilton''Short Term Acute Care Hospital''2030 Lay Dam Rd''Clanton''AL''Alabama'35045'Chilton'1211021302660.28554
634.1510-86.84615855'The Sanctuary at the Woodlands''Psychiatric Hospital''1910 Cherokee Ave''Cullman''AL''Alabama'35055'Cullman'14310434040NaN0.47230
734.2076-86.874939'Cullman Regional Medical Center''Short Term Acute Care Hospital''1912 Alabama Hwy 157''Cullman''AL''Alabama'35058'Cullman'1431043145145120.50820
833.9333-86.495023'St Vincents Blount''Critical Access Hospital''150 Gilbreath Dr''Oneonta''AL''Alabama'35121'Blount'191009402560.499115

LIMIT DATASET TO CONTIGUOUS 48 STATES

For now we will limit this analysis to data from the contiguous 48 states.
% LOWER 48 STATES FIT WITHIN THESE LAT/LON BOUNDS
LXY = [24.5 50.0 -125.0 -66.0];
DROP = (HOSP.LAT < LXY(1));
HOSP(DROP,:) = [];
DROP = (HOSP.LAT > LXY(2));
HOSP(DROP,:) = [];
DROP = (HOSP.LON < LXY(3));
HOSP(DROP,:) = [];
DROP = (HOSP.LON > LXY(4));
HOSP(DROP,:) = [];

IMPORT POPULATION DATA

P.pop = [P.data P.f 'PopPerZip.csv'];
opts = detectImportOptions(P.pop);
ZIP = readtable(P.pop,opts);
head(ZIP)
ans = 8×9 table
 ZIPPOP2016POP2015POP2014POP2013POP2012POP2011POP2010TOTALPOP
160117800179821808818450185441853318570127967
260239716402604085941302416404193041520287227
360351565524085316253683545405447554689374522
4606632063316415659165936386661545251
561027976283282880528963291412911129016201340
661263884648166625168055690177054167010469574
76161032110707104661018310750106171101774061
861724648247932491724879247332445824597173025

GET INTERSECTION OF HOSP & ZIP DATA

clearvars -except P HOSP ZIP
[ai,bi] = ismember(HOSP.ZIP,ZIP.ZIP);
HOSP.POP2016 = nan(height(HOSP),1);
HOSP.POP2015 = nan(height(HOSP),1);
HOSP.POP2014 = nan(height(HOSP),1);
HOSP.POP2013 = nan(height(HOSP),1);
HOSP.POP2012 = nan(height(HOSP),1);
HOSP.POP2011 = nan(height(HOSP),1);
HOSP.POP2010 = nan(height(HOSP),1);
HOSP.POP2016(ai) = ZIP.POP2016(bi(ai),:);
HOSP.POP2015(ai) = ZIP.POP2015(bi(ai),:);
HOSP.POP2014(ai) = ZIP.POP2014(bi(ai),:);
HOSP.POP2013(ai) = ZIP.POP2013(bi(ai),:);
HOSP.POP2012(ai) = ZIP.POP2012(bi(ai),:);
HOSP.POP2011(ai) = ZIP.POP2011(bi(ai),:);
HOSP.POP2010(ai) = ZIP.POP2010(bi(ai),:);

PLOT U.S. HOSPITAL LOCATIONS ON A MAP

clearvars -except P HOSP ZIP
% PLOT MAP OF USA
fh = figure;
ax = usamap('conus');
states = shaperead('usastatelo', 'UseGeoCoords', true,...
'Selector',{@(name) ~any(strcmp(name,{'Alaska','Hawaii'})), 'Name'});
geoshow(ax(1), states, 'FaceColor', [0.5 1 0.5])
gridm off; framem off; %mlabel off; plabel off;
% ADD HOSPITAL MARKERS
hm = scatterm(HOSP.LAT,HOSP.LON,50,'r');
hm.Children.Marker = '.';
hm.Children.MarkerEdgeAlpha = .3;

PLOT U.S. HOSPITAL DATA BY SERVICE POPULATION

Here we will again plot the location of U.S. hospitals. Additionally, we will make the size of each dot proportional to the number of beds each hospital contains, and we will color each dot according to how many beds there are per 1000 people in the county. Such a map can reveal areas that have a low number of beds per service population.
TAB = HOSP;
TAB.OPEN_BEDS = round(TAB.BEDS .* (1-TAB.FULL_BEDS));
TAB.BEDS_PER_POP = TAB.BEDS ./ TAB.POP2016 .* 1000;
TAB(isnan(TAB.BEDS_PER_POP),:) = [];
TAB.BEDS_PER_POP(TAB.BEDS_PER_POP > 20) = 20;
ncats = 5;
[BEDGROUP,GROUPS] = discretize(TAB.BEDS_PER_POP,ncats);
g = string(GROUPS(2:end)); g(end) = "20+";
TAB.BEDS_PER_1kPOP = categorical(BEDGROUP, 1:ncats, g);
fh = figure('Units','pixels','Position',[10 50 1200 700],'Color','w');
gb = geobubble(TAB,'LAT','LON', ...
'SizeVariable','BEDS','ColorVariable','BEDS_PER_1kPOP');
cm = cool(ncats+1);
gb.BubbleColorList = [cm(2:end,:); 1 1 1];