Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long-term ODE simulation shows negative number of cases #1

Closed
lisphilar opened this issue Jun 1, 2020 · 2 comments · Fixed by #4
Closed

Long-term ODE simulation shows negative number of cases #1

lisphilar opened this issue Jun 1, 2020 · 2 comments · Fixed by #4
Labels
bug Something isn't working

Comments

@lisphilar
Copy link
Owner

lisphilar commented Jun 1, 2020

Summary:
The number of cases must be a non-negetive integer. However, long-term ODE simulation shows negative number of cases.

Version 2.0.1

Related classes:

  • covsirphy.analysis.simulator.ODESimulator
  • covsirphy.ode.sirf.SIRF

Code:

import covsirphy as cs
# Settings
eg_population = 1_000_000
eg_tau = 1440
step_n = 1000  # Step number of simulation
param_dict = {"theta": 0.002, "kappa": 0.005, "rho": 0.2, "sigma": 0.075}
y0_dict = {"x": 0.999, "y": 0.001, "z": 0, "w": 0}
# Simulation
simulator = cs.ODESimulator(country="Example", province="Example-1")
simulator.add(
    model=cs.SIRF, step_n=step_n, population=eg_population,
    param_dict=param_dict, y0_dict=y0_dict
)
simulator.run()
# Non-dimensional
nondim_df = simulator.non_dim()

Output:
nondim_df is a dataframe and shows predicted values in non-dimensional ODE model.
(t: time step, x: Susceptible/Population, y: Infected/Population, z: Recovered/Population, w: Fatal/Population for SIR-F model.)
x, y, z and w must be a positive number of cases, but some x values are negative values.

Frequency:
Always

Environment:
Python 3.8, pipenv, WSL

@lisphilar lisphilar added the bug Something isn't working label Jun 1, 2020
@lisphilar
Copy link
Owner Author

I investigated the codes and outputs.
I found that y + dydt does not equal to the nex y (Infected/Population) value.

@lisphilar
Copy link
Owner Author

Closed with the pull request #4 (comment).
As mensioned in the pulld request, a new issue will be created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant