-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFigS9S17_sensitivity.m
292 lines (235 loc) · 8.32 KB
/
FigS9S17_sensitivity.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
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
% script to run sensitivity analysis to biological parameters, reproducing
% Figures S9-17 from the report
clear; close all
%Plotting preferences
set(0,'defaultlinelinewidth',2)
set(groot,'defaultAxesTickLabelInterpreter','latex')
set(0,'defaultTextInterpreter','latex')
set(0,'defaultaxesfontsize',16)
grayColor = [.6 .6 .6];
%%%%%%%%%%%%%%%% INPUT FOR WHICH FIGURE %%%%%%%%%%%%%%%%
% gamma: var_to_test = 1
% delta: var_to_test = 2
% rho: var_to_test = 3
% tau: var_to_test = 4
% omega: var_to_test = 5
% da: var_to_test = 6
% ha: var_to_test = 7
% R0: var_to_test = 8
var_to_test = 8; % which variable
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% load default parameters
if not(exist('mats/Thresholds.mat','file'))
disp('No strategy thresholds saved: Running Simulations.m')
Simulations
close all
end
%% MAIN SCRIPT
para0 = load('./mats/Parameters.mat');
% Define time to run model for
t_init = 30; % preliminary run
maxtime = 720; % main simulation
% Sensitivity parameter and selection
vars = {'\gamma','\delta','\rho','\tau','\omega','\hat{d}','\hat{h}','R_0'};
labs = {'gam','del','rho','tau','ome','da','ha','R0'};
% variable ranges to test
gammas = 0.1:0.02:0.5;
gammas(end+1) = para0.gamma;
rhos = 0.0:0.02:0.2;
rhos(end+1) = para0.rho;
deltas = 0.05:0.02:0.25;
deltas(end+1) = para0.delta;
taus = 0.1:0.03:0.4;
taus(end+1) = para0.tau;
omegas = 0.0005:0.00025:0.0030;
omegas(end+1) = para0.omega;
das = 0.5:0.1:1.5;
das(end+1) = 1;
has = 0.5:0.1:1.5;
has(end+1) = 1;
R0s = 2.0:0.2:4.0;
R0s(end+1) = para0.R0;
% select variable
if var_to_test == 1
var_arr = gammas;
elseif var_to_test == 2
var_arr = deltas;
elseif var_to_test == 3
var_arr = rhos;
elseif var_to_test == 4
var_arr = taus;
elseif var_to_test == 5
var_arr = omegas;
elseif var_to_test == 6
var_arr = das;
elseif var_to_test == 7
var_arr = has;
elseif var_to_test == 8
var_arr = R0s;
end
% define strategy numbers and switching thresholds
load('mats/Thresholds.mat');
strategies = 1:length(thresholds);
% store disease burden and stringency cost contributions
Burden = zeros(length(var_arr),length(strategies));
Stringency = zeros(length(var_arr),length(strategies));
% plotting preperation
figure('Position',[200 400 1000 1000])
stratnames = {'S1 (Cautious easing)', 'S2 (Suppression)', 'S3 (Slow control)', 'S4 (Rapid control)'};
stpos = [50 200 350 600; 50 200 350 500; 100 300 475 625; 175 325 475 625];
sgtitle(strcat('Sensitivity, varying $',vars(var_to_test),' \in [',num2str(min(var_arr)),',',num2str(max(var_arr)),']$'),'FontSize',20)
tic
for idx = 1:length(var_arr)
for strat = strategies
% change sensitivity parameter
if var_to_test == 1
para0.gamma = gammas(idx);
para0.zeta = gammas(idx);
elseif var_to_test == 2
para0.delta = deltas(idx);
elseif var_to_test == 3
para0.rho = rhos(idx);
elseif var_to_test == 4
para0.tau = taus(idx);
elseif var_to_test == 5
para0.omega = omegas(idx);
elseif var_to_test == 6
para0.da = das(idx).*[0.0275; 0.1350; 0.5374];
elseif var_to_test == 7
para0.ha = has(idx).*[0.1268; 0.1173; 0.2430];
elseif var_to_test == 8
para0.R0 = R0s(idx);
end
% adjust transmission to re-obtain R0 = 3 (or change if varying R0)
R0scale = Get_R0(para0);
para0.beta = (para0.R0/R0scale).*para0.beta;
% Preliminary run - no control, 30 day build-up
[Prelim, Prelim_ICs] = Get_ICs(para0);
% add control thresholds defined by strategy
para = para0;
para.maxtime = maxtime;
para.T10 = thresholds(strat,1);
para.T01 = thresholds(strat,2);
para.T21 = thresholds(strat,3);
para.T12 = thresholds(strat,4);
% starting control state
if sum(Prelim.IH(end,:)) < para.T12
para.init = 1;
else
para.init = 2;
end
% Run model
[Classes, burden, stringency, ~] = ODEmodel(para,Prelim_ICs);
% Post-Process for epidemic metrics
Burden(idx,strat) = round(sum(burden));
Stringency(idx,strat) = sum(stringency);
plotidx = 2*strat - 1; % index for subfigure
% plotting
subplot(4,2,plotidx)
yyaxis left
ax1 = gca;
ax1.YColor = 'k';
ax1.FontSize = 16;
ax1.FontSizeMode = 'manual';
if idx == length(var_arr)
plot(Classes.t, sum(Classes.IH,2), 'Color', 'r', 'Marker','none', 'LineWidth', 2.5, 'LineStyle','-')
hold on
else
plot(Classes.t, sum(Classes.IH,2), 'Color', grayColor, 'Marker','none', 'LineWidth', 0.5, 'LineStyle','-')
hold on
end
if plotidx > 6
xlabel('Time (days)')
end
if plotidx == 1
title('Active $I^H(t)$');
end
axis([0 maxtime 0 1250])
yyaxis right
ax2 = gca;
ax2.YColor = 'k';
ax2.TickDir = 'none';
ax2Y = ax2.YAxis(2,1);
ax2Y.FontSize = 14;
ax2.FontSizeMode = 'manual';
plot(Classes.t, para.T01.*ones(size(Classes.t)), 'k--', 'LineWidth',0.5)
hold on
plot(Classes.t, para.T12.*ones(size(Classes.t)), 'k--', 'LineWidth',0.5)
hold on
plot(Classes.t, para.T10.*ones(size(Classes.t)), 'k--', 'LineWidth',0.5)
hold on
plot(Classes.t, para.T21.*ones(size(Classes.t)), 'k--', 'LineWidth',0.5)
yticks(stpos(strat,:))
if para.T21 > para.T01
yticklabels({'$T_{10}$','$T_{01}$','$T_{21}$','$T_{12}$'})
else
yticklabels({'$T_{10}$','$T_{21}$','$T_{01}$','$T_{12}$'})
end
axis([0 maxtime 0 1250])
xticks(0:180:maxtime)
xtickangle(0)
grid on
plotidx = 2*strat; % index for subfigure
% plotting
subplot(4,2,plotidx)
if idx == length(var_arr)
plot(Classes.t, sum(Classes.Hosp,2)./1000, 'Color', 'r', 'Marker','none', 'LineWidth', 2.5, 'LineStyle','-')
hold on
else
plot(Classes.t, sum(Classes.Hosp,2)./1000, 'Color', grayColor, 'Marker','none', 'LineWidth', 0.5, 'LineStyle','-')
hold on
end
if plotidx > 6
xlabel('Time (days)')
end
if plotidx == 2
title('Cumulative $I^H(t)$ (thousands)');
end
axis([0 maxtime 0 30])
xticks(0:180:maxtime)
xtickangle(0)
grid on
end
end
toc
%save figure
if not(isfolder('./figs/sens_images'))
mkdir('./figs/sens_images')
end
saveas(gcf,strcat('./figs/sens_images/','sim-sensitivity_',char(labs(var_to_test)),'.png'))
%% variability in cost
% strategy markers
markers = {'o','^','s','d'};
cols = [0.9290 0.6940 0.1250; 0.3290, 0.6940, 0.1250; 0.4940 0.1840 0.5560; 0 0.5470 0.9410];
% normalise cost contributions
Burden = Burden./max(Burden,[],2);
Stringency = Stringency./max(Stringency,[],2);
f = figure(2);
f.Position = [600 600 800 400];
for strat = strategies
subplot(1,2,1)
plot(var_arr(1:end-1),Burden(1:end-1,strat),"Color",'k','Marker',markers{strat},'MarkerSize',8, ...
'MarkerFaceColor',cols(strat,:),'MarkerEdgeColor','k','LineWidth',1.5)
hold on
axis([min(var_arr)*0.9 max(var_arr)*1.1 0 1.1])
xlabel(strcat('$',vars(var_to_test),'$'))
ylabel('Normalised cost contribution')
title('Burden')
if strat == length(strategies)
xline(var_arr(end),'-','Model value','Color','r','Linewidth',2.5,'FontSize',16, ...
'Interpreter','latex','LabelOrientation','horizontal','LabelVerticalAlignment','bottom')
end
subplot(1,2,2)
plot(var_arr(1:end-1),Stringency(1:end-1,strat),"Color",'k','Marker',markers{strat},'MarkerSize',8, ...
'MarkerFaceColor',cols(strat,:),'MarkerEdgeColor','k','LineWidth',1.5)
hold on
axis([min(var_arr)*0.9 max(var_arr)*1.1 0 1.1])
xlabel(strcat('$',vars(var_to_test),'$'))
title('Stringency')
if strat == length(strategies)
xline(var_arr(end),'-','Model value','Color','r','Linewidth',2.5,'FontSize',16, ...
'Interpreter','latex','LabelOrientation','horizontal','LabelVerticalAlignment','bottom')
end
end
%save figure
saveas(gcf,strcat('./figs/sens_images/','cost-sensitivity_',char(labs(var_to_test)),'.png'))