-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathREADME.Rmd
145 lines (113 loc) · 5.83 KB
/
README.Rmd
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
144
145
---
output:
md_document:
df_print: kable
---
## Simulation-based Inference for Epidemiological Dynamics<br>Course Materials
These are notes from a short course given by [Ed Ionides](https://ionides.github.io/) and [Aaron King](https://kinglab.eeb.lsa.umich.edu/king/) at the [Summer Institute in Statistics and Modeling in Infectious Diseases (SISMID)](https://sismid.uw.edu).
From the [main page](https://kingaa.github.io/sbied/), links lead to pages on a number of specific topics, culminating in four case studies that exemplify the methods and raise key issues.
For each such page, there is a corresponding **R** script, which contains the codes needed to recapitulate the calculations.
This script is a starting point for students to follow, explore, and modify the analysis according to their own curiosity and interest.
----------------------------
### Required software
The codes require, at a minimum, [**R**](https://cran.r-project.org/) version 4.2 and [**pomp**](https://kingaa.github.io/pomp/) version 5.2.
Windows users must also have the appropriate version of [**Rtools**](https://cran.r-project.org/bin/windows/Rtools/) installed.
The `prep` directory contains scripts that will install other needed packages and test the user's installation.
The following **R** packages are needed to build the materials, but are not used *in* the materials:
- **revealjs**
- **diagram**
- **mapproj**
The `contacts` lesson requires [**panelPomp**](https://github.com/cbreto/panelPomp).
An installation script is provided there.
A [Github Action](https://github.com/kingaa/sbied/actions) checks that these installations and actions succeed on a variety of current and legacy platforms:
[![install-test](https://github.com/kingaa/sbied/actions/workflows/install-test.yml/badge.svg)](https://github.com/kingaa/sbied/actions/workflows/install-test.yml)
----------------------------
### Manifest
- index.md, index.html: Landing page
- acknowledge.md, acknowledge.html: Acknowledgements
- subdirectories:
- prep: Lesson 0, on preparing for the course
- intro: Lesson 1
- stochsim: Lesson 2
- pfilter: Lesson 3
- mif: Lesson 4
- measles: Lesson 5
- polio: Lesson 6
- ebola: Lesson 7
- contacts: Lesson 8
- od: Lesson from an earlier version of the course
- misc: Miscellaneous lessons
- _includes: latex, HTML, **R** files included in other files
- graphics: figures in various formats
- LICENSE.md: Full text of license
- TODO.md: To-do list
- Makefile, rules.mk: GNU Make files
- sbied.bib: Bibliography database
- jss.bst, jss.csl: Bibliography style files
- CLUSTER.R: example `CLUSTER.R` file for site-specific cluster setup
----------------------------
### Compilation
Full compilation of all the materials can be accomplished by running `make` in the root directory.
This requires substantial resources.
For this reason, the most expensive computations are archived using the facilities provided for the purpose in **pomp**.
Compilation with these archives in place requires much less time than does compilation from scratch.
The following gives an indication of the size of the archives and the time required for their computation on a linux cluster with 250 cpus.
```{r}
#| echo: false
#| message: false
library(tidyverse)
options(digits=3,knitr.kable.NA="")
gettime <- function (path) {
if (grepl(".rds",path)) {
readRDS(path) |> attr("system.time") |> getElement(3)
} else if (grepl(".rda",path)) {
e <- new.env()
load(path,envir=e)
e$.system.time[3]
} else {
NA_real_
}
}
list.files(pattern=r"{.+\.rd[as]$}",recursive=TRUE) |>
{\(x) data.frame(
path=x,
dir=dirname(x),
file=basename(x),
size=file.size(x)/2^10,
time=sapply(x,gettime)/60
)}() |>
remove_rownames() |>
as_tibble() -> dat
dat |>
rename(directory=dir) |>
group_by(directory) |>
summarize(size.kB=sum(size),time.min=sum(time)) |>
arrange(-time.min) -> datsum
datsum |>
mutate(
size.kB=round(size.kB,0),
time.min=round(time.min,1)
) |>
rename(`size (kB)`=size.kB,`time (min)`=time.min)
```
The archives amount to about `r round(sum(datsum$size.kB)/1024,0)` MB.
About `r datsum |> filter(grepl("polio",directory)) |> mutate(size.MB=size.kB/1024) |> pull(size.MB) |> sum() |> round(0)` MB of this is associated with the polio lesson, in which large amounts of redundant information are stored.
Full compilation, i.e., rebuilding the complete set of materials following deletion of all archives, requires about `r datsum |> pull(time.min) |> sum(15) |> round(0)` min on a 250-processor cluster.
Full compilation regenerates the complete set of archives.
A finishing compilation, i.e., rebuilding with all archives in place, but with the re-Making of all documents, requires about 12 min on a 64-cpu workstation.
----------------------------
### License
![CC-BY-NC](https://i.creativecommons.org/l/by-nc/4.0/88x31.png)
This work is licensed under the [Creative Commons
Attribution-NonCommercial 4.0 International License (CC BY-NC
4.0)](https://creativecommons.org/licenses/by-nc/4.0/). Under its terms,
you are free to:
- Share — copy and redistribute the material in any medium or format
- Adapt — remix, transform, and build upon the material
under the following terms:
- Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made.
You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- NonCommercial — You may not use the material for commercial purposes.
- No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
The licensor cannot revoke these freedoms as long as you follow the license terms.
----------------------------