NTD-Modelling-Consortium / ntd-model-sch

NTD SCH model
MIT License
0 stars 6 forks source link

Alter mda method #45

Closed mattg3004 closed 2 months ago

mattg3004 commented 3 months ago

Align the MDA method with other diseases using beta random variables for probability of treatment based on coverage and snc values. When coverage or snc change, the probability of treatment will change for everyone, but the rank of probability will stay the same, e.g. the person who was most likely to get treated with the previous coverage and snc will still be the person most likely to get treated after the change.

When the population is initialized everyone is assigned a "treatProbability" of -1. At the first MDA, this value is updated for everyone. When someone dies, this is set to -1 again. At subsequent MDA's, if there is a different value of coverage or snc from the previous MDA then we first check for anyone with a -1 value, so that we can give them a value for treatProbability with the old coverage and snc, then they can be properly ranked alongside everyone else.

Requires the parameter file to have an "snc" parameter now, as this is read in when loading parameters.

tlestang commented 3 months ago

I see you went for an implementation very similar to the one featured in LF, where you use a placeholder value for the treatment probability of reset individuals until this value is computed later at the time of the next MDA. I think I get the logic, but I don't understand why not computing the next treatment probability value upon reset in doDeath directly.

Something like:

# helsim_FUNC_KK/events.py
def doDeath(..., params, ...):
    # ...
    new_ids = np.arange(maxID + 1, maxID + len(theDead) + 1)
    SD.id[theDead] = new_ids
    cov = get_coverage(params)
    SD.treatProbability[theDead] = drawTreatmentProbabilities(
        len(new_ids), cov=cov, snc=params.snc,
    )

then when the next MDA comes with different coverage and snc values, you only have to compute new probability values and order them accordingly to ensure rank correlation. Am I missing something?

It's the way it was implemented in Oncho (https://github.com/NTD-Modelling-Consortium/EPIONCHO-IBM/pull/60)

thk123 commented 3 months ago

Just noting the CI job that is failing is failing because this repo wrongly installs numpy2.0 - I'll get my fix for this into its own PR that we can merge ASAP.

thk123 commented 3 months ago

I've now fixed the numpy issue on master, so if you merge that into this branch the CI should go green.