andy-iskauskas / hmer

An R package for Bayes Linear emulation and history matching.
Other
16 stars 3 forks source link

SIRSimple model questions #16

Open jfunction opened 7 months ago

jfunction commented 7 months ago

Hi - thanks for this package it's very interesting.

I noticed the SIRSample dataset describes the underlying equations of an SIR model. eg, https://github.com/andy-iskauskas/hmer/blob/7a7f459ad63e2ca9baf6cabf2bc87d05f8c6d452/man/SIRSample.Rd#L31

In this model, the force of infection is effectively aSI*R/(S+I+R). Surely this should have I instead of R in the numerator here? As written, it is effectively saying that the infectious reservoir is those who have recovered.

Additionally, the definition of aSR is "Immunisation: transition rate from S to R". In the equations aSR*R is added to S' and subtracted from R' meaning that it models populations moving from R to S rather than moving from S to R - is this intended?

I may have missed it, but it would be most useful if a data generation script was included as described in https://r-pkgs.org/data.html#sec-data-data-raw - that would help to understand exactly how the data were generated.

jfunction commented 7 months ago

I wanted to note that after doing some tests using deSolve::ode it seems the generative model used to construct SIRSample outputs uses the following rates function:

function(t, state, parameters) {
    # Rates with foi as expected and immunity as stated (foi uses I, immunity is R->S)
    with(as.list(c(state, parameters)), {
      lambda <- aSI * I/(S+I+R)

      dS = aSR*R - lambda*S
      dI = lambda*S - aIR*I
      dR = aIR*I - aSR*R
      return(list(c(dS, dI, dR)))
    })

So it looks like documentation should read \item{aSR}{Waning immunity: transition rate from R to S} and S' = aSR*R - aSI*S*I/(S+I+R). That said I would usually expect to see lambda introduced as above.

andy-iskauskas commented 7 months ago

Hi, Yes, you're absolutely right about the errors in the documentation for SIRSample (and by extension, SIRImplausibility); that documentation has been fixed in commit 968468dfe2e4578c2858dbae9a5b9e0735c2fb75 - I'll leave this issue open, however, to remind myself to provide data-generation code within the package.