tests/testthat/examples/sir.R

# nolint start (can't cope with uppercase names here)
update(S) <- S - n_SI
update(I) <- I + n_SI - n_IR
update(R) <- R + n_IR
p_SI <- 1 - exp(-beta * I / N) # S to I
p_IR <- 1 - exp(-gamma) # I to R
n_SI <- rbinom(S, p_SI)
n_IR <- rbinom(I, p_IR)
N <- S + I + R
initial(S) <- S_ini
initial(I) <- I_ini
initial(R) <- 0
S_ini <- user(1000)
I_ini <- user()
beta <- user(0.2)
gamma <- user(0.1)
# nolint end
mrc-ide/odin.dust documentation built on July 3, 2024, 1:33 p.m.