NAVADMC / ADSM

A simulation of disease spread in livestock populations. Includes detection and containment simulation.
Other
10 stars 5 forks source link

InfcU - help with understanding how populated #929

Closed missyschoenbaum closed 5 years ago

missyschoenbaum commented 5 years ago

@ndh2 I need some assistance in understanding how the value is calculated for the output InfcU. I was writing up how we verify, and I can't get this one to consistently verify. I am thinking that I don't understand how the field is being filled to understand how to verify it.

I understand that in order to get a total infected, I should add InfcU and InfcUIni. Another way to put it - the index herd(s) are not added into the infection count, as they are already counted.

I am using the supplemental output file states_X.csv to check. Any unit that moves into any infected state I am counting. I am using a small, short example, so I don't have any units that are infected, become naturally immune and then become infected a 2nd time. I'm flipping daily states so I can see the full matrix of each unit as it moves through states.

I also know that daily_exposures_X gives me some information, but in that case the word "infection" really means "Adequate exposure" and infection only happens when I see a state change.

missyschoenbaum commented 5 years ago

Here's what my test looks like. In this case, I have 3 index units, and InfcU = 43. Test_InfcU

ConradSelig commented 5 years ago

From the table of output definitions in the wiki there are actually 4 versions of infcU output:

infcUDir Cumulative number of new infections caused by direct contact. Note that this will usually be lower than expcUDir, for 3 reasons: 1) not all exposures are adequate, 2) sometimes adequate exposures go to immune farms, and 3) sometimes multiple adequate exposures go to the same farm on the same day, but they result in only 1 new infection.
infcUInd Cumulative number of new infections caused by indirect contact.
infcUAir Cumulative number of new infections caused by airborne spread.
infcUAll Cumulative number of new infections, total for all routes of spread.

However I'm not sure how these values are calculated in the CEngine, what I can say is that there are are 4 variables (well 4 variable pointers it's all built into a "local_data" structure) that I believe store this data - I'm just not sure yet how they correlate.

It is possible that these DONT correlate one-to-one (actually chances are pretty good) and that they for variables above are split apart into the four reported variables. Even more interesting however is that the only place that I can find that I think is changing these variables they are being incremented by 1.

I do see where these variables are being translated into infcU, but it's in a very peculiar data structure like none I've ever seen before so more research is required.

@missyschoenbaum Is any of that helpful to you? I am willing to spend more time looking into this if you want.

missyschoenbaum commented 5 years ago

@ConradSelig sorry, not helpful. I need to know what is happening before it is gets accumulated. Somewhere those things are getting stored/written by day by farm in order to make a daily states file.

ndh2 commented 5 years ago

@missyschoenbaum I remember the history behind this one too and it’s kind of convoluted.

What would have been sensible: we should have counted 1 every time a unit changed from a non-infected to an infected state. That would have been simple and intuitive.

But we ended up doing something more complex because the infection and the state change are split across 2 days:

day n: one or more adequate exposures happens ← people wanted the infection logged/counted on this day, not the following day n+1: unit changes to infected state

The first part of how infections are counted is easy: if there is at least 1 adequate infection to a Susceptible unit on day n, we add 1 to infcU. However, there are some cases where an adequate infection on day n does not lead to a state change on day n+1. Specifically, when there is also a vaccination (with zero-day delay to immunity) or a destruction on day n. In those cases, there was some debate about what to count: did an "infection" really happen or not if we're never actually going to see a state change to an infected state?? The solution reached was to "flip a coin" and add 1 to infcU half the time in those cases.

missyschoenbaum commented 5 years ago

Thanks @ndh2 - excellent to have as documentation.