forked from NathanLo3/Publication-codes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MDA_CEA_model_script2.m
206 lines (172 loc) · 7.07 KB
/
MDA_CEA_model_script2.m
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Script to run "MDA_CEA_model_CaseWestern.m"
% Written by Nathan Lo
%
% Last updated: 8/16/17
%
% Collaboration with Case Western
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1) MDA_strategy (scalar)
% (0)None
% (1)MDA (SAC)
% (2)MDA (SAC, pre-SAC)
% (3)MDA (Community)
% 2) Snail_strategy (scalar)
% (0)None
% (1)Molluscicides
% 3) MDA_coverage (g_MDA; 1x3 vector; fraction e.g., 75% is "0.75")
% Note: [pre-SAC, SAC, adults]
% 4) Snail_coverage (g_snail; scalar; fraction e.g., 75% is "0.75") )
% 5) MDA frequency (MDA_freq)
% (1)Annual
% (2)Biannual (2/year)
% 6) Molluscicides frequency (snail_freq)
% (1)Annual
% (2)Biannual (2/year)
% (12)Monthly
% 7) excel_decision
% (1) Which sheet (1, 2, 3...)
% (2) Base case (0), lower limit (-1), upper limit (1)
% 1. CWA
% 2. CWB
% 3. SBA
% 4. SBB
% 5. SCA
% 6. SCB
% 7. CWA+SCA
% 8. CWA+SCB
% 9. CWB+SCA
% 10. CWB+SCB
% 11. SBA+SCA
% 12. SBA+SCB
% 13. SBB+SCA
% 14. SBB+SCB
% Case Western data inputs (based on tested strategies)
MDA_strategy_input=[0, 3, 3, 1, 1, 0, 0, 3, 3, 3, 3, 1, 1, 1, 1];
snail_strategy_input=[0, 0, 0, 0, 0, 1, 1, 1, 1 ,1 ,1 ,1 ,1 ,1 ,1];
g_MDA_input=[0.75 0.75 0.75];
g_snail_input=1;
MDA_freq_input=[0, 1, 2, 1, 2, 0, 0, 1, 1, 2, 2, 1, 1, 2, 2];
snail_freq_input=[0, 0, 0, 0, 0, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2];
for j=1:3
which_analysis=[0 -1 1];
% 0- base, -1- lower bounds, 1- upper bounds
excel_decision(2)=which_analysis(j);
for i=1:length(MDA_strategy_input)
excel_decision(1)=i;
MDA_strategy= MDA_strategy_input(i);
snail_strategy= snail_strategy_input(i);
g_MDA= g_MDA_input;
g_snail= g_snail_input;
MDA_freq= MDA_freq_input(i);
snail_freq= snail_freq_input(i);
[total_DALY_sequelae_pre, total_DALY_sequelae_c, total_DALY_sequelae_a, ICER_values, total_DALYs_age, total_cost, total_DALY_iteration] = MDA_CEA_model_CaseWestern(MDA_strategy, snail_strategy, g_MDA, g_snail, MDA_freq, snail_freq, excel_decision);
if excel_decision(2)==0
sim_data_base(i,:)=[i-1, ICER_values];
elseif excel_decision(2)==-1
sim_data_lower(i,:)=[i-1, ICER_values];
elseif excel_decision(2)==1
sim_data_upper(i,:)=[i-1, ICER_values];
end
end
end
sim_data_combined=[sim_data_base sim_data_lower sim_data_upper];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Compute cost-effectiveness (ICER)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Columns
% 1- Strategy number
% 2- Cost (US$)
% 3- Disbility (DALYs)
CEA_data_sorted_base=sortrows(sim_data_base,-3);
CEA_data_sorted_base_temp=sortrows(sim_data_base,-3);
CEA_data_sorted_lower=sortrows(sim_data_lower,-3);
CEA_data_sorted_lower_temp=sortrows(sim_data_lower,-3);
CEA_data_sorted_upper=sortrows(sim_data_upper,-3);
CEA_data_sorted_upper_temp=sortrows(sim_data_upper,-3);
% Create Dominated (big D) vector
for i=1:length(CEA_data_sorted_base_temp)
dominant_vector_base(i)= sum(CEA_data_sorted_base_temp(i,2)>CEA_data_sorted_base_temp(i+1:length(CEA_data_sorted_base_temp),2));
dominant_vector_lower(i)= sum(CEA_data_sorted_lower_temp(i,2)>CEA_data_sorted_lower_temp(i+1:length(CEA_data_sorted_lower_temp),2));
dominant_vector_upper(i)= sum(CEA_data_sorted_upper_temp(i,2)>CEA_data_sorted_upper_temp(i+1:length(CEA_data_sorted_upper_temp),2));
end
% element 0 is non-dominated
% element>0 is Dominated
% ICER_dominated = zeros(1,length(CEA_data_sorted_base_temp(:,1)))+1;
% % Compute ICER, removing dominated comparisons
% for i=2:length(CEA_data_sorted_base_temp)
%
% vec = CEA_data_sorted_base_temp(i,2) < CEA_data_sorted_base_temp(1:(i-1),2);
%
% if sum(vec)>0
% ICER_dominated(find(vec==1))=0;
% end
%
% end
track_base=1;
track_lower=1;
track_upper=1;
for i=2:length(CEA_data_sorted_base_temp)
% Base
if dominant_vector_base(i)==0
while(track_base<i)
rel_iter=max(find(dominant_vector_base(1:i-1)==0));
rel_iter;
ICER_calc_base(i)= [CEA_data_sorted_base_temp(i,2)-CEA_data_sorted_base_temp(rel_iter,2)] / [CEA_data_sorted_base_temp(rel_iter,3) - CEA_data_sorted_base_temp(i,3)];
if sum(ICER_calc_base(i)<ICER_calc_base(1:i-1))>0
iter_change = max(find(ICER_calc_base(i)<ICER_calc_base(1:i-1)));
dominant_vector_base(iter_change)=1;
ICER_calc_base(iter_change)=0;
else
track_base= track_base+1;
end
end
else
track_base= track_base+1;
ICER_calc_base(i)=0;
end
% lower
if dominant_vector_lower(i)==0
while(track_lower<i)
rel_iter=max(find(dominant_vector_lower(1:i-1)==0));
rel_iter;
ICER_calc_lower(i)= [CEA_data_sorted_lower_temp(i,2)-CEA_data_sorted_lower_temp(rel_iter,2)] / [CEA_data_sorted_lower_temp(rel_iter,3) - CEA_data_sorted_lower_temp(i,3)];
if sum(ICER_calc_lower(i)<ICER_calc_lower(1:i-1))>0
iter_change = max(find(ICER_calc_lower(i)<ICER_calc_lower(1:i-1)));
dominant_vector_lower(iter_change)=1;
ICER_calc_lower(iter_change)=0;
else
track_lower= track_lower+1;
end
end
else
track_lower= track_lower+1;
ICER_calc_lower(i)=0;
end
% upper
if dominant_vector_upper(i)==0
while(track_upper<i)
rel_iter=max(find(dominant_vector_upper(1:i-1)==0));
rel_iter;
ICER_calc_upper(i)= [CEA_data_sorted_upper_temp(i,2)-CEA_data_sorted_upper_temp(rel_iter,2)] / [CEA_data_sorted_upper_temp(rel_iter,3) - CEA_data_sorted_upper_temp(i,3)];
if sum(ICER_calc_upper(i)<ICER_calc_upper(1:i-1))>0
iter_change = max(find(ICER_calc_upper(i)<ICER_calc_upper(1:i-1)));
dominant_vector_upper(iter_change)=1;
ICER_calc_upper(iter_change)=0;
else
track_upper= track_upper+1;
end
end
else
track_upper= track_upper+1;
ICER_calc_upper(i)=0;
end
end
CEA_data_final= [CEA_data_sorted_base ICER_calc_base' CEA_data_sorted_lower ICER_calc_lower' CEA_data_sorted_upper ICER_calc_upper']
%header_1= {'base case', 'base case', 'base case', 'base case', 'lower bounds', 'lower bounds', 'lower bounds', 'lower bounds', 'upper bounds', 'upper bounds', 'upper bounds', 'upper bounds'};
%header_2= {'Strategy', 'Total cost (US$)', 'Total disability (DALYs)', 'ICER (US$/DALY)', 'Strategy', 'Total cost (US$)', 'Total disability (DALYs)', 'ICER (US$/DALY)', 'Strategy', 'Total cost (US$)', 'Total disability (DALYs)', 'ICER (US$/DALY)'};
%A= [header_1; header_2];
B= CEA_data_final;
filename = 'Base_case_090217_lowprev.xls';
%filename = 'Scenario_090917_highprev_8.xls';
xlswrite(filename,B)