You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Brought over births.py from laser measles, and noted that it's an implementation of births that draws a number of births for the year, and then distributes them pretty much uniformly by day. This gets the aggregate noise structure right, but imposes really strong temporal correlations in noise. Probably a small effect, but as long as this draw step is not a major contributor to runtime, I think there are options to do better.
E.g., In year 1 & year 2, we randomly draw a Poisson # for the annual births. if doy == 1: model.patches.births[year, :] = model.prng.poisson(model.patches.populations[tick, :] * model.params.cbr / 1000)
Let's say that the mean is 1000 births, and so the std dev. is sqrt(1000) ~33.
It's a reasonable outcome to draw, say, 950 for the first year and 1050 for the second year, with that std. dev. And that's fine, that is within the expected variance of year to year births. We then distribute these as evenly as possible throughout the year todays_births = (annual_births * doy // 365) - (annual_births * (doy - 1) // 365)
Again, nothing is strictly "wrong" - the sum of N Poisson variables with rate parameter lambda/N is strictly equal to a 1 Poisson variable with rate parameter lambda, so it is exactly equally likely to get one year with 950 births and 1 year with 1050 drawing 730 days vs. 2 years. But the even distribution of births impose a step change on the average birth rate that happens at 1-year intervals, and there may be situations where this correlation ends up with odd results. So I wonder about finding a clean way to "noise up" the births appropriately at sub-year intervals.
Compared to the model running, drawing births for each day is not that expensive for sims of reasonable nticks*npatches. There may also be ways to draw the number of births for the year but don't necessarily distribute them perfectly evenly throughout the year.
Again, probably a small effect but always looking for places to improve fidelity without too much impact on overall performance.
The text was updated successfully, but these errors were encountered:
Brought over births.py from laser measles, and noted that it's an implementation of births that draws a number of births for the year, and then distributes them pretty much uniformly by day. This gets the aggregate noise structure right, but imposes really strong temporal correlations in noise. Probably a small effect, but as long as this draw step is not a major contributor to runtime, I think there are options to do better.
E.g., In year 1 & year 2, we randomly draw a Poisson # for the annual births.
if doy == 1: model.patches.births[year, :] = model.prng.poisson(model.patches.populations[tick, :] * model.params.cbr / 1000)
Let's say that the mean is 1000 births, and so the std dev. is sqrt(1000) ~33.
It's a reasonable outcome to draw, say, 950 for the first year and 1050 for the second year, with that std. dev. And that's fine, that is within the expected variance of year to year births. We then distribute these as evenly as possible throughout the year
todays_births = (annual_births * doy // 365) - (annual_births * (doy - 1) // 365)
Again, nothing is strictly "wrong" - the sum of N Poisson variables with rate parameter lambda/N is strictly equal to a 1 Poisson variable with rate parameter lambda, so it is exactly equally likely to get one year with 950 births and 1 year with 1050 drawing 730 days vs. 2 years. But the even distribution of births impose a step change on the average birth rate that happens at 1-year intervals, and there may be situations where this correlation ends up with odd results. So I wonder about finding a clean way to "noise up" the births appropriately at sub-year intervals.
Compared to the model running, drawing births for each day is not that expensive for sims of reasonable
nticks*npatches
. There may also be ways to draw the number of births for the year but don't necessarily distribute them perfectly evenly throughout the year.Again, probably a small effect but always looking for places to improve fidelity without too much impact on overall performance.
The text was updated successfully, but these errors were encountered: