macpan

Towards General Compartmental Modelling

Steve Walker

McMaster University

3/28/23

Take-Home

  • Compartmental modelling R package
  • Free and open source
  • McMasterPandemic reboot
  • Blazing Fast
  • Team-produced

Outline

  • Background and History
  • Examples
  • Speed πŸš€
  • Interface

Background and History

COVID-19 Model

COVID-19 Vaccination Model

Forecasting

Calibration – Trajectory Matching

  • Toy simulated data example
  • β€œObserved” case reports – dots
  • Model-predicted case reports – line
  • Optimize transmission rate using maximum likelihood

Timeline

+-----------+------+-------------------------------------------------------+
| nickname  | year | description                                           |
+-----------+------+-------------------------------------------------------+
| macpan1   | 2020 | original covid models in R engine                     |
| macpan1.5 | 2021 | fast C++ engine and flexibility for VOC modelling     |
| macpan2   | 2023 | general architecture to implement the lessons learned |
+-----------+------+-------------------------------------------------------+

More Examples of Usage

Examples of Usage

  • COVID-19 forecasts for agencies
    • Public Health Agency of Canada
    • Ontario Science Table
    • World Health Organization
      • South Africa – provincial and national level
      • Afro-Regional – 49 countries
    • Public Health Ontario

Examples of Usage

  • COVID-19 models for small jurisdictions
    • Newfoundland – Amy Hurford
    • Yukon – Lisa Kanary

Examples of Usage

  • Model structures
    • Macpan modelling group’s base model
    • Extensions of macpan – vaccination, VOC, and waste-water models
    • Metapopulation model of Newfoundland – 1000s of compartments
    • Endemic COVID-19 model
    • Monkeypox with two risk groups

Division of Labour (aside)

  • Players
    • Public / Stakeholders
    • Public Health Officials
    • Modellers

Division of Labour (aside)

  • Players
    • Public / Stakeholders
    • Public Health Officials
    • Modellers
    • Software Developers and Product Managers

Division of Labour (aside)

  • Modelling is hard, even with great software
  • Modellers should focus on biology and math

Division of Labour (aside)

  • Software development is hard too
  • Developers should focus on other things
    • Finding out what slows down modellers
    • Building tools that speeds them up

Example – fit to 5 data streams (PHO)

Example – fit to 5 data streams (PHO)

Example – endemic COVID-19

Example – endemic COVID-19

Example – waste-water

Edmonton

  • Prepared for Ontario Science Table by Maya Earn
  • Macpan base model with waste-water compartment
  • Fit to multiple data streams

Example – waste-water

Ottawa

  • Prepared for Ontario Science Table by Maya Earn
  • Macpan base model with waste-water compartment
  • Fit to multiple data streams

Lessons – modeller needs and wants

  • Speed
  • Functionality-rich
  • Extensible
  • Numerically stable
  • Modular model building
  • Version controlled models
  • Biologically principled
  • Statistically principled

Computational Speed

Need for Many Simulations

  • Model fitting
  • Each iteration of the optimizer requires one simulation

Need for Many Simulations

  • Forecast confidence intervals
  • Draw parameters from a distribution
  • Run one simulation per draw

Need for Many Simulations

  • Scenario exploration
  • Establish status-quo forecasts
  • One forecast requires n simulations
  • Run n more simulations for each additional scenario

Need for Many Simulations

  • Sensitivity analysis
  • Are results sensitive to modelling choices?
  • Run one simulation per sensitivity test

Computational Speed

  • Rewrote engine in C++
  • Seconds to hours
  • Not days to weeks

Computational Speed

βœ… πŸ‘ πŸ˜„ πŸ₯³ πŸš€

β€œIt is insanely fast and definitely saves me hours everyday and allows me to explore more scenarios. I can do many more things I couldn’t do before due to computational limitations.”

Computational Speed

βœ… πŸ‘ πŸ˜„ πŸ₯³ πŸš€

Early benchmark

+-----------------+--------------+
| Engine          | Run Time (s) |
+-----------------+--------------+
| Original R      |       1741.0 |
| Refactored C++  |          7.8 |
+-----------------+--------------+

Speedup: 224x

Interface

Interface Principles

  • Another component of speed
  • More difficult to solve than run-time speed
  • Identifying best practices is harder than writing code
  • If you cannot do it manually, you cannot automate it
  • Different interfaces for different roles

Interface for macpan 1.5

  • macpan1 had no interface for model definition
  • macpan1.5 was the first attempt to expose model definitions to the user

Interface for macpan 1.5

state = c(S = 20000, I = 100, R = 0)
params = c(gamma = 0.06, beta = 0.15, N = sum(state))

Interface for macpan 1.5

state = c(S = 20000, I = 100, R = 0)
params = c(gamma = 0.06, beta = 0.15, N = sum(state))
sir_model = (
  flexmodel(
    params = params,
    state = state
  )
)

Interface for macpan 1.5

state = c(S = 20000, I = 100, R = 0)
params = c(gamma = 0.06, beta = 0.15, N = sum(state))
sir_model = (
  flexmodel(
    params = params,
    state = state,
    start_date = "2000-01-01",
    end_date = "2000-05-01"
  )
)

Interface for macpan 1.5

state = c(S = 20000, I = 100, R = 0)
params = c(gamma = 0.06, beta = 0.15, N = sum(state))
sir_model = (
  flexmodel(
    params = params,
    state = state,
    start_date = "2000-01-01",
    end_date = "2000-05-01"
  )  
  %>% add_rate("S", "I", ~ (1/N) * (beta) * (I))
  %>% add_rate("I", "R", ~ (gamma))
)

Interface for macpan 1.5

state = c(S = 20000, I = 100, R = 0)
params = c(gamma = 0.06, beta = 0.15, N = sum(state))
sir_model = (
  flexmodel(
    params = params,
    state = state,
    start_date = "2000-01-01",
    end_date = "2000-05-01"
  )  
  %>% add_rate("S", "I", ~ (1/N) * (beta) * (I))
  %>% add_rate("I", "R", ~ (gamma))
)

Interface for macpan 1.5

  • Advantages
    • Modellers can make their own fast models
    • Easy to read and define simple models
  • Lessons
    • Limited model definition flexibility/extensibility
    • No underlying data structure
    • Challenging to maintain in real pipelines
    • Difficult to experiment with new interface designs

Interface for macpan 2

Goals:

  • Retain speed gains of macpan 1.5
  • Address flexibility/extensibility
  • Address pipeline maintenance issues
  • Architecture expects ideas about interface to change

Model Readability

  • Model definitions as directories of files
  • File format human-readable and computer-consumable
  • See the differences between two model versions
  • Stay organized with a revision history

Model Definition Files

Model Definition Files

  • List of variables
  • States, parameters, derived quantities
  • Separate from numerical values

Model Definition Files

  • List of variables
  • States, parameters, derived quantities
  • Separate from numerical values
  • Classify in different ways
  • Useful for structured models

Model Definition Files

Model Definition Files

Who Makes the Definition Files?

  • Depends on the user’s role
  • Build different interfaces
    • Point-and-click
    • Tidyverse-style
    • Model products
  • For now – Steve makes the files while talking to modellers

Readable Model Definitions

Readable Model Definitions

Model Definition Files – The Point

  • Establish a standard specification
  • Build different interfaces on top
  • Interfaces can change as we learn
  • Interfaces can be tailored

Extensibility

  • Easy-flexible trade-off
  • Easier tools tend to be less flexible
  • Better tools soften this trade-off
  • Modellers value flexibility more
  • Role-based interfaces

Extensible – model definition files

Extensible – model products

(in development)

Extensible – general model operations

(in development)

Extensible – general model operations

(in development)

Extensible – general model operations

(in development)

Extensible – general model operations

(in development)

Extensible – math expressions

Simple Birth Process

simple_sims(iteration_exprs = list(x ~ x + 0.01 * x)
  , time_steps = 10
  , x = 1
)$value
 [1] 1.000000 1.010000 1.020100 1.030301 1.040604 1.051010 1.061520 1.072135
 [9] 1.082857 1.093685 1.104622

Extensible – math expressions

Fibonacci

s = simple_sims(iteration_exprs = list(x ~ A %*% x)
  , time_steps = 10
  , A = matrix(c(1, 1, 1, 0), 2, 2)
  , x = c(1, 0)
)
dplyr::filter(s, row == 0)$value
 [1]  1  1  2  3  5  8 13 21 34 55 89

Extensible – edit model expressions

ExprList(
  before = list(),
  during = list(),
  after = list()
)

Extensible – edit model expressions

ExprList(
  before = list(N ~ sum(state_vector)),
  during = list(),
  after = list()
)

Extensible – edit model expressions

ExprList(
  before = list(N ~ sum(state_vector)),
  
  during = list(
    # force of infection
    flow_vector[foi_index] ~ beta * state_vector[I_index] / N
  ),
  
  after = list()
)

Extensible – edit model expressions

ExprList(
  before = list(N ~ sum(state_vector)),
  
  during = list(
    
    # force of infection
    flow_vector[foi_index] ~ beta * state_vector[I_index] / N,
    
    # state-update expressions common to a large class of models
    flows ~ flow_vector * state_vector[from_index],
    incidence_vector ~ groupSums(flows, to_index, n_states),
    outflow_vector ~ groupSums(flows, from_index, n_states),
    state_vector ~ state_vector + incidence_vector - outflow_vector
  ),
  
  after = list()
)

Extensible – C++ Level

engine_eval(~ log(1))
     [,1]
[1,]    0

Extensible – C++ Level

