| Compartments (susceptible, infectious, …) |
ss.states(), ss.State() |
S, E, I, R = ss.states('S E I R') |
A quantity each person carries that changes continuously, such as a CD4 count that falls faster at a higher viral load |
| Counts that are not people (mosquitoes, bacteria in water) |
ss.State(people=False) |
W = ss.State(people=False), with ss.outside >> W @ xi*I.n for shedding into it |
A hydrological model of the river the bacteria are carried in |
| Flows at a rate |
>> and @, and ss.dead for flows into or out of the model |
R >> S @ ss.peryear(0.1), I >> ss.dead @ 0.01 |
A rate worked out each step by another program |
| Time in a state |
A duration, or a distribution of durations |
I >> R @ ss.days(8), E >> I @ ss.erlang(k=4, mean=ss.days(10)) |
A recovery time from a model of each person’s viral load within the host |
| Branching (a fraction goes one way, the rest another) |
p= |
ss.Transition(I, {R: 0.98, D: None}, dur=ss.days(8)) |
|
| Transmission, frequency- or density-dependent |
A bare state (a fraction), or a count, .n; with a contact matrix, each says what the matrix acts on (see What a matrix acts on) |
S >> I @ 1.9*I, S >> I @ 1.9e-5*I.n |
|
| Several sources of infection |
A sum |
S >> E @ beta*(I + 0.5*A) |
|
| Rates that depend on how many are infected |
Arithmetic and NumPy functions of counts |
S >> I @ beta*I.n/(1 + a*I.n) (a force of infection that saturates) |
|
| Rates that vary in time |
ss.timeseries(), ss.seasonal() |
beta = ss.seasonal(mean=0.3, amplitude=0.2, peak='March') |
|
| Rates that differ by group |
ss.by(), with a stratification |
ss.by(age=[0.5, 0.2, 0.1]) |
|
| Rates that depend on each person’s traits |
ss.person |
I >> ss.dead @ 0.001*np.exp(0.05*ss.person.age) |
|
| Values that vary between people (each person’s infectiousness) |
A distribution, or ss.attr() |
ss.attr(ss.normal(500, 50), when=infection) |
|
| An event in each person’s history (ever infected, how many times, how long ago) |
.ever, .n_times, .since on a transition or any other event (sir.I.enter.ever) |
1 - 0.5**(recovery.since/ss.days(60)): protection that halves every 60 days since recovery |
An antibody level boosted by every infection and decaying in between (as in Custom modules) |
| A move as soon as something holds, or happens |
A trigger, when= (or @ ss.on()) |
U >> A @ ss.on(ss.person.age >= 15), or ss.Transition(PP, NP, when=ss.on(preg.delivery, delay=ss.months(6))) |
|
| Who something applies to |
Conditions (who=): see below |
who=(sir.I.n >= 20_000) |
who= the highest weekly incidence so far |
| Contacts |
Homogeneous mixing (the default), contact matrices, mixing pools, and networks |
ss.contacts('Kenya'), ss.RandomNet(n_contacts=10), ss.SexualNet() |
A network rewired by a rule of your own, e.g. school classes reassigned each term |
| Groups and places |
Stratification, and movement between places |
sim.stratify(age=[0, 5, 15, 65]), ss.geo.Mobility() |
|
| Moving between groups (risk groups, vaccinated) |
ss.transfer() |
ss.transfer(dict(risk=('low', 'high')), rate=ss.peryear(0.1)) |
|
| Births, deaths, migration, pregnancy |
ss.birth(), ss.death(), ss.immigration(), ss.Pregnancy() |
ss.death(I, rate=ss.perday(0.002)) |
Migration driven by a model of household income |
| Vaccines, tests, and treatment |
Products (ss.Vaccine(), ss.Diagnostic(), ss.Treatment()) and deliveries (ss.vaccinate(), ss.screen(), ss.treat()), with coverage, ages, capacity, tracing, and waning |
ss.vaccinate(efficacy=0.97, who=measles.S, when='2025-04-01', coverage=0.5) |
Choosing whom to vaccinate by a score worked out each day from each person’s contacts |
| Measures that change a rate (masks, school closures, bednets) |
ss.modify() |
ss.modify(sir.pars.beta, multiply=0.7, start='2025-03-01', stop='2025-06-01') |
|
| Diseases that interact |
ss.modify() between them |
ss.modify(sti.rel_sus, multiply=3, who=hiv.I) |
|
| Strains, and immunity between them |
ss.Strains(), ss.immunity() |
ss.Strains(['DENV1', 'DENV2']), with ss.immunity() for the protection between them |
Protection worked out from each person’s antibody levels against each strain |
| Stocks, flows, and ratios |
Results of every state and transition, and expressions of them |
prevalence=(E + I)/N on the disease, with N = S + E + I + R |
The mean age at first infection of those who later died (an analyzer) |
| What surveillance sees (reported cases, admissions) |
ss.outcome(), with fractions, delays, and durations |
ss.outcome(0.5*onset, delay=ss.days(4)) |
|
| Parameters to fit |
ss.par() with bounds and priors |
ss.par(1.9, bounds=[1, 3]) |
|