-
Notifications
You must be signed in to change notification settings - Fork 0
/
ms.Rnw
143 lines (103 loc) · 5.47 KB
/
ms.Rnw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
%% \documentclass[12pt]{article}
\documentclass[10pt,letterpaper]{article} %% plos template
\input{preamble}
\title{McMasterPandemic: Lessons for Software Development from the COVID-19 Pandemic (TODO: working title)}
\author{Jonathan Dushoff$^1$ \and Benjamin M. Bolker$^2$ \and David J.\,D.\ Earn$^2$ \and Michael Li \and Irena Papst \and (TODO: others) \and Steve C Walker$^2$ (TODO: order is currently a placeholder) \\
$^1$Such-and-such University;\\
$^2$Department of Mathematics and Statistics,\\
McMaster University, Hamilton, Ontario, Canada, L8S 4K1
\\
\medskip
\spewmoddates
}
<<setup, echo=FALSE, include=FALSE>>=
## set default base-graphics plotting options
knitr::knit_hooks$set(basefig=function(before, options, envir) {
if (before) {
oldpar <- par(bty="l",las=1)
on.exit(par(oldpar))
} else { }
})
knitr::opts_chunk$set(error = FALSE)
## B&W format: https://stackoverflow.com/questions/22666475/how-to-achieve-blackwhite-friendly-syntax-highlighting-in-pdfs-produced-with-kn
##knitr::opts_knit$set( out.format="latex" )
##knitr::knit_theme$set("print")
## override BMB's finicky settings
options(warnPartialMatchArgs = FALSE,
warnPartialMatchAttr = FALSE,
warnPartialMatchDollar = FALSE)
@
\begin{document}
\maketitle
\linenumbers
\begin{abstract}
TBD
\end{abstract}
%%\begin{keywords}
%%epidemics, SIR model, \dots
%%\end{keywords}
%%\begin{MSCcodes}
%%34E05, 34E13, 37N25, 92D30
%%\end{MSCcodes}
\section{Introduction}\label{sec:intro}
The \texttt{McMasterPandemic} compartmental model and associated \texttt{R} package were developed to provide forecasts and insights to public health agencies throughout the COVID-19 pandemic. Much was learned about developing general purpose compartmental modelling software during this experience, but the pressure to deliver regular forecasts made it difficult to focus on the software itself. Here we describe the \texttt{macpan2} package -- a re-imagining of \texttt{McMasterPandemic}, building it from the ground up with architectural and technological decisions that address the many lessons that we learned from COVID-19 about software.
Impactful applied public health modelling requires many interdisciplinary steps along the path from epidemiological research teams to operational decision makers. Researchers must quickly tailor a model to an emerging public-health concern, validate and calibrate it to data, work with decision makers to define model outputs useful for stakeholders, configure models to generate those outputs, and package up those insights in an appropriate format for stakeholders. Unlike traditional modelling approaches, \texttt{macpan2} tackles this challenge from a software-engineering perspective, which allows us to systematically address bottlenecks along this path to impact in ways that will make future solutions easier to achieve. The goal is to enable researchers to focus on their core strengths and fill knowledge gaps efficiently and effectively.
Although \texttt{macpan2} is designed as a compartmental modelling tool that is agnostic about the underlying computational engine, it currently uses template model builder as the sole engine. Template model builder (TMB) is an R modelling package based on a C++ framework incorporating mature automatic differentiation and matrix algebra libraries.
\section{Methods}\label{sec:methods}
\subsection{Specifying Generic Difference Equations}
In order to meet extensibility requirement ...
Generic difference equations from lists of \texttt{R} formulas/expressions ...
\subsection{Automatic Differentiation for Calibrating Generic Difference Equations}
Leverage template model builder (TMB) for autodiff ...
Recursive evaluation in \texttt{C++} of \texttt{R} formulas/expressions ...
Modularity for easily adding new \texttt{C++} functions that can be used in \texttt{R} formulas ...
\subsection{Differential Equations, Process Error, and Difference Equations}
Requires explicit specification of state variables and flow rates using things
\section{Results}\label{sec:results}
The complete equation for everything is
\begin{linenomath*}
\begin{align}\label{eq:everything}
U = 0,
\end{align}
\end{linenomath*}
where $U$ is for ``universe''. This equation is illustrated
in \cref{fig:everything}. Remarkably, it does not depend on $\R_0$,
at least not explicitly. Even more remarkably, \cref{eq:everything}
was not mentioned in some mathematical epidemiology review articles
\cite{Earn+02,Earn04,Earn08,Earn09}.
<<example.calculation>>=
a <- sqrt(2*pi)
@
\begin{figure}
\begin{center}
\Huge EVERYTHING
%%\includegraphics[width=0.95\textwidth]{fig_everything.pdf}
<<example.figure, echo=FALSE, fig.height=3>>=
curve(sin(2*pi*x), lwd=3, las=1)
@
\end{center}
\caption{This figure illustrates \cref{eq:everything}.}
\label{fig:everything}
\end{figure}
Note that $\sqrt{2\pi}=\Sexpr{a}$ as calculated in the
\texttt{example.calculation} chunk above. You can supress
the chunk in the typeset document with the chunk option
\texttt{echo=FALSE}.
\section{Discussion}\label{sec:discussion}
Everything is explained by \cref{eq:everything,fig:everything}.
\section*{Acknowledgements}
DJDE was supported by an NSERC Discovery Grant.
\bibliography{ms}
\bibliographystyle{vancouver}
%%\input{mstables}
%%\FloatBarrier
%%\input{msfigures}
\appendix
\section{To Do}\label{app:ToDo}
\begin{itemize}
\item appendices
\item tables
\item Rnw
\item journal templates
\end{itemize}
\end{document}