lisphilar / covid19-sir

CovsirPhy: Python library for COVID-19 analysis with phase-dependent SIR-derived ODE models.
https://lisphilar.github.io/covid19-sir/
Apache License 2.0
109 stars 44 forks source link

Full compliment initial condition (problem with France) #421

Closed Inglezos closed 3 years ago

Inglezos commented 3 years ago

Summary

France has two issues: The first one, as the code currently is, is that during the Scenario call, it throws a:

UserWarning: 
The maximal number of iterations maxit (set to 20 by the program)
allowed for finding a smoothing spline with fp=s has been reached: s
too small.
There is an approximation returned but the corresponding weighted sum
of squared residuals does not satisfy the condition abs(fp-s)/s < tol.

which means that a spline action failed during the complement.

The second and major issue is the fact that the recovered data for France seem okay, even though they are kinda much lower than confirmed. I mean it would be more correct to let them be as they are. The condition that indicates wrongly the full compliment is in _recovered_full() the r > (c - f) * 0.1.

Since we compare right after that how close r is to c, using sel_2, I think it would be better to just remove it.

lisphilar commented 3 years ago

Please use the issue template for bugs with minimal codes.

lisphilar commented 3 years ago

For the first one, why extrapolation with spline failed?

lisphilar commented 3 years ago

I created pull request #425 to supress UserWarning in JHUDataComplementHandler._monotonic() and fix JHUDataComplementHandler._recovered_sort().

For the second one, do you mean if r > self.max_ignored and r > (c - f) * 0.1: should be removed? If yes, I agree and removed it with the pull request.

Inglezos commented 3 years ago

Yes that is what I meant. I approved these changes. I don't know why spline failed, perhaps it could not find suitable line to fit since order was 1 (I think with order=2 it could find).

lisphilar commented 3 years ago

Thank you. However, I have just found that full complement was not performed for Francce with this change. fra_records

Inglezos commented 3 years ago

I think that for France we have original valid recovered data, why full compliment is needed? They are continuously updated up until yesterday to max value 179087. There are no missing.

lisphilar commented 3 years ago

With the figure, I thought Recovered << Confirmed. I will check another source.

lisphilar commented 3 years ago

No discreapancy. We may need to use 179087 at this time.

Inglezos commented 3 years ago

Yes the recovered data as they are provided by JHU CSSE are way lower than the confirmed, but they seem valid. I think for this case it would be an exaggeration to fully compliment them, since they are not missing or totally invalid.

lisphilar commented 3 years ago

Thank you for confirmation. The pull request was merged and I will close this issue. Because this is a fatal error for France, new minor version 2.13.1 will be released.