engine_eval(~ sin(1))
Error in TMBSimulator(m) : 
The tmb_model object is malformed,
with the following explanation:
Error in get_indices(x_char[is_func], vec = names(valid_funcs), vec_type = "functions",  : 
  
the expression given by:
sin(1)

contained the following functions:
sin

 that were not found in the list of available functions:
+ - * / ^ exp log ( c matrix %*% sum rep rowSums colSums groupSums [ block t rbind_time rbind_lag cbind_time cbind_lag : seq convolution cbind rbind time_step assign unpack recycle clamp dpois dnbinom dnorm rpois rnbinom rnorm
Please see ?engine_functions for more information on the available functions.

Extensible – C++ Level

Extensible – plug into tidyverse

Extensible – plug into tidyverse

              matrix time row col        value
1       state_vector    0   S     1.000000e+02
2       state_vector    0   E     1.000000e+00
3       state_vector    0   I     0.000000e+00
4       state_vector    0   R     0.000000e+00
5       state_vector    1   S     1.000000e+02
6       state_vector    1   E     9.000000e-01
7       state_vector    1   I     1.000000e-01
8       state_vector    1   R     0.000000e+00
9       state_vector    2   S     9.996040e+01
10      state_vector    2   E     8.496040e-01
11      state_vector    2   I     1.840000e-01
12      state_vector    2   R     6.000000e-03
13      state_vector    3   S     9.988755e+01
14      state_vector    3   E     8.374860e-01
15      state_vector    3   I     2.579204e-01
16      state_vector    3   R     1.704000e-02
17      state_vector    4   S     9.978552e+01
18      state_vector    4   E     8.557692e-01
19      state_vector    4   I     3.261938e-01
20      state_vector    4   R     3.251522e-02
21      state_vector    5   S     9.965661e+01
22      state_vector    5   E     8.991009e-01
23      state_vector    5   I     3.921991e-01
24      state_vector    5   R     5.208685e-02
25      state_vector    6   S     9.950182e+01
26      state_vector    6   E     9.639838e-01
27      state_vector    6   I     4.585772e-01
28      state_vector    6   R     7.561879e-02
29      state_vector    7   S     9.932111e+01
30      state_vector    7   E     1.048295e+00
31      state_vector    7   I     5.274610e-01
32      state_vector    7   R     1.031334e-01
33      state_vector    8   S     9.911363e+01
34      state_vector    8   E     1.150943e+00
35      state_vector    8   I     6.006428e-01
36      state_vector    8   R     1.347811e-01
37      state_vector    9   S     9.887786e+01
38      state_vector    9   E     1.271619e+00
39      state_vector    9   I     6.796986e-01
40      state_vector    9   R     1.708197e-01
41      state_vector   10   S     9.861170e+01
42      state_vector   10   E     1.410624e+00
43      state_vector   10   I     7.660785e-01
44      state_vector   10   R     2.116016e-01
45      state_vector   11   S     9.831251e+01
46      state_vector   11   E     1.568747e+00
47      state_vector   11   I     8.611762e-01
48      state_vector   11   R     2.575663e-01
49      state_vector   12   S     9.797721e+01
50      state_vector   12   E     1.747177e+00
51      state_vector   12   I     9.663803e-01
52      state_vector   12   R     3.092369e-01
53      state_vector   13   S     9.760222e+01
54      state_vector   13   E     1.947442e+00
55      state_vector   13   I     1.083115e+00
56      state_vector   13   R     3.672197e-01
57      state_vector   14   S     9.718355e+01
58      state_vector   14   E     2.171369e+00
59      state_vector   14   I     1.212872e+00
60      state_vector   14   R     4.322066e-01
61      state_vector   15   S     9.671674e+01
62      state_vector   15   E     2.421049e+00
63      state_vector   15   I     1.357237e+00
64      state_vector   15   R     5.049789e-01
65      state_vector   16   S     9.619686e+01
66      state_vector   16   E     2.698815e+00
67      state_vector   16   I     1.517908e+00
68      state_vector   16   R     5.864131e-01
69      state_vector   17   S     9.561857e+01
70      state_vector   17   E     3.007223e+00
71      state_vector   17   I     1.696715e+00
72      state_vector   17   R     6.774876e-01
73      state_vector   18   S     9.497605e+01
74      state_vector   18   E     3.349025e+00
75      state_vector   18   I     1.895634e+00
76      state_vector   18   R     7.792905e-01
77      state_vector   19   S     9.426302e+01
78      state_vector   19   E     3.727152e+00
79      state_vector   19   I     2.116799e+00
80      state_vector   19   R     8.930285e-01
81      state_vector   20   S     9.347278e+01
82      state_vector   20   E     4.144677e+00
83      state_vector   20   I     2.362506e+00
84      state_vector   20   R     1.020036e+00
85      state_vector   21   S     9.259821e+01
86      state_vector   21   E     4.604784e+00
87      state_vector   21   I     2.635223e+00
88      state_vector   21   R     1.161787e+00
89      state_vector   22   S     9.163180e+01
90      state_vector   22   E     5.110709e+00
91      state_vector   22   I     2.937588e+00
92      state_vector   22   R     1.319900e+00
93      state_vector   23   S     9.056576e+01
94      state_vector   23   E     5.665684e+00
95      state_vector   23   I     3.272404e+00
96      state_vector   23   R     1.496155e+00
97      state_vector   24   S     8.939202e+01
98      state_vector   24   E     6.272849e+00
99      state_vector   24   I     3.642628e+00
100     state_vector   24   R     1.692500e+00
101     state_vector   25   S     8.810243e+01
102     state_vector   25   E     6.935156e+00
103     state_vector   25   I     4.051355e+00
104     state_vector   25   R     1.911057e+00
105     state_vector   26   S     8.668883e+01
106     state_vector   26   E     7.655241e+00
107     state_vector   26   I     4.501789e+00
108     state_vector   26   R     2.154139e+00
109     state_vector   27   S     8.514327e+01
110     state_vector   27   E     8.435281e+00
111     state_vector   27   I     4.997206e+00
112     state_vector   27   R     2.424246e+00
113     state_vector   28   S     8.345820e+01
114     state_vector   28   E     9.276816e+00
115     state_vector   28   I     5.540902e+00
116     state_vector   28   R     2.724078e+00
117     state_vector   29   S     8.162678e+01
118     state_vector   29   E     1.018055e+01
119     state_vector   29   I     6.136129e+00
120     state_vector   29   R     3.056533e+00
121     state_vector   30   S     7.964313e+01
122     state_vector   30   E     1.114615e+01
123     state_vector   30   I     6.786017e+00
124     state_vector   30   R     3.424700e+00
125     state_vector   31   S     7.750270e+01
126     state_vector   31   E     1.217197e+01
127     state_vector   31   I     7.493471e+00
128     state_vector   31   R     3.831861e+00
129     state_vector   32   S     7.520264e+01
130     state_vector   32   E     1.325483e+01
131     state_vector   32   I     8.261060e+00
132     state_vector   32   R     4.281470e+00
133     state_vector   33   S     7.274223e+01
134     state_vector   33   E     1.438976e+01
135     state_vector   33   I     9.090880e+00
136     state_vector   33   R     4.777133e+00
137     state_vector   34   S     7.012326e+01
138     state_vector   34   E     1.556976e+01
139     state_vector   34   I     9.984403e+00
140     state_vector   34   R     5.322586e+00
141     state_vector   35   S     6.735043e+01
142     state_vector   35   E     1.678561e+01
143     state_vector   35   I     1.094231e+01
144     state_vector   35   R     5.921650e+00
145     state_vector   36   S     6.443174e+01
146     state_vector   36   E     1.802574e+01
147     state_vector   36   I     1.196434e+01
148     state_vector   36   R     6.578189e+00
149     state_vector   37   S     6.137874e+01
150     state_vector   37   E     1.927617e+01
151     state_vector   37   I     1.304905e+01
152     state_vector   37   R     7.296049e+00
153     state_vector   38   S     5.820672e+01
154     state_vector   38   E     2.052057e+01
155     state_vector   38   I     1.419372e+01
156     state_vector   38   R     8.078992e+00
157     state_vector   39   S     5.493476e+01
158     state_vector   39   E     2.174047e+01
159     state_vector   39   I     1.539416e+01
160     state_vector   39   R     8.930616e+00
161     state_vector   40   S     5.158555e+01
162     state_vector   40   E     2.291563e+01
163     state_vector   40   I     1.664455e+01
164     state_vector   40   R     9.854265e+00
165     state_vector   41   S     4.818508e+01
166     state_vector   41   E     2.402453e+01
167     state_vector   41   I     1.793744e+01
168     state_vector   41   R     1.085294e+01
169     state_vector   42   S     4.476205e+01
170     state_vector   42   E     2.504512e+01
171     state_vector   42   I     1.926365e+01
172     state_vector   42   R     1.192918e+01
173     state_vector   43   S     4.134707e+01
174     state_vector   43   E     2.595558e+01
175     state_vector   43   I     2.061234e+01
176     state_vector   43   R     1.308500e+01
177     state_vector   44   S     3.797179e+01
178     state_vector   44   E     2.673531e+01
179     state_vector   44   I     2.197116e+01
180     state_vector   44   R     1.432174e+01
181     state_vector   45   S     3.466769e+01
182     state_vector   45   E     2.736587e+01
183     state_vector   45   I     2.332642e+01
184     state_vector   45   R     1.564001e+01
185     state_vector   46   S     3.146502e+01
186     state_vector   46   E     2.783195e+01
187     state_vector   46   I     2.466342e+01
188     state_vector   46   R     1.703960e+01
189     state_vector   47   S     2.839162e+01
190     state_vector   47   E     2.812216e+01
191     state_vector   47   I     2.596681e+01
192     state_vector   47   R     1.851940e+01
193     state_vector   48   S     2.547186e+01
194     state_vector   48   E     2.822971e+01
195     state_vector   48   I     2.722102e+01
196     state_vector   48   R     2.007741e+01
197     state_vector   49   S     2.272584e+01
198     state_vector   49   E     2.815276e+01
199     state_vector   49   I     2.841073e+01
200     state_vector   49   R     2.171067e+01
201     state_vector   50   S     2.016878e+01
202     state_vector   50   E     2.789454e+01
203     state_vector   50   I     2.952136e+01
204     state_vector   50   R     2.341532e+01
205     state_vector   51   S     1.781072e+01
206     state_vector   51   E     2.746315e+01
207     state_vector   51   I     3.053954e+01
208     state_vector   51   R     2.518660e+01
209     state_vector   52   S     1.565654e+01
210     state_vector   52   E     2.687101e+01
211     state_vector   52   I     3.145348e+01
212     state_vector   52   R     2.701897e+01
213     state_vector   53   S     1.370623e+01
214     state_vector   53   E     2.613422e+01
215     state_vector   53   I     3.225337e+01
216     state_vector   53   R     2.890618e+01
217     state_vector   54   S     1.195545e+01
218     state_vector   54   E     2.527158e+01
219     state_vector   54   I     3.293159e+01
220     state_vector   54   R     3.084138e+01
221     state_vector   55   S     1.039619e+01
222     state_vector   55   E     2.430368e+01
223     state_vector   55   I     3.348285e+01
224     state_vector   55   R     3.281728e+01
225     state_vector   56   S     9.017602e+00
226     state_vector   56   E     2.325190e+01
227     state_vector   56   I     3.390425e+01
228     state_vector   56   R     3.482625e+01
229     state_vector   57   S     7.806770e+00
230     state_vector   57   E     2.213754e+01
231     state_vector   57   I     3.419518e+01
232     state_vector   57   R     3.686051e+01
233     state_vector   58   S     6.749527e+00
234     state_vector   58   E     2.098103e+01
235     state_vector   58   I     3.435723e+01
236     state_vector   58   R     3.891222e+01
237     state_vector   59   S     5.831131e+00
238     state_vector   59   E     1.980132e+01
239     state_vector   59   I     3.439390e+01
240     state_vector   59   R     4.097365e+01
241     state_vector   60   S     5.036852e+00
242     state_vector   60   E     1.861547e+01
243     state_vector   60   I     3.431039e+01
244     state_vector   60   R     4.303728e+01
245     state_vector   61   S     4.352431e+00
246     state_vector   61   E     1.743834e+01
247     state_vector   61   I     3.411332e+01
248     state_vector   61   R     4.509591e+01
249     state_vector   62   S     3.764408e+00
250     state_vector   62   E     1.628253e+01
251     state_vector   62   I     3.381035e+01
252     state_vector   62   R     4.714271e+01
253     state_vector   63   S     3.260345e+00
254     state_vector   63   E     1.515834e+01
255     state_vector   63   I     3.340999e+01
256     state_vector   63   R     4.917133e+01
257     state_vector   64   S     2.828946e+00
258     state_vector   64   E     1.407391e+01
259     state_vector   64   I     3.292122e+01
260     state_vector   64   R     5.117593e+01
261     state_vector   65   S     2.460105e+00
262     state_vector   65   E     1.303536e+01
263     state_vector   65   I     3.235334e+01
264     state_vector   65   R     5.315120e+01
265     state_vector   66   S     2.144887e+00
266     state_vector   66   E     1.204704e+01
267     state_vector   66   I     3.171567e+01
268     state_vector   66   R     5.509240e+01
269     state_vector   67   S     1.875475e+00
270     state_vector   67   E     1.111175e+01
271     state_vector   67   I     3.101744e+01
272     state_vector   67   R     5.699534e+01
273     state_vector   68   S     1.645089e+00
274     state_vector   68   E     1.023096e+01
275     state_vector   68   I     3.026757e+01
276     state_vector   68   R     5.885639e+01
277     state_vector   69   S     1.447890e+00
278     state_vector   69   E     9.405062e+00
279     state_vector   69   I     2.947461e+01
280     state_vector   69   R     6.067244e+01
281     state_vector   70   S     1.278876e+00
282     state_vector   70   E     8.633570e+00
283     state_vector   70   I     2.864664e+01
284     state_vector   70   R     6.244092e+01
285     state_vector   71   S     1.133785e+00
286     state_vector   71   E     7.915304e+00
287     state_vector   71   I     2.779120e+01
288     state_vector   71   R     6.415972e+01
289     state_vector   72   S     1.008996e+00
290     state_vector   72   E     7.248562e+00
291     state_vector   72   I     2.691525e+01
292     state_vector   72   R     6.582719e+01
293     state_vector   73   S     9.014418e-01
294     state_vector   73   E     6.631260e+00
295     state_vector   73   I     2.602520e+01
296     state_vector   73   R     6.744210e+01
297     state_vector   74   S     8.085301e-01
298     state_vector   74   E     6.061046e+00
299     state_vector   74   I     2.512681e+01
300     state_vector   74   R     6.900361e+01
301     state_vector   75   S     7.280716e-01
302     state_vector   75   E     5.535400e+00
303     state_vector   75   I     2.422531e+01
304     state_vector   75   R     7.051122e+01
305     state_vector   76   S     6.582191e-01
306     state_vector   76   E     5.051712e+00
307     state_vector   76   I     2.332533e+01
308     state_vector   76   R     7.196474e+01
309     state_vector   77   S     5.974144e-01
310     state_vector   77   E     4.607346e+00
311     state_vector   77   I     2.243098e+01
312     state_vector   77   R     7.336426e+01
313     state_vector   78   S     5.443428e-01
314     state_vector   78   E     4.199683e+00
315     state_vector   78   I     2.154585e+01
316     state_vector   78   R     7.471012e+01
317     state_vector   79   S     4.978940e-01
318     state_vector   79   E     3.826163e+00
319     state_vector   79   I     2.067307e+01
320     state_vector   79   R     7.600287e+01
321     state_vector   80   S     4.571296e-01
322     state_vector   80   E     3.484311e+00
323     state_vector   80   I     1.981530e+01
324     state_vector   80   R     7.724326e+01
325     state_vector   81   S     4.212557e-01
326     state_vector   81   E     3.171754e+00
327     state_vector   81   I     1.897482e+01
328     state_vector   81   R     7.843217e+01
329     state_vector   82   S     3.895993e-01
330     state_vector   82   E     2.886235e+00
331     state_vector   82   I     1.815350e+01
332     state_vector   82   R     7.957066e+01
333     state_vector   83   S     3.615890e-01
334     state_vector   83   E     2.625622e+00
335     state_vector   83   I     1.735292e+01
336     state_vector   83   R     8.065987e+01
337     state_vector   84   S     3.367390e-01
338     state_vector   84   E     2.387910e+00
339     state_vector   84   I     1.657430e+01
340     state_vector   84   R     8.170105e+01
341     state_vector   85   S     3.146352e-01
342     state_vector   85   E     2.171223e+00
343     state_vector   85   I     1.581864e+01
344     state_vector   85   R     8.269551e+01
345     state_vector   86   S     2.949239e-01
346     state_vector   86   E     1.973812e+00
347     state_vector   86   I     1.508664e+01
348     state_vector   86   R     8.364462e+01
349     state_vector   87   S     2.773025e-01
350     state_vector   87   E     1.794052e+00
351     state_vector   87   I     1.437882e+01
352     state_vector   87   R     8.454982e+01
353     state_vector   88   S     2.615113e-01
354     state_vector   88   E     1.630438e+00
355     state_vector   88   I     1.369550e+01
356     state_vector   88   R     8.541255e+01
357     state_vector   89   S     2.473270e-01
358     state_vector   89   E     1.481578e+00
359     state_vector   89   I     1.303681e+01
360     state_vector   89   R     8.623428e+01
361     state_vector   90   S     2.345573e-01
362     state_vector   90   E     1.346190e+00
363     state_vector   90   I     1.240276e+01
364     state_vector   90   R     8.701649e+01
365     state_vector   91   S     2.230358e-01
366     state_vector   91   E     1.223093e+00
367     state_vector   91   I     1.179322e+01
368     state_vector   91   R     8.776066e+01
369     state_vector   92   S     2.126188e-01
370     state_vector   92   E     1.111200e+00
371     state_vector   92   I     1.120793e+01
372     state_vector   92   R     8.846825e+01
373     state_vector   93   S     2.031811e-01
374     state_vector   93   E     1.009518e+00
375     state_vector   93   I     1.064658e+01
376     state_vector   93   R     8.914073e+01
377     state_vector   94   S     1.946140e-01
378     state_vector   94   E     9.171334e-01
379     state_vector   94   I     1.010873e+01
380     state_vector   94   R     8.977952e+01
381     state_vector   95   S     1.868227e-01
382     state_vector   95   E     8.332113e-01
383     state_vector   95   I     9.593922e+00
384     state_vector   95   R     9.038604e+01
385     state_vector   96   S     1.797243e-01
386     state_vector   96   E     7.569887e-01
387     state_vector   96   I     9.101608e+00
388     state_vector   96   R     9.096168e+01
389     state_vector   97   S     1.732459e-01
390     state_vector   97   E     6.877681e-01
391     state_vector   97   I     8.631211e+00
392     state_vector   97   R     9.150778e+01
393     state_vector   98   S     1.673239e-01
394     state_vector   98   E     6.249134e-01
395     state_vector   98   I     8.182115e+00
396     state_vector   98   R     9.202565e+01
397     state_vector   99   S     1.619018e-01
398     state_vector   99   E     5.678441e-01
399     state_vector   99   I     7.753679e+00
400     state_vector   99   R     9.251657e+01
401     state_vector  100   S     1.569302e-01
402     state_vector  100   E     5.160313e-01
403     state_vector  100   I     7.345243e+00
404     state_vector  100   R     9.298180e+01
409 incidence_vector    1   S     0.000000e+00
410 incidence_vector    1   E     0.000000e+00
411 incidence_vector    1   I     1.000000e-01
412 incidence_vector    1   R     0.000000e+00
413 incidence_vector    2   S     0.000000e+00
414 incidence_vector    2   E     3.960396e-02
415 incidence_vector    2   I     9.000000e-02
416 incidence_vector    2   R     6.000000e-03
417 incidence_vector    3   S     0.000000e+00
418 incidence_vector    3   E     7.284243e-02
419 incidence_vector    3   I     8.496040e-02
420 incidence_vector    3   R     1.104000e-02
421 incidence_vector    4   S     0.000000e+00
422 incidence_vector    4   E     1.020318e-01
423 incidence_vector    4   I     8.374860e-02
424 incidence_vector    4   R     1.547522e-02
425 incidence_vector    5   S     0.000000e+00
426 incidence_vector    5   E     1.289086e-01
427 incidence_vector    5   I     8.557692e-02
428 incidence_vector    5   R     1.957163e-02
429 incidence_vector    6   S     0.000000e+00
430 incidence_vector    6   E     1.547930e-01
431 incidence_vector    6   I     8.991009e-02
432 incidence_vector    6   R     2.353194e-02
433 incidence_vector    7   S     0.000000e+00
434 incidence_vector    7   E     1.807100e-01
435 incidence_vector    7   I     9.639838e-02
436 incidence_vector    7   R     2.751463e-02
437 incidence_vector    8   S     0.000000e+00
438 incidence_vector    8   E     2.074773e-01
439 incidence_vector    8   I     1.048295e-01
440 incidence_vector    8   R     3.164766e-02
441 incidence_vector    9   S     0.000000e+00
442 incidence_vector    9   E     2.357699e-01
443 incidence_vector    9   I     1.150943e-01
444 incidence_vector    9   R     3.603857e-02
445 incidence_vector   10   S     0.000000e+00
446 incidence_vector   10   E     2.661669e-01
447 incidence_vector   10   I     1.271619e-01
448 incidence_vector   10   R     4.078191e-02
449 incidence_vector   11   S     0.000000e+00
450 incidence_vector   11   E     2.991854e-01
451 incidence_vector   11   I     1.410624e-01
452 incidence_vector   11   R     4.596471e-02
453 incidence_vector   12   S     0.000000e+00
454 incidence_vector   12   E     3.353045e-01
455 incidence_vector   12   I     1.568747e-01
456 incidence_vector   12   R     5.167057e-02
457 incidence_vector   13   S     0.000000e+00
458 incidence_vector   13   E     3.749831e-01
459 incidence_vector   13   I     1.747177e-01
460 incidence_vector   13   R     5.798282e-02
461 incidence_vector   14   S     0.000000e+00
462 incidence_vector   14   E     4.186711e-01
463 incidence_vector   14   I     1.947442e-01
464 incidence_vector   14   R     6.498691e-02
465 incidence_vector   15   S     0.000000e+00
466 incidence_vector   15   E     4.668168e-01
467 incidence_vector   15   I     2.171369e-01
468 incidence_vector   15   R     7.277234e-02
469 incidence_vector   16   S     0.000000e+00
470 incidence_vector   16   E     5.198714e-01
471 incidence_vector   16   I     2.421049e-01
472 incidence_vector   16   R     8.143422e-02
473 incidence_vector   17   S     0.000000e+00
474 incidence_vector   17   E     5.782889e-01
475 incidence_vector   17   I     2.698815e-01
476 incidence_vector   17   R     9.107446e-02
477 incidence_vector   18   S     0.000000e+00
478 incidence_vector   18   E     6.425245e-01
479 incidence_vector   18   I     3.007223e-01
480 incidence_vector   18   R     1.018029e-01
481 incidence_vector   19   S     0.000000e+00
482 incidence_vector   19   E     7.130291e-01
483 incidence_vector   19   I     3.349025e-01
484 incidence_vector   19   R     1.137380e-01
485 incidence_vector   20   S     0.000000e+00
486 incidence_vector   20   E     7.902409e-01
487 incidence_vector   20   I     3.727152e-01
488 incidence_vector   20   R     1.270079e-01
489 incidence_vector   21   S     0.000000e+00
490 incidence_vector   21   E     8.745742e-01
491 incidence_vector   21   I     4.144677e-01
492 incidence_vector   21   R     1.417503e-01
493 incidence_vector   22   S     0.000000e+00
494 incidence_vector   22   E     9.664037e-01
495 incidence_vector   22   I     4.604784e-01
496 incidence_vector   22   R     1.581134e-01
497 incidence_vector   23   S     0.000000e+00
498 incidence_vector   23   E     1.066046e+00
499 incidence_vector   23   I     5.110709e-01
500 incidence_vector   23   R     1.762553e-01
501 incidence_vector   24   S     0.000000e+00
502 incidence_vector   24   E     1.173734e+00
503 incidence_vector   24   I     5.665684e-01
504 incidence_vector   24   R     1.963442e-01
505 incidence_vector   25   S     0.000000e+00
506 incidence_vector   25   E     1.289592e+00
507 incidence_vector   25   I     6.272849e-01
508 incidence_vector   25   R     2.185577e-01
509 incidence_vector   26   S     0.000000e+00
510 incidence_vector   26   E     1.413601e+00
511 incidence_vector   26   I     6.935156e-01
512 incidence_vector   26   R     2.430813e-01
513 incidence_vector   27   S     0.000000e+00
514 incidence_vector   27   E     1.545564e+00
515 incidence_vector   27   I     7.655241e-01
516 incidence_vector   27   R     2.701074e-01
517 incidence_vector   28   S     0.000000e+00
518 incidence_vector   28   E     1.685063e+00
519 incidence_vector   28   I     8.435281e-01
520 incidence_vector   28   R     2.998324e-01
521 incidence_vector   29   S     0.000000e+00
522 incidence_vector   29   E     1.831421e+00
523 incidence_vector   29   I     9.276816e-01
524 incidence_vector   29   R     3.324541e-01
525 incidence_vector   30   S     0.000000e+00
526 incidence_vector   30   E     1.983653e+00
527 incidence_vector   30   I     1.018055e+00
528 incidence_vector   30   R     3.681678e-01
529 incidence_vector   31   S     0.000000e+00
530 incidence_vector   31   E     2.140434e+00
531 incidence_vector   31   I     1.114615e+00
532 incidence_vector   31   R     4.071610e-01
533 incidence_vector   32   S     0.000000e+00
534 incidence_vector   32   E     2.300056e+00
535 incidence_vector   32   I     1.217197e+00
536 incidence_vector   32   R     4.496083e-01
537 incidence_vector   33   S     0.000000e+00
538 incidence_vector   33   E     2.460410e+00
539 incidence_vector   33   I     1.325483e+00
540 incidence_vector   33   R     4.956636e-01
541 incidence_vector   34   S     0.000000e+00
542 incidence_vector   34   E     2.618974e+00
543 incidence_vector   34   I     1.438976e+00
544 incidence_vector   34   R     5.454528e-01
545 incidence_vector   35   S     0.000000e+00
546 incidence_vector   35   E     2.772827e+00
547 incidence_vector   35   I     1.556976e+00
548 incidence_vector   35   R     5.990642e-01
549 incidence_vector   36   S     0.000000e+00
550 incidence_vector   36   E     2.918691e+00
551 incidence_vector   36   I     1.678561e+00
552 incidence_vector   36   R     6.565388e-01
553 incidence_vector   37   S     0.000000e+00
554 incidence_vector   37   E     3.053002e+00
555 incidence_vector   37   I     1.802574e+00
556 incidence_vector   37   R     7.178602e-01
557 incidence_vector   38   S     0.000000e+00
558 incidence_vector   38   E     3.172016e+00
559 incidence_vector   38   I     1.927617e+00
560 incidence_vector   38   R     7.829430e-01
561 incidence_vector   39   S     0.000000e+00
562 incidence_vector   39   E     3.271961e+00
563 incidence_vector   39   I     2.052057e+00
564 incidence_vector   39   R     8.516234e-01
565 incidence_vector   40   S     0.000000e+00
566 incidence_vector   40   E     3.349205e+00
567 incidence_vector   40   I     2.174047e+00
568 incidence_vector   40   R     9.236494e-01
569 incidence_vector   41   S     0.000000e+00
570 incidence_vector   41   E     3.400469e+00
571 incidence_vector   41   I     2.291563e+00
572 incidence_vector   41   R     9.986732e-01
573 incidence_vector   42   S     0.000000e+00
574 incidence_vector   42   E     3.423039e+00
575 incidence_vector   42   I     2.402453e+00
576 incidence_vector   42   R     1.076247e+00
577 incidence_vector   43   S     0.000000e+00
578 incidence_vector   43   E     3.414972e+00
579 incidence_vector   43   I     2.504512e+00
580 incidence_vector   43   R     1.155819e+00
581 incidence_vector   44   S     0.000000e+00
582 incidence_vector   44   E     3.375287e+00
583 incidence_vector   44   I     2.595558e+00
584 incidence_vector   44   R     1.236741e+00
585 incidence_vector   45   S     0.000000e+00
586 incidence_vector   45   E     3.304096e+00
587 incidence_vector   45   I     2.673531e+00
588 incidence_vector   45   R     1.318270e+00
589 incidence_vector   46   S     0.000000e+00
590 incidence_vector   46   E     3.202666e+00
591 incidence_vector   46   I     2.736587e+00
592 incidence_vector   46   R     1.399585e+00
593 incidence_vector   47   S     0.000000e+00
594 incidence_vector   47   E     3.073407e+00
595 incidence_vector   47   I     2.783195e+00
596 incidence_vector   47   R     1.479805e+00
597 incidence_vector   48   S     0.000000e+00
598 incidence_vector   48   E     2.919762e+00
599 incidence_vector   48   I     2.812216e+00
600 incidence_vector   48   R     1.558009e+00
601 incidence_vector   49   S     0.000000e+00
602 incidence_vector   49   E     2.746020e+00
603 incidence_vector   49   I     2.822971e+00
604 incidence_vector   49   R     1.633261e+00
605 incidence_vector   50   S     0.000000e+00
606 incidence_vector   50   E     2.557060e+00
607 incidence_vector   50   I     2.815276e+00
608 incidence_vector   50   R     1.704644e+00
609 incidence_vector   51   S     0.000000e+00
610 incidence_vector   51   E     2.358058e+00
611 incidence_vector   51   I     2.789454e+00
612 incidence_vector   51   R     1.771282e+00
613 incidence_vector   52   S     0.000000e+00
614 incidence_vector   52   E     2.154182e+00
615 incidence_vector   52   I     2.746315e+00
616 incidence_vector   52   R     1.832372e+00
617 incidence_vector   53   S     0.000000e+00
618 incidence_vector   53   E     1.950307e+00
619 incidence_vector   53   I     2.687101e+00
620 incidence_vector   53   R     1.887209e+00
621 incidence_vector   54   S     0.000000e+00
622 incidence_vector   54   E     1.750780e+00
623 incidence_vector   54   I     2.613422e+00
624 incidence_vector   54   R     1.935202e+00
625 incidence_vector   55   S     0.000000e+00
626 incidence_vector   55   E     1.559255e+00
627 incidence_vector   55   I     2.527158e+00
628 incidence_vector   55   R     1.975895e+00
629 incidence_vector   56   S     0.000000e+00
630 incidence_vector   56   E     1.378591e+00
631 incidence_vector   56   I     2.430368e+00
632 incidence_vector   56   R     2.008971e+00
633 incidence_vector   57   S     0.000000e+00
634 incidence_vector   57   E     1.210832e+00
635 incidence_vector   57   I     2.325190e+00
636 incidence_vector   57   R     2.034255e+00
637 incidence_vector   58   S     0.000000e+00
638 incidence_vector   58   E     1.057243e+00
639 incidence_vector   58   I     2.213754e+00
640 incidence_vector   58   R     2.051711e+00
641 incidence_vector   59   S     0.000000e+00
642 incidence_vector   59   E     9.183962e-01
643 incidence_vector   59   I     2.098103e+00
644 incidence_vector   59   R     2.061434e+00
645 incidence_vector   60   S     0.000000e+00
646 incidence_vector   60   E     7.942784e-01
647 incidence_vector   60   I     1.980132e+00
648 incidence_vector   60   R     2.063634e+00
649 incidence_vector   61   S     0.000000e+00
650 incidence_vector   61   E     6.844214e-01
651 incidence_vector   61   I     1.861547e+00
652 incidence_vector   61   R     2.058624e+00
653 incidence_vector   62   S     0.000000e+00
654 incidence_vector   62   E     5.880232e-01
655 incidence_vector   62   I     1.743834e+00
656 incidence_vector   62   R     2.046799e+00
657 incidence_vector   63   S     0.000000e+00
658 incidence_vector   63   E     5.040632e-01
659 incidence_vector   63   I     1.628253e+00
660 incidence_vector   63   R     2.028621e+00
661 incidence_vector   64   S     0.000000e+00
662 incidence_vector   64   E     4.313983e-01
663 incidence_vector   64   I     1.515834e+00
664 incidence_vector   64   R     2.004599e+00
665 incidence_vector   65   S     0.000000e+00
666 incidence_vector   65   E     3.688410e-01
667 incidence_vector   65   I     1.407391e+00
668 incidence_vector   65   R     1.975273e+00
669 incidence_vector   66   S     0.000000e+00
670 incidence_vector   66   E     3.152183e-01
671 incidence_vector   66   I     1.303536e+00
672 incidence_vector   66   R     1.941200e+00
673 incidence_vector   67   S     0.000000e+00
674 incidence_vector   67   E     2.694120e-01
675 incidence_vector   67   I     1.204704e+00
676 incidence_vector   67   R     1.902940e+00
677 incidence_vector   68   S     0.000000e+00
678 incidence_vector   68   E     2.303858e-01
679 incidence_vector   68   I     1.111175e+00
680 incidence_vector   68   R     1.861046e+00
681 incidence_vector   69   S     0.000000e+00
682 incidence_vector   69   E     1.971994e-01
683 incidence_vector   69   I     1.023096e+00
684 incidence_vector   69   R     1.816054e+00
685 incidence_vector   70   S     0.000000e+00
686 incidence_vector   70   E     1.690138e-01
687 incidence_vector   70   I     9.405062e-01
688 incidence_vector   70   R     1.768476e+00
689 incidence_vector   71   S     0.000000e+00
690 incidence_vector   71   E     1.450911e-01
691 incidence_vector   71   I     8.633570e-01
692 incidence_vector   71   R     1.718798e+00
693 incidence_vector   72   S     0.000000e+00
694 incidence_vector   72   E     1.247891e-01
695 incidence_vector   72   I     7.915304e-01
696 incidence_vector   72   R     1.667472e+00
697 incidence_vector   73   S     0.000000e+00
698 incidence_vector   73   E     1.075540e-01
699 incidence_vector   73   I     7.248562e-01
700 incidence_vector   73   R     1.614915e+00
701 incidence_vector   74   S     0.000000e+00
702 incidence_vector   74   E     9.291168e-02
703 incidence_vector   74   I     6.631260e-01
704 incidence_vector   74   R     1.561512e+00
705 incidence_vector   75   S     0.000000e+00
706 incidence_vector   75   E     8.045855e-02
707 incidence_vector   75   I     6.061046e-01
708 incidence_vector   75   R     1.507609e+00
709 incidence_vector   76   S     0.000000e+00
710 incidence_vector   76   E     6.985250e-02
711 incidence_vector   76   I     5.535400e-01
712 incidence_vector   76   R     1.453518e+00
713 incidence_vector   77   S     0.000000e+00
714 incidence_vector   77   E     6.080466e-02
715 incidence_vector   77   I     5.051712e-01
716 incidence_vector   77   R     1.399520e+00
717 incidence_vector   78   S     0.000000e+00
718 incidence_vector   78   E     5.307165e-02
719 incidence_vector   78   I     4.607346e-01
720 incidence_vector   78   R     1.345859e+00
721 incidence_vector   79   S     0.000000e+00
722 incidence_vector   79   E     4.644883e-02
723 incidence_vector   79   I     4.199683e-01
724 incidence_vector   79   R     1.292751e+00
725 incidence_vector   80   S     0.000000e+00
726 incidence_vector   80   E     4.076435e-02
727 incidence_vector   80   I     3.826163e-01
728 incidence_vector   80   R     1.240384e+00
729 incidence_vector   81   S     0.000000e+00
730 incidence_vector   81   E     3.587391e-02
731 incidence_vector   81   I     3.484311e-01
732 incidence_vector   81   R     1.188918e+00
733 incidence_vector   82   S     0.000000e+00
734 incidence_vector   82   E     3.165643e-02
735 incidence_vector   82   I     3.171754e-01
736 incidence_vector   82   R     1.138489e+00
737 incidence_vector   83   S     0.000000e+00
738 incidence_vector   83   E     2.801026e-02
739 incidence_vector   83   I     2.886235e-01
740 incidence_vector   83   R     1.089210e+00
741 incidence_vector   84   S     0.000000e+00
742 incidence_vector   84   E     2.485000e-02
743 incidence_vector   84   I     2.625622e-01
744 incidence_vector   84   R     1.041175e+00
745 incidence_vector   85   S     0.000000e+00
746 incidence_vector   85   E     2.210382e-02
747 incidence_vector   85   I     2.387910e-01
748 incidence_vector   85   R     9.944582e-01
749 incidence_vector   86   S     0.000000e+00
750 incidence_vector   86   E     1.971129e-02
751 incidence_vector   86   I     2.171223e-01
752 incidence_vector   86   R     9.491182e-01
753 incidence_vector   87   S     0.000000e+00
754 incidence_vector   87   E     1.762143e-02
755 incidence_vector   87   I     1.973812e-01
756 incidence_vector   87   R     9.051984e-01
757 incidence_vector   88   S     0.000000e+00
758 incidence_vector   88   E     1.579122e-02
759 incidence_vector   88   I     1.794052e-01
760 incidence_vector   88   R     8.627294e-01
761 incidence_vector   89   S     0.000000e+00
762 incidence_vector   89   E     1.418427e-02
763 incidence_vector   89   I     1.630438e-01
764 incidence_vector   89   R     8.217299e-01
765 incidence_vector   90   S     0.000000e+00
766 incidence_vector   90   E     1.276973e-02
767 incidence_vector   90   I     1.481578e-01
768 incidence_vector   90   R     7.822088e-01
769 incidence_vector   91   S     0.000000e+00
770 incidence_vector   91   E     1.152142e-02
771 incidence_vector   91   I     1.346190e-01
772 incidence_vector   91   R     7.441657e-01
773 incidence_vector   92   S     0.000000e+00
774 incidence_vector   92   E     1.041707e-02
775 incidence_vector   92   I     1.223093e-01
776 incidence_vector   92   R     7.075929e-01
777 incidence_vector   93   S     0.000000e+00
778 incidence_vector   93   E     9.437690e-03
779 incidence_vector   93   I     1.111200e-01
780 incidence_vector   93   R     6.724759e-01
781 incidence_vector   94   S     0.000000e+00
782 incidence_vector   94   E     8.567061e-03
783 incidence_vector   94   I     1.009518e-01
784 incidence_vector   94   R     6.387945e-01
785 incidence_vector   95   S     0.000000e+00
786 incidence_vector   95   E     7.791292e-03
787 incidence_vector   95   I     9.171334e-02
788 incidence_vector   95   R     6.065240e-01
789 incidence_vector   96   S     0.000000e+00
790 incidence_vector   96   E     7.098467e-03
791 incidence_vector   96   I     8.332113e-02
792 incidence_vector   96   R     5.756353e-01
793 incidence_vector   97   S     0.000000e+00
794 incidence_vector   97   E     6.478336e-03
795 incidence_vector   97   I     7.569887e-02
796 incidence_vector   97   R     5.460965e-01
797 incidence_vector   98   S     0.000000e+00
798 incidence_vector   98   E     5.922068e-03
799 incidence_vector   98   I     6.877681e-02
800 incidence_vector   98   R     5.178726e-01
801 incidence_vector   99   S     0.000000e+00
802 incidence_vector   99   E     5.422032e-03
803 incidence_vector   99   I     6.249134e-02
804 incidence_vector   99   R     4.909269e-01
805 incidence_vector  100   S     0.000000e+00
806 incidence_vector  100   E     4.971623e-03
807 incidence_vector  100   I     5.678441e-02
808 incidence_vector  100   R     4.652208e-01

Extensible – plug into stan/tmb

sir_tmb = tmb_fun(sir_macpan)
  • tmb is a model fitting package
  • stan is a Bayesian inference package
  • Better confidence intervals
  • Flexible inference
  • No need to make stan model

Extensible – plug into stan/tmb

sir_tmb = tmb_fun(sir_macpan)
sir_stan = tmbstan(sir_tmb, chains = 1)
  • tmb is a model fitting package
  • stan is a Bayesian inference package
  • Better confidence intervals
  • Flexible inference
  • No need to make stan model

Extensible – plug into stan/tmb

sir_tmb = tmb_fun(sir_macpan)
sir_stan = tmbstan(sir_tmb, chains = 1)
traceplot(sir_stan, ncol = 1)

  • tmb is a model fitting package
  • stan is a Bayesian inference package
  • Better confidence intervals
  • Flexible inference
  • No need to make stan model

Take-Home

  • Compartmental modelling R package
  • Free and open source
  • McMasterPandemic reboot
  • Blazing Fast
  • Team-produced

Take-Home

  • Team-produced

Contributions, Contributors, Community

  • Original developers were real modellers (Ben Bolker, Jonathan Dushoff, David Earn, Mike Li, Irena Papst)
  • Pipeline development for delivering PHAC, OMT, and PHO forecasts (Irena Papst, Mike Li)
  • Sharcnet C++ expertise (Weiguang Guan)
  • Current R development (Darren Flynn-Primrose)
  • Gather requirements from public health modellers and academics (Amy Hurford, Lisa Kanary, Caroline Colijn, Zahra Mohammadi, Claude Nadeau, Philippe Berthiaume)
  • Mathematical rigor (Jonathan Dushoff, Darren Flynn-Primrose)
  • Workshop this summer (Irena Papst)

Thank You