-
Notifications
You must be signed in to change notification settings - Fork 0
/
abm_hiv.R
42 lines (35 loc) · 950 Bytes
/
abm_hiv.R
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
library(gtools)
library(ensurer)
library(truncnorm)
library(assertthat)
library(rlang)
library(readxl)
library(tidyverse)
library(tictoc)
for (fl in list.files("./modules")) {
print(fl)
source(file.path(".", "modules", fl))
}
inputObj <- input_module(origin = "inputs_template.xlsx")
inputObj$testflag <- TRUE
inputObj$valflag <- FALSE
set.seed(inputObj$seed)
tic()
simObj <- initialization_module(inputObj)
toc()
simData <- data.frame(list())
for (i in 1:simObj$duration) {
tic()
print(i)
simObj <- increment_module(simObj)
simObj <- transmission_module(simObj)
simObj <- care_stage_module(simObj)
simObj <- health_state_module(simObj)
simObj <- outcomes_module(simObj)
simData <- bind_rows(simData, collapse_module(simObj))
toc()
}
simData <- inflate_module(simData, simObj$inflation)
simDataDisc <- discount_module(simData, simObj$discount)
simData <- list(notdisc = simData,
disc = simDataDisc)