Covid-19 Case Fitting Curves
Esmerindo Bernardes
sousa@ifsc.usp.br
04/2020

Based on data from Covid-19 cases from China, a universal fitting curve is presented. Only five parameters are required to be determined by a given Covid-19 case data over a number of days. Under the special condition of reliable mass testing, this curve can indicate the flattening of a given case data after its inflection point is reached.

Model function:

model=b*Tanh[a*z-c]+d

Generic Case Data:

n=Length[covid]

data=Table[{i,covid[[i]]},{i,1,n}];

lsf=NonlinearModelFit[data,model,{{a,0.1},{c,4.0},{b,10^},{d,10^}},{z}]

lsf["BestFit"]

lsf["ParameterTable"]

lsf["ANOVATable"]

lsf["AdjustedRSquared"]

gr=Plot[{lsf[i]},{i,1,90},Epilog->{PointSize[Medium],Point[data]},PlotStyle->{{Red}},Frame->True,GridLines->Automatic,FrameLabel->{"N (days)","(Subscript[Z, N])"}]

ListPlot[lsf["FitResiduals"],Filling->Axis]

US Case Data:

covidus={5,53,57,60,63,68,75,100,124,158,221,319,435,541,704,994,1301,1630,2183,2770,3613,4596,6344,9197,13779,19367,24192,33592,43781,54856,68211,85435,104126,123578,143491,163788,188530,215003,244877,277161,311357,336673,367004,400335,434927,468566,502876,532879,560300,586941,617661,648003,677570,709735,738792,764636,792759,818744};
nus=Length[covidus]

dataus=Table[{n,covidus[[n]]},{n,1,nus}];

Nonlinear fitting:

lsfus=NonlinearModelFit[dataus,model,{{a,0.1},{c,4.0},{b,10^5},{d,10^5}},{z}]

lsfus["BestFit"]

lsfus["ParameterTable"]

lsfus["ANOVATable"]

lsfus["AdjustedRSquared"]

grus=Plot[{lsfus[n]},{n,1,90},Epilog->{PointSize[Medium],Point[dataus]},PlotStyle->{{Red}},Frame->True,GridLines->Automatic,FrameLabel->{"N (days)","(Subscript[Z, N])"}]

ListPlot[lsfus["FitResiduals"],Filling->Axis]

Iran Case Data:

covidir={2,5,18,29,43,61,95,139,245,388,593,978,1501,2336,2922,3513,4747,5823,6566,7161,8042,9000,10075,11364,12729,13938,14991,16169,17361,18407,19644,20610,21638,23049,24811,27017,29406,32332,35408,38309,41495,44605,47593,50468,53183,55743,58226,60500,62589,64586,66220,68192,70029,71686,73303,74877,76389,77995,79494,80868,82211,83505,84802};
nir=Length[covidir]
datair=Table[{n,covidir[[n]]},{n,1,nir}];

lsfir=NonlinearModelFit[datair,model,{{a,0.1},{c,4.0},{b,10^4},{d,10^4}},{z}]

lsfir["BestFit"]

lsfir["ParameterTable"]

lsfir["ANOVATable"]

lsfir["AdjustedRSquared"]

grir=Plot[{lsfir[i]},{i,1,90},Epilog->{PointSize[Medium],Point[datair]},PlotStyle->{{Red}},Frame->True,GridLines->Automatic,FrameLabel->{"N (days)","(Subscript[Z, N])"}]

ListPlot[lsfir["FitResiduals"],Filling->Axis]

ListPlot[lsfir["StandardizedResiduals"],Filling->Axis]

Show[{grus,grir}]

grw=Plot[{lsf[n],lsf2[n+22]},{n,1,90},Epilog->{PointSize[Medium],Point[data]},PlotStyle->{{Red},Blue},Frame->True,GridLines->Automatic,PlotLegends->Placed[{"(Subscript[Z, 83])","(Subscript[Z, 61])"},Below],FrameLabel->{"N (days)","(Subscript[Z, N])"}]