mrc-ide/malariasimulation

rate inputs for create_progression_process are average state residence times

Opened this issue · 3 comments

As raised in the PR #289, the create_progression_process() function (disease_progression.R), which governs the way individuals move between some pairs of states, has an argument rate which is currently passed mean state duration time. Within the function, the inverse of this rate argument is used to sample individuals to move between states.

While a fix has been suggested for naming the Bitset$sample() function in the individual package, in the meantime the malariasimulation code could be made clearer by passing the create_progression_process() function the rate in each instance in which it is called (e.g. 1/parameters$dt for transitions from the Tr to the S state).

Have made a working version with this fix on the bug/progression_process_rates branch

That branch is a good start.

I would suggest that, now it's clearer that $sample takes a probability, we:

  • rename the rate argument of create_progression_process (and asymp. prog. process) to prob
  • update the argument to take a probability 1- exp(-rate)
  • and check that this test continues to pass.

Separately, Individual will be updated to make that code clearer.

I changed the rate argument to prob and implemented the progression processes in the following way:

create_progression_process(
  variables$state,
  'U',
  'S',
  1 - exp(-1/parameters$du),
  variables$infectivity,
  0
)

Is this what you had in mind @giovannic?

The test flagged still passes. As I've now merged the SPC (#289) branch to dev, which changes the way the process moving individuals from Tr -> S is called, I need to align these changes to the updated version.