/
an_summary.do
179 lines (124 loc) · 4.9 KB
/
an_summary.do
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
********************************************************************************
*
* Do-file: an_summary.do
*
* Project: SGTF-Omi
*
* Programmed by: Daniel Grint
*
* Data used: output/main.dta
*
* Data created:
*
* Other output: an_summary.log
*
*
********************************************************************************
*
* Purpose: This do-file summarises:
* X 1-the number of deaths by SGTF status for each covariate
* 2-plots the proportion of SGTF cases over time by NHS region
* X 3-plots the number of hospitalisations over time
* X 4-plots the number of ICU admissions over time
*
********************************************************************************
* Open a log file
cap log close
log using ./logs/an_summary, replace t
clear
use ./output/main.dta
/*
* Tabulate number of deaths by SGTF and covariates
foreach var of varlist agegroup agegroupA agegroup6 male imd eth5 eth2 smoke_nomiss smoke_nomiss2 ///
obese4cat hh_total_cat home_bin region rural_urban5 comorb_cat start_week {
noi disp "Table `var'"
table `var' sgtf, contents(count patient_id sum risk_28 mean risk_28 sum cox_death)
}
*/
* DROP IF NO DATA ON SGTF
noi di "DROPPING NO SGTF DATA"
drop if has_sgtf==0
* Tabulate number of AE admissions and deaths by SGTF and covariates
foreach var of varlist agegroup agegroupA agegroup6 male imd eth5 eth2 smoke_nomiss smoke_nomiss2 ///
obese4cat hh_total_cat home_bin region rural_urban5 comorb_cat start_week vax prev_inf {
noi disp "Table `var'"
table `var' sgtf, contents(count patient_id sum all_ae sum any_ae sum cox_ae sum died)
}
* Tabulate outcomes by vaccination/prior infection interaction
noi disp "Table of vaccination/prior infection interaction"
bysort sgtf: table vax prev_inf, contents(count patient_id sum any_ae sum cox_ae sum died)
* Tabulate AE destination by SGTF
noi disp "Table of AE destinations"
tab ae_dest sgtf, m
tab ae_admit sgtf, m
/*
* Tabulate number of ICU admissions by SGTF and covariates
foreach var of varlist agegroup agegroupA agegroup6 male imd eth5 eth2 smoke_nomiss smoke_nomiss2 ///
obese4cat hh_total_cat home_bin region rural_urban5 comorb_cat start_week {
noi disp "Table `var'"
table `var' sgtf, contents(count patient_id sum end_icu_test mean end_icu_test)
}
*/
* Plot SGTF proportion by NHS region
/*
clear
import delimited "C:\Users\EIDEDGRI\Documents\GitHub\SGTF-CFR-research\lookups\VOC_Data_England.csv"
gen week_date = date(week, "DMY")
format week_date %td
drop if week_date < date("16nov2020", "DMY")
gen start_week = 10 if week_date <= date("24jan2021", "DMY")
replace start_week = 9 if week_date <= date("17jan2021", "DMY")
replace start_week = 8 if week_date <= date("10jan2021", "DMY")
replace start_week = 7 if week_date <= date("03jan2021", "DMY")
replace start_week = 6 if week_date <= date("27dec2020", "DMY")
replace start_week = 5 if week_date <= date("20dec2020", "DMY")
replace start_week = 4 if week_date <= date("13dec2020", "DMY")
replace start_week = 3 if week_date <= date("06dec2020", "DMY")
replace start_week = 2 if week_date <= date("29nov2020", "DMY")
replace start_week = 1 if week_date <= date("22nov2020", "DMY")
rename percent_confirmedsgtf phe_sgtf
rename n_total phe_n
rename region region_s
gen region=0 if region_s=="East of England"
replace region=1 if region_s=="East Midlands"
replace region=2 if region_s=="London"
replace region=3 if region_s=="North East"
replace region=4 if region_s=="North West"
replace region=5 if region_s=="South East"
replace region=6 if region_s=="South West"
replace region=7 if region_s=="West Midlands"
replace region=8 if region_s=="Yorkshire and Humber"
keep region start_week week phe_sgtf phe_n
save "C:\Users\EIDEDGRI\Documents\GitHub\SGTF-CFR-research\lookups\VOC_Data_England.dta"
*/
* Drop if unknown SGTF
drop if !inrange(sgtf,0,1)
* Calculate % SGTF by week and region
collapse (mean) sgtf (count) patient_id, by(region start_week)
gen os_sgtf = sgtf*100
rename patient_id os_n
* Merge on PHE data
/*
merge 1:1 region start_week using "C:\Users\EIDEDGRI\Documents\GitHub\SGTF-CFR-research\lookups\VOC_Data_England.dta"
merge 1:1 region start_week using ./lookups/VOC_Data_England.dta
sort region start_week
gen week_date = date(week, "DMY")
format week_date %td
*/
*label define epi_week 1 "01Nov" 2 "07Nov" 3 "14Nov" 4 "21Nov" 5 "28Nov"
*label values start_week epi_week
/*
line os_sgtf start_week, ///
ytitle("% of positive tests with SGTF") ///
xlabel(40(2)50, valuelabel angle(45)) ///
yline($p_sgtf)
graph export ./output/sgtf_perc.svg, as(svg) replace
graph export ./output/sgtf_perc.pdf, as(pdf) replace
*/
drop if !inrange(start_week,48,52)
line os_sgtf start_week, by(region) ///
ytitle("% of positive tests with SGTF") ///
xlabel(48(1)52, valuelabel angle(45))
graph export ./output/sgtf_perc_region.svg, as(svg) replace
graph export ./output/sgtf_perc_region.pdf, as(pdf) replace
log close