forked from ITHIM/ITHIM-R
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ithim_r_function_descriptions.Rmd
325 lines (222 loc) · 6.05 KB
/
ithim_r_function_descriptions.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
---
title: "ITHIM Functions (BETA)"
author: "Daniel Fuller"
date: '2018-10-22'
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## ITHIM R Functions
CAPITAL LETTERS: Background constant that is fixed
snake_case: all variable names and functions
### Common Abbreviations
- PA: Physical Activity
- AP: Air Pollution
- PM: Particulate Matter (PM2.5)
- GBD: Global Burden of Disease
- RR: Relative Risk
- DR: Dose Response
- PT: Public Transport
- mMET: marginal Metabolic Equivalent Task
- YLL: Years of Life Lost
### add_walk_time
Description
* A function to add walking time to bus trips assuming XYZ
Generic: TRUE or FALSE
Input
*
Output
*
### combine_health_and_pif
* A function to reorder HC? values and combine those values
Generic: TRUE or FALSE
Input
*
Output
*
### combined_rr_pa_ap
* A function to join and calculate disease burden for pa and ap?
Generic: TRUE or FALSE
Input
*
Output
*
### create_all_scenarios
* A function to create scenarios for ITHIM model. This functions requires manual input from the user with assumptions.
Generic: TRUE or FALSE
Input
* Mode shift assumptions (expressed as %) for at least one mode.
Output:
* Scenario data appended to an updated dataframe with Scenario column identifying each scenario.
### create_scenario
* A function to create a scenario for ITHIM model. This functions requires manual input from the user with assumptions.
Generic: TRUE or FALSE
Input
* Mode shift assumptions (expressed as %) for at least one mode.
Output:
* Scenario data appended to an updated dataframe with Scenario column identifying each scenario.
### dist_dur_tbls
* A function to create trip distance for the baseline and scenarios
Generic: TRUE or FALSE
Input
* Data frame from household travel survey data with baseline data and scenarios
Output
*
### distances_for_injury_function
* A function to calculate distances travelled by mode for each scenario using the baseline data
Generic: TRUE or FALSE
Input
* Data frame from household travel survey data with baseline data and scenarios
Output
* 1 new column with distances travelled by mode for each scenario
### gen_ap_rr
* A function to generate health risk ratios for air pollution combining the PA data from the function (total_mmet.R) and the PM2.5 concentration data (scenario_pm_calculations.R) at the individual level
Generic: TRUE or FALSE
Input
*
Output
*
### gen_pa_rr
* A function to generate health risk ratios for physical activity
Generic: TRUE or FALSE
Input
*
Output
*
### health_burden
* A function to create a reference scenario and to calculate the overall heath burden of the scenarios compared to the reference (!! I think)
Generic: TRUE or FALSE
Input
*
Output
*
### injuries_function
* _This is the script for distance-based injury model for Accra using safety-in-numbers_
Generic: FALSE
Input:
*
Output:
*
### ithim_load_data
* A function to load in the necessary data for running an ITHIM model
* There is also a simple function to calculate the ratio of YLL to deaths for each age and sex group. This should probably be pulled out.
* There is also a long comment about data structure in there that I think should be adopted.
Generic: TRUE or FALSE
Input
*
Output
*
### ithim_setup_baseline_scenario
* A function to create a baseline scenario? or setup the baseline data frame as it should be. Not sure. Baseline dataframe should come from user... ?
Generic: TRUE or FALSE
Input
*
Output
*
### ithim_setup_parameters
* A function to setup baseline parameters for the model. Parameters are assigned to the environment and so are set for every function. They are over-written when `sample_parameters` is called.
Defaults are
* MEAN_BUS_WALK_TIME= 5
* MMET_CYCLING = 4.63
* MMET_WALKING = 2.53
* PM_CONC_BASE = 50
* PM_TRANS_SHARE = 0.225
* PA_DOSE_RESPONSE_QUANTILE = F
* AP_DOSE_RESPONSE_QUANTILE = F
* BACKGROUND_PA_SCALAR = 1
* SAFETY_SCALAR = 1
* CHRONIC_DISEASE_SCALAR = 1
Generic: TRUE or FALSE
Input
*
Output
*
### ithim_uncertainty
* A function to with uncertainty, but sure what precisely it does.
Generic: TRUE or FALSE
Input
*
Output
*
### PA_dose_response
* A function to define the dose reponse for physical activity and all of the diseases of interest
* all-cause-mortality
* breast-cancer
* cardiovascular-disease
* colon-cancer
* coronary-heart-disease
* endometrial-cancer
* heart-failure
* lung-cancer
* stroke
* total-cancer
Generic: TRUE or FALSE
Input
*
Output
*
### PAF
* A function to hard code the indices to something??
Generic: TRUE or FALSE
Input
*
Output
*
### parrellel_evppi_for_AP
* A function that ???
Generic: TRUE or FALSE
Input
*
Output
*
### run_ithim
* A function that runs the ITHIM model. This function requires all of the data to be in the correct format and for the scenario functions to have been input by the user.
Generic: TRUE or FALSE
Input
*
Output
*
### run_ithim_setup
* A function that setups up the assumptions for ITHIM and creates the necessary objects. The fixed paramters the user can specify are as follows:
* NSAMPLES = 1
* modes = c("Bus", "Private Car", "Taxi", "Walking","Short Walking", "Bicycle", "Motorcycle")
* speeds = c(15, 21, 21, 4.8, 4.8, 14.5, 25)
* DIST_CAT = c("0-6 km", "7-9 km", "10+ km")
* AGE_CATEGORY = c("15-49", "50-69", "70+")
* MEAN_BUS_WALK_TIME= 5
* MMET_CYCLING = 4.63
* MMET_WALKING = 2.53
* PM_CONC_BASE = 50
* PM_TRANS_SHARE = 0.225
* PA_DOSE_RESPONSE_QUANTILE = F
* AP_DOSE_RESPONSE_QUANTILE = F
* BACKGROUND_PA_SCALAR = 1
* SAFETY_SCALAR = 1
* CHRONIC_DISEASE_SCALAR = 1
Generic: TRUE or FALSE
Input
*
Output
*
### scenario_pm_calculations
* A function that calculates the particular matter concentrations for trips and for each scenario
Generic: TRUE or FALSE
Input
*
Output
*
### set_scenario_specific_variable
* A function that???
Generic: TRUE or FALSE
Input
*
Output
*
### total_mmet
* A function that calculates the marginal MET values for transport related physical activity for the baseline and the scenarios
Generic: TRUE or FALSE
Input
*
Output
*