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

Difficulty replicating SIR TN-ILM Simulation and Inference #40

Open
Rock910 opened this issue May 4, 2023 · 6 comments
Open

Difficulty replicating SIR TN-ILM Simulation and Inference #40

Rock910 opened this issue May 4, 2023 · 6 comments

Comments

@Rock910
Copy link

Rock910 commented May 4, 2023

Hi,
I am having some difficulty replicating the SIR-TN-ILM Simulation and Inference.ipynb

Specifically at this line: obs = observe(sim, Uniform(0.5, 2.5), Uniform(0.5, 2.5), force=true)
I get an argument error, ArgumentError: Uniform: the condition a < b is not satisfied.
The stacktrace brings me to EventObservations.jl, where I modified default_rng to be MersenneTwister based on an error that I got previously(i..e that default_rng is not defined).

Would you have any guidance on this?
Thank you

@jangevaare
Copy link
Owner

jangevaare commented May 4, 2023

Can you confirm which version you are using - master branch, latest release etc.

I was in the process in enabling RNG specification throughout the package where I last left off IIRC.

Do you have an infection -> recovered transition that occurs in less than your observation lowerbound of 0.5 time units?

@Rock910
Copy link
Author

Rock910 commented May 7, 2023

Sure,
I'm using the master branch.
I don't believe so, when I try to check using the SIR plot(I've modified it to show time 0.00 to 0.05), it seems that the number of susceptible and infected is changing but not recovered, same goes for the network plot, where I have only purple and green nodes and no yellow before 0.05 time units.

@jangevaare
Copy link
Owner

I don't mean between 0 and 0.5 time units for the simulation, but rather, relative to each individual infection time

e.g. if an individual becomes infected at t=3.0, and by chance recovers at t=3.4, that infection would not be observable and not compatible with the force=true option.

@Rock910
Copy link
Author

Rock910 commented May 9, 2023

Oh I see,
Sorry about that, how do I check this?
Thank you!

@jangevaare
Copy link
Owner

Something like this:

# Initialize Simulation
sim = Simulation(...)

# Simulate up to t=200
simulate!(sim, tmax=200.0)

# Length of individual infectious periods
infection_lengths = sim.events.removal .- sim.events.infection

@Rock910
Copy link
Author

Rock910 commented May 9, 2023

Thank you,
From running this, I get:
[Inf, 65.9763967045659, NaN, 59.785132556856624, NaN, 17.63821967448159, 6.495348159419166, 14.667494259013868, 121.96081143417587, 5.941628720911943, 15.09647199170498, 11.332993309900417, 11.139411747684413, 77.53960969417591, 59.408711555105285, 2.2318466276152975, 103.7446297847919, 115.47789369628848, 3.946466194216235, 4.603277041282851, 17.74839218309205, 5.773807919014622, 4.933024633955242, 36.18666132904736, 11.433886050676342, 0.5432687968268368, 164.73225862410607, 4.885180635284534, 4.364415812635588, 2.0477903057130877, 12.95558234985645, NaN, 32.34392390237885, 49.03365521906527, 10.037282007442542, 0.9848841280562368, 15.312208572807679, 22.439238168515402, 18.796788903480866, 42.76173957562435, 0.778588742937167, 3.905699205882655, 13.432002159723146, 1.223713184491288, 60.719296042807116, 74.76988796699553, 23.455269322980136, 2.3528757836759873, 2.010669263092325, 49.06768872547122, 101.43135907599984, 1.1207628816670905, 69.45484779805943, 50.49673067544691, NaN, 16.80180859270157, 5.786430224613923, 3.571711856812911, 0.6594190112128402, 0.6182614968302484, 15.901649134440369, 43.16403994954648, 47.75416348134662, 8.227456455168081, 3.4564250793034503, 14.872374172201468, 3.4475857742651286, 1.9176480444762163, 22.4540593835777, 34.94849435627415, 81.25777471317318, 15.03365871497158, 35.57845651671822, 29.17946170479275, 1.0780794407542018, 4.962185549070298, 174.06052303373272, 15.829750932582568, 41.027625718523744, 3.747325399065115, 4.453627302859971, 6.373850244834813, 1.9561169794708242, 9.123913068720974, 3.5943881697514577, 2.7971511018056177, 18.96481386779506, 1.4045833327382358, 4.056101132293304, 13.674972473368364, 2.2383623354867055, 7.617903321726896, 1.1180999771063647, 0.8807766245960593, 20.229824604040395, 2.394861906149443, 1.3249286204349247, 44.983499229139476, 70.19544845663906, 7.002246365638555]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants