-
Notifications
You must be signed in to change notification settings - Fork 1
/
CAMP_10yr_pregnancy.Rmd
201 lines (140 loc) · 6.42 KB
/
CAMP_10yr_pregnancy.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
---
title: "record of work on 10-year pregnancy paper"
author: "Steven M. Goodreau"
date: "5/12/2020"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## May 12, 2020
- Copied over code from GC/CT, now working through from beginning of entire_project step by step.
- a10_import: removed race mixing (not needed), and initial diagnoses. Will need to replace the latter with initial pregnancies once we have them
- changed package name, set up NAMESPACE etc.
## May 28, 2020
Plan today: continue through code step by step, and in the process:
- Remove males
- Redo incidence to reflect detectable pregnancies
- Simplify calibration code dramatically
- Identify full set of questions to return to team with
Tasks completed:
- Changed all setwd references
- removed males from a10_process_inputs.R
- removed males from a10_make_behav_inputs_all_2007.R
- removed a10_process_dx_for_calib altogether
-- may need to create parallel file depending on age categories for pregnancy data -- it seems that these may come in single-year age categories, so then won't need this step but rather just be combined into age categories more simply
- rewrote a10_calib in numerous ways
- ran calib.pt1 to determine it gave no errors.
## June 18, 2020
Commited lots of old things (must get on top of this!)
Filed tickets
Looked at David's BC data files
## June 19, 2020
Wrote code to import BC data
Wrote code to process BC data
Got as far as multinomial regression for year 2007.
Need to clean up BC processing code so it's less ugly and repetitive.
## June 23, 2020
Had conversation with DASH, and they prefer the separate-regression-by-year approach. maria also expressed a desire for age as categorical.Goal today is to finish these.
Completed the regressions
Began wrangling the predicted values
## June 24, 2020
Finished wrangling the predicted values. Bean comparing agefac to agenum. Need to make a few plots and send to DASH.
## June 25, 2020
Carol's 80th!
plots to show to DASH:
```{r}
matplot(t(pred_bctype_agefac[[2]][,,c(11)]), type='b', ylab='prob. condom use',
xaxt='n', xlab="age", pch=c('B','H','W'), ylim=c(0,0.6),
main = "Condom use, 2017, age-as-categorical model")
axis(1,1:6, 13:18)
matplot(t(pred_bctype_agenum[[2]][,,c(11)]), type='b', ylab='prob. condom use',
xaxt='n', xlab="age", pch=c('B','H','W'), ylim=c(0,0.6),
main = "Condom use, 2017, age-as-numerical model")
axis(1,1:6, 13:18)
matplot(t(pred_bctype_agefac[[1]][,,c(11)]), type='b', ylab='prob. condom use',
xaxt='n', xlab="age", pch=c('B','H','W'), ylim=c(0,0.6),
main = "No method, 2017, age-as-categorical model")
axis(1,1:6, 13:18)
matplot(t(pred_bctype_agenum[[1]][,,c(11)]), type='b', ylab='prob. condom use',
xaxt='n', xlab="age", pch=c('B','H','W'), ylim=c(0,0.6),
main = "No method, 2017, age-as-numerical model")
axis(1,1:6, 13:18)
matplot(t(pred_bctype_agefac[[5]][,,c(11)]), type='b', ylab='prob. condom use',
xaxt='n', xlab="age", pch=c('B','H','W'), ylim=c(0,0.6),
main = "LARCs, 2017, age-as-categorical model")
axis(1,1:6, 13:18)
matplot(t(pred_bctype_agenum[[5]][,,c(11)]), type='b', ylab='prob. condom use',
xaxt='n', xlab="age", pch=c('B','H','W'), ylim=c(0,0.6),
main = "LARCs, 2017, age-as-numerical model")
axis(1,1:6, 13:18)
```
## June 26, 2020
finished the import processing
made a list of tasks - currently in my "to do" excel file, but needs to be transferred to github when my signal is strong and I have more time.
## June 30, 2020
Updated a10_make_behav_inputs_all_2007
## July 2, 2020
Started writing the code to move people around by method by year under each assumption. But then I hit wall and need to talk to David re Depo, etc.
## July 13, 2020
So much.
- Worked with David to split out pills.
- Learned the different methods in much greater depth.
- Rewrote code to transfer to new methods under assumptions, starting with min LARC.
- Wrote code to impute even years.
## July 20, 2020
- Redid the main function (a10_preg) to incorporate all of the BC types and failure rates, as well as to do the primary calculations on the total pop, not the school pop
### Sep 22, 2020
- Returning to Seattle from Dad's funeral
- I did a bunch of things in Aug that I didn't document and now I need to catch up on where I got
- I know that I redid the calibration code
_ I know that I came up with a plan to disaggregate the initial pregnancies by single year of age, using a logistic model, and ran it by CDC folks, and they agreed.
- Just now I integrated the new 1-yr pregnancy estimates into the workflow, and made them the inputs to the model. But there are 7 of them (ages 13-19) whereas in my test runs there were oly 6 (13-18) so I need to check on that.
### Sep 25
Removed 19-year olds as per email conversation
Tested, edited, re-tested the calibration_minLARC
### Sep 30
Big day with lots of advances.
Finalized the calibration (for minLARC) - works perfectly.
Developed the various scenarios for minLARC
Created preliminary plots of output to show DASH
### Oct 5
Checking on what's up with the bctypes before and after.
### Oct 6
Analyze by age
Analyze numbers and costs
### Nov 2
Forgot to keep a record for a while.
- Updated LARC failure rate
- revisiting decision to do agefac or age-age-squared, thinking maybe he latter
will be less stochastic
### Nov 6
Forgot to finish record last time argh
- agefac is still better
- decided I will not show age by year results; simply too stochastic
- started adding onlyLARC
- started adding in bootstrap for CIs, following convo with NMG
### Nov 11
- Did more coding of bootstrap CIs, all the way through up to analysis. Now waiting on data from David
### Leave at bottom
Todo:
- finalize only-LARC
- decide on credible intervals
### Master change list
# Inputs
part_prev_ratio_X -> nothing (AND NO LONGER CALIB PARAM)
beta_X2X -> prob_detpreg_f (NEW CALIB PARAM?)
diag_init_X -> preg_init_f (CALIB TARGET)
condom_use_X -> bc_use_f multidimensional?
p_ethn_X -> nothing
prop_diag_X -> nothing?
dur_inf_X -> nothing
# Outputs
n_dx_total_f -> n_preg_total CALIBRATION OUTPUT
# Places to add a new scenario
a10_reassign_bctypes.R
a10_impute_even_years.R
a10_make_behav_inputs_all_2007.R
add scenario-specific script
add scenario-specific calibration file
add scenario-specific run files