mrc-ide / odin.dust

Compile odin to dust
https://mrc-ide.github.io/odin.dust
Other
3 stars 1 forks source link

Support delays in compare #137

Open richfitz opened 1 year ago

richfitz commented 1 year ago

Starting from the base sir model in examples

r_SI <- beta * S * I / N
deriv(S) <-  -r_SI
deriv(I) <- r_SI - sigma * I
deriv(R) <- sigma * I 
initial(S) <- N - I0
initial(I) <- I0
initial(R) <- 0
N <- 1e7
I0 <- user(1)
beta <- user(24)
sigma <- 12
delta <- 1 / 5

add cumulative infections

initial(total_infected) <- 0
deriv(total_infected) <- r_SI

and from that, we want to do a comparison against data for which we have incidence

incidence_observed <- data()
compare(incidence_observed) ~ poisson(incidence_modelled + rexp(exp_noise))
exp_noise <- 1e8

which means we need an incidence measure, which we could write as

incidence_modelled <- total_infected - delay(total_infected, 7) # with t in days, this is weekly incidence