Worldwide Analysis of COVID-19 patients

The human coronavirus has a cunning nature of fast spreading and infecting people not only via droplets but it also remains persistant on various surfaces upto several days. Thus, it is required to isolate all possible patients from public places. Since COVID-19 has a rather long incubating period  it makes impossible (without special laboratory tests) to detect it on early stages. Thus, worldwide lockdown and self-isolation of population is a need in the current situation. Social distancing is the only way if not to stop the coronavirus completely but at least to slow down its pace in the world. For more information visit here.

Worldwide COVID-19 Patients Analysis using MATLAB

Data I collected from below link
https://github.com/datasets/covid-19

Read data as a table and name it as worldData

worldData=readtable('worldwide-aggregated.xlsx')
Above data is preview of table, total data is from 23-02-2020 to 09-04-2020

Plot current status of world

Extract active cases

active_cases=worldData.Confirmed-worldData.Deaths-worldData.Recovered; 

Plot confirmed cases, recovered cases,death cases and active cases

plot(worldData.Date,[worldData.Confirmed,worldData.Recovered,worldData.Deaths,active_cases],'LineWidth',2)
y_labels = get(gca, 'YTick'); % getting ydata
set(gca, 'YTickLabel', y_labels); % detting ydata as a label in current axis

legend(['Confirmed Cases ','=',num2str(worldData.Confirmed(end))],...
['Recovered cases','=',num2str(worldData.Recovered(end))],...
    ['Death Cases','=',num2str(worldData.Deaths(end))],...
    ['Active Cases','=',num2str(active_cases(end))], 'Location','northwest') % legend
axis tight
xticks([worldData.Date(1) worldData.Date(10:10:(end-10))' worldData.Date(end)]) % setting xticks manually
title('Worldwide Corona(COVID-19) Cases') % title of plot
on Y-Axis e is 10

Key Countries Analysis

Top 8 countries who have maximum COVID-19 Patients (Confirmed, Recovered,Death and Active cases)

plot(worldData.Date,[worldData.Confirmed,worldData.Recovered,worldData.Deaths,active_cases],'LineWidth',2)
y_labels = get(gca, 'YTick'); % getting ydata
set(gca, 'YTickLabel', y_labels); % detting ydata as a label in current axis

legend(['Confirmed Cases ','=',num2str(worldData.Confirmed(end))],...
['Recovered cases','=',num2str(worldData.Recovered(end))],...
    ['Death Cases','=',num2str(worldData.Deaths(end))],...
    ['Active Cases','=',num2str(active_cases(end))], 'Location','northwest') % legend
axis tight
xticks([worldData.Date(1) worldData.Date(10:10:(end-10))' worldData.Date(end)]) % setting xticks manually
title('Worldwide Corona(COVID-19) Cases') % title of plotkeyCountires=readtable("key-countries-pivoted.xlsx");
China, US, United_Kingdom, Italy, France, Germany, Spain and Iran

Plot current confirmed cases of each key country

plot(keyCountires.Date,[keyCountires.China,keyCountires.US,...
    keyCountires.United_Kingdom,keyCountires.Italy,...
    keyCountires.France,keyCountires.Germany,...
    keyCountires.Spain,keyCountires.Iran],...
    'LineWidth',2)
y_labels = get(gca, 'YTick');
set(gca, 'YTickLabel', y_labels)
xticks([keyCountires.Date(1) keyCountires.Date(10:10:(end-10))' keyCountires.Date(end)])
axis tight

legend(['China ','=',num2str(keyCountires.China(end))],...
    [ 'US ','=',num2str(keyCountires.US(end))],...
    [ 'UK ','=',num2str(keyCountires.United_Kingdom(end))],...
    [ 'Italy ','=',num2str(keyCountires.Italy(end))],...
    [ 'France ','=',num2str(keyCountires.France(end))],...
    [ 'Germany','=',num2str(keyCountires.Germany(end))],...
    [ 'Spain ','=',num2str(keyCountires.Spain(end))],...
    [ 'Iran ','=',num2str(keyCountires.Iran(end))], 'Location','northwest')
title('Key Countires')

Bar plot of key countries

Key_Countries=categorical({'China','US','United Kingdom','Italy',...
    'France','Germany','Spain','Iran'});
bar(Key_Countries,[keyCountires.China(end),keyCountires.US(end),...
keyCountires.United_Kingdom(end),...
    keyCountires.Italy(end),...
    keyCountires.France(end),keyCountires.Germany(end),...
keyCountires.Spain(end),keyCountires.Iran(end)])
text(Key_Countries,[keyCountires.China(end),...
keyCountires.US(end),keyCountires.United_Kingdom(end),...
    keyCountires.Italy(end),...
    keyCountires.France(end),keyCountires.Germany(end)...
,keyCountires.Spain(end),keyCountires.Iran(end)]+3000,...
   string( ceil([keyCountires.China(end),keyCountires.US(end),keyCountires.United_Kingdom(end),...
    keyCountires.Italy(end),...
    keyCountires.France(end),keyCountires.Germany(end),...
keyCountires.Spain(end),keyCountires.Iran(end)])))
y_labels = get(gca, 'YTick');
set(gca, 'YTickLabel', y_labels)
axis tight
title('Key Countires')

Forecasting Worldwide for next one month using Nonlinear Least Squre Method

you can use other regression methods there are various methods.
You can use app in MATLAB to fit as well.
Further if you want to use other methods like ML, DL, or other data science algorithms you can visit here to understand ML and AI.

t=[1:length(worldData.Date)]';
[xData, yData] = prepareCurveData( t, active_cases );

% Set up fittype and options.
ft = fittype( 'exp2' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.StartPoint = [-111133.257565926 0.0441743219546307 96590.5673106364 0.0490456238054553];

% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts );

pred=fitresult(t(end):t(end)+30);
datee=worldData.Date(end):worldData.Date(end)+day(30);
plot(datee',ceil(pred))
axis tight
yticklabels(num2str([ceil(pred(1:2:end));ceil(pred(end))]))
title('Worldwise Active Patients Forcast')
As per above figure you can see till 9th May 2020 total COVID-19 patients are showing 14440000, but all countries are taking proper action to fight against corona so lets hope this graph will fall down.


Machine Learning Model for COVID-19
.

Learn AI, ML, Curve Fitting and Optimization with MATLAB

Please write any query in comment below

Note:- Keep in mind that the COVID-19 analysis in this article is for educational purposes only not for publications. The goal is to inspire faculties, researchers and students, how deep learning and machine learning can make a big impact for such kind of analysis.

3 thoughts on “Worldwide Analysis of COVID-19 patients”

  1. Wow that was strange. I just wrote an incredibly long
    comment but after I clicked submit my comment didn’t
    appear. Grrrr… well I’m not writing all that over again. Anyway, just wanted to say fantastic
    blog!

Leave a Reply

Your email address will not be published.