Please help me model the event of
global cases of coronavirus with
a Logistic function.
I am trying the find the values of these three parameters
- X0 (X_zero)
$ cat data.txt
According to desmos, L is around 6000.
Only 6000? That’s not much of a pandemic. Latest figures
Total 2748 cases including 80 deaths (CHINA)
Total 2806 cases including 80 deaths (GLOBAL)
… (and also discuss the antivirals being trialed)
The National Health Commission said that
a combination of antiretroviral drugs used to treat HIV – lopinavir and ritonavir – had been given to some patients
infected with the Wuhan coronavirus at three of the capital’s hospitals…
maybe using the SIR model?
Agreed, however this curve fits pretty well. https://www.desmos.com/calculator/x4sqsc8naw R^2=.998. Much of the problem will be that the Chinese government is somewhat notorious for lying about disease spread to make things look better than they really are. This might be a case of GIGO
Fitting for the maximum value is pretty useless with data like this. You would need to be able to see the data curve down to make this prediction. (e.g. it still fits with L=1E9, https://www.desmos.com/calculator/ggpijibn4a).
To answer the question, this is how you would fit this in julia:
julia> using LsqFit
julia> d = [17,19,20,21,22,24,25,26];
julia> C = [41,62,201,291,440,830,1287,1975];
julia> model(x,p) = @. p/(1+exp(p*(p-x)));
julia> fit = curve_fit(model,d,C,[10000,0.5,10]);
julia> confidence_interval(fit, 0.05)
Interestingly we get a different value for L, not sure why. However, as expected, the confidence interval is huge, showing that this parameter is not important to the fit.
Note that LsqFit currently returns symmetric confidence intervals, which is why the lower bound makes no sense here.
Thank you, I got it
using LsqFit, CSV, DataFrames
csv = CSV.File("/Users/ssiew/juliascript/coronavirus/data.txt")
df = DataFrame!(csv)
day = df[:,:day]
cases = df[:,:cases]
model(x,p) = @. p/(1+exp(p*(p-x)));
fit = curve_fit(model,day,cases,[10000,0.5,10]);
parameter = coef(fit)
conf_interval = confidence_interval(fit, 0.05)
$ cat data.txt