-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathloadUp2.m
1779 lines (1604 loc) · 88.7 KB
/
loadUp2.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
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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% Load and save parameters, calibration data, indices, and matrices
function[stepsPerYear , timeStep , startYear , currYear , endYear , ...
years , disease , viral , hpvVaxStates , hpvNonVaxStates , endpoints , ...
intervens , gender , age , risk , hpvTypeGroups , dim , k , toInd , ...
annlz , ...
ageSexDebut , mInit , fInit , partnersM , partnersF , maleActs , ...
femaleActs , riskDist , fertility , fertility2 , fertility3 , fertility4 , ...
mue , mue2 , mue3 , mue4 , epsA_vec , epsR_vec , ...
yr , ...
hivOn , betaHIV_mod , muHIV , kCD4 , ...
hpvOn , beta_hpvVax_mod , beta_hpvNonVax_mod , fImm , rImmune , ...
kCin1_Inf , kCin2_Cin1 , kCin3_Cin2 , kCC_Cin3 , rNormal_Inf , kInf_Cin1 , ...
kCin1_Cin2 , kCin2_Cin3 , lambdaMultImm , hpv_hivClear , rImmuneHiv , ...
c3c2Mults , c2c1Mults , c2c3Mults , c1c2Mults , muCC , muCC_ud , muCC_d , kRL , kDR , artHpvMult , ...
hpv_hivMult , maleHpvClearMult , ...
condUse , screenYrs , hpvScreenStartYear , ...
artYr , maxRateM , maxRateF , ...
artYr_vec , artM_vec , artF_vec , minLim , maxLim , ...
circ_aVec , vmmcYr_vec , vmmc_vec , vmmcYr , vmmcRate , ...
hivStartYear , circStartYear , circNatStartYear , vaxStartYear , ...
baseline , who , spCyto , spHpvDna , spGentyp , spAve , spHpvAve , ...
circProtect , condProtect , MTCTRate , hyst , ...
OMEGA , ...
ccInc2012_dObs , ccInc2018_dObs , cc_dist_dObs , cin3_dist_dObs , ...
cin1_dist_dObs , hpv_dist_dObs , cinPos2002_dObs , cinNeg2002_dObs , ...
cinPos2015_dObs , cinNeg2015_dObs , hpv_hiv_dObs , hpv_hivNeg_dObs , ...
hpv_hivM2008_dObs , hpv_hivMNeg2008_dObs , hivPrevM_dObs , hivPrevF_dObs , ...
popAgeDist_dObs , totPopSize_dObs , ...
stageDist_1997_dObs , ...
hivCurr , ...
gar , hivSus , hpvVaxSus , hpvVaxImm , hpvNonVaxSus , hpvNonVaxImm , ...
toHiv , vaxInds , nonVInds , hpvVaxInf , hpvNonVaxInf , ...
hivInds , ...
cin3hpvVaxIndsFrom , ccLochpvVaxIndsTo , ccLochpvVaxIndsFrom , ...
ccReghpvVaxInds , ccDisthpvVaxInds , cin3hpvNonVaxIndsFrom , ...
ccLochpvNonVaxIndsTo , ccLochpvNonVaxIndsFrom , ccReghpvNonVaxInds , ...
ccDisthpvNonVaxInds , cin1hpvVaxInds , cin2hpvVaxInds , cin3hpvVaxInds , ...
cin1hpvNonVaxInds , cin2hpvNonVaxInds , cin3hpvNonVaxInds , normalhpvVaxInds , ...
immunehpvVaxInds , infhpvVaxInds , normalhpvNonVaxInds , immunehpvNonVaxInds , ...
infhpvNonVaxInds , fromVaxNoScrnInds , fromVaxScrnInds , toNonVaxNoScrnInds , ...
toNonVaxScrnInds , ageInd , riskInd , ...
kSymp , hystMult , ...
hivNegNonVMMCinds , hivNegVMMCinds , ...
vlAdvancer , ...
fertMat , hivFertPosBirth , hivFertNegBirth , fertMat2 , ...
hivFertPosBirth2 , hivFertNegBirth2 , fertMat3 , hivFertPosBirth3 , hivFertNegBirth3 , ...
fertMat4 , hivFertPosBirth4 , hivFertNegBirth4 , ...
dFertPos1 , dFertNeg1 , dFertMat1 , dFertPos2 , dFertNeg2 , dFertMat2 , ...
dFertPos3 , dFertNeg3 , dFertMat3 , deathMat , deathMat2 , deathMat3 , deathMat4 , ...
dDeathMat , dDeathMat2 , dDeathMat3 , dMue , ...
ccLochpvVaxIndsFrom_treat , ...
ccReghpvVaxInds_treat , ccDisthpvVaxInds_treat , vaxEff , waning] = loadUp2(fivYrAgeGrpsOn , calibBool , pIdx , paramsSub , paramSet , n , paramSetIdx)
tic
paramDir = [pwd , '/Params/'];
%% Set and save general parameters
% Time
stepsPerYear = 6; % default=6; set stepsPerYear=8 if including vaccination of boys
timeStep = 1 / stepsPerYear;
startYear = 1925;
currYear = 2024; % originally 2021
endYear = currYear;
years = endYear - startYear;
% Compartments
disease = 8;
viral = 6;
hpvVaxStates = 7;
hpvNonVaxStates = 7;
endpoints = 10; % CC TREATMENT EDIT
intervens = 4;
gender = 2;
age = 80 / max(1,fivYrAgeGrpsOn*5);
risk = 3;
hpvTypeGroups = 2;
dim = [disease , viral , hpvVaxStates , hpvNonVaxStates , endpoints , intervens , gender , age , risk];
% Index retrieval function
k = cumprod([disease , viral , hpvVaxStates , hpvNonVaxStates , endpoints , intervens , gender , age]);
toInd = @(x) (x(: , 9) - 1) * k(8) + (x(: , 8) - 1) * k(7) + (x(: , 7) - 1) * k(6) + ...
(x(: , 6) - 1) * k(5) + (x(: , 5) - 1) * k(4) + (x(: , 4) - 1) * k(3) + ...
(x(: , 3) - 1) * k(2) + (x(: , 2) - 1) * k(1) + x(: , 1);
annlz = @(x) sum(reshape(x , stepsPerYear , size(x , 1) / stepsPerYear));
%% Save demographic and behavioral parameters
% Import from Excel initial population size, male risk distribution,
% background mortality, fertility, partnerships, and acts per partnership
% file = [pwd , '/Config/Population_data.xlsx'];
% popInit = xlsread(file , 'Demographics' , 'D6:E21');
% riskDistM = xlsread(file , 'Demographics' , 'B54:D69');
% mue = zeros(age , gender);
% mue(: , 1) = xlsread(file , 'Demographics' , 'AX84:AX99'); %'B84:B99'); % 1950
% mue(: , 2) = xlsread(file , 'Demographics' , 'BE84:BE99'); %'O84:O99');
% mue2 = zeros(age , gender);
% mue2(: , 1) = xlsread(file , 'Demographics' , 'AY84:AY99'); %'I84:I99'); % 1985
% mue2(: , 2) = xlsread(file , 'Demographics' , 'BF84:BF99'); %'V84:V99');
% mue3 = zeros(age , gender);
% mue3(: , 1) = xlsread(file , 'Demographics' , 'AZ84:AZ99'); %'J84:J99'); % 2000
% mue3(: , 2) = xlsread(file , 'Demographics' , 'BG84:BG99'); %'W84:W99');
% mue4 = zeros(age , gender);
% mue4(: , 1) = xlsread(file , 'Demographics' , 'BB84:BB99'); %'L84:L99'); % 2020
% mue4(: , 2) = xlsread(file , 'Demographics' , 'BI84:BI99'); %'Y84:Y99');
% fertility = xlsread(file , 'Demographics' , 'B115:G130');
% partnersM = xlsread(file , 'Demographics' , 'B163:D178');
% partnersF = xlsread(file , 'Demographics' , 'E163:G178');
% maleActs = xlsread(file , 'Demographics' , 'B202:D217');
% femaleActs = xlsread(file , 'Demographics' , 'B222:D237');
% save(fullfile(paramDir ,'demoParamsFrmExcel'), 'popInit' , 'riskDistM' , ...
% 'mue' , 'mue2' , 'mue3' , 'mue4' , 'fertility' , 'partnersM' , 'partnersF' , 'maleActs' , 'femaleActs');
% Load pre-saved initial population size by age and gender, male risk distribution by age,
% background mortality by age and gender, and fertility by age and gender
load([paramDir , 'demoParamsFrmExcel'] , 'popInit' , 'riskDistM' , 'mue' , ...
'mue2' , 'mue3' , 'mue4' , 'fertility');
% Set female risk distribution
riskDistF = riskDistM;
% Calculate fertility2 and fertility3 matrices
if calibBool && any(36 == pIdx);
idx = find(36 == pIdx);
fertDeclineProp = paramSet(paramsSub{idx}.inds(:));
else
fertDeclineProp = [0.44 ; 0.76];
end
fertility2 = fertility .* fertDeclineProp(1,1);
fertility3 = fertility2 .* fertDeclineProp(2,1);
fertility4 = fertility3 .* 0.50;
% Male partners per year by age and risk group
if calibBool && any(1 == pIdx)
idx = find(1 == pIdx);
partnersM = zeros(age , risk);
%partnersMmult = paramSet(paramsSub{idx}.inds(:));
%rowL = paramsSub{idx}.length/3;
%rl = paramsSub{idx}.inds(1:rowL);
%rm = paramsSub{idx}.inds(rowL+1 : rowL*2);
%rh = paramsSub{idx}.inds(rowL*2+1 : rowL*3);
partnersM(1:2 , 1:risk) = ones(2 , risk) .* 0.00001;
%partnersM(3:10, 1:risk) = [paramSet(rl).*paramSet(rm).*paramSet(rh) , paramSet(rm).*paramSet(rh) , paramSet(rh)];
%partnersM(11:age , 1:risk) = ones(6,risk).*partnersM(10 , 1:risk);
%partnersM(3:age , 1:risk) = partnersM(3:age , 1:risk) .* partnersMmult;
%partnersM(10:age , 3) = ones(7 , 1);
partnersM(4:6 , 3) = paramSet(paramsSub{idx}.inds(1:3));
partnersM(3 , 3) = partnersM(4 , 3) .* 0.5;
partnersM(7:9 , 3) = ones(3,1).*paramSet(paramsSub{idx}.inds(4));
partnersM(10:age , 3) = ones(7,1).*paramSet(paramsSub{idx}.inds(5));
partnersM(3 , 2) = paramSet(paramsSub{idx}.inds(6))*partnersM(3 , 3);
partnersM(3 , 1) = paramSet(paramsSub{idx}.inds(7))*partnersM(3 , 2);
for a = 4 : age
partnersM(a , 1:2) = (partnersM(a , 3)/partnersM(a-1 , 3)) .* partnersM(a-1 , 1:2);
end
else
load([paramDir , 'demoParamsFrmExcel'] , 'partnersM');
end
% Female partners per year by age and risk group
if calibBool && any(2 == pIdx)
idx = find(2 == pIdx);
partnersF = zeros(age , risk);
%partnersFmult = paramSet(paramsSub{idx}.inds(:));
%rowL = paramsSub{idx}.length/3;
%rl = paramsSub{idx}.inds(1:rowL);
%rm = paramsSub{idx}.inds(rowL+1 : rowL*2);
%rh = paramsSub{idx}.inds(rowL*2+1 : rowL*3);
partnersF(1:2 , 1:risk) = ones(2 , risk) .* 0.00001;
%partnersF(3:10 , 1:risk) = [paramSet(rl).*paramSet(rm).*paramSet(rh) , paramSet(rm).*paramSet(rh) , paramSet(rh)];
%partnersF(11:age , 1:risk) = ones(6,risk).*partnersF(10 , 1:risk);
%partnersF(3:age , 1:risk) = partnersF(3:age , 1:risk) .* partnersFmult;
%partnersF(10:age , 3) = ones(7 , 1);
partnersF(4:6 , 3) = paramSet(paramsSub{idx}.inds(1:3));
partnersF(3 , 3) = partnersF(4 , 3) .* 0.5;
partnersF(7:9 , 3) = ones(3,1).*paramSet(paramsSub{idx}.inds(4));
partnersF(10:age , 3) = ones(7,1).*paramSet(paramsSub{idx}.inds(5));
partnersF(3 , 2) = paramSet(paramsSub{idx}.inds(6))*partnersF(3 , 3);
partnersF(3 , 1) = paramSet(paramsSub{idx}.inds(7))*partnersF(3 , 2);
for a = 4 : age
partnersF(a , 1:2) = (partnersF(a , 3)/partnersF(a-1 , 3)) .* partnersF(a-1 , 1:2);
end
else
load([paramDir , 'demoParamsFrmExcel'] , 'partnersF');
end
% Female acts per partnership per year by age and risk group
if calibBool && any(9 == pIdx)
idx = find(9 == pIdx);
femaleActs = zeros(age , risk);
%femaleActsmult = paramSet(paramsSub{idx}.inds(:));
%rowL = paramsSub{idx}.length/3;
%rl = paramsSub{idx}.inds(1:rowL);
%rm = paramsSub{idx}.inds(rowL+1 : rowL*2);
%rh = paramsSub{idx}.inds(rowL*2+1 : rowL*3);
femaleActs(1:2 , 1:risk) = zeros(2 , risk);
%femaleActs(3:age , 1:risk) = [paramSet(rl) , paramSet(rm).*paramSet(rl) , paramSet(rh).*paramSet(rm).*paramSet(rl)];
%femaleActs(3:age , 1:risk) = femaleActs(3:age , 1: risk) .* femaleActsmult;
femaleActs(4:6 , 1) = paramSet(paramsSub{idx}.inds(1:3));
femaleActs(3 , 1) = femaleActs(4 , 1) .* 0.5;
femaleActs(7:9 , 1) = ones(3,1).*paramSet(paramsSub{idx}.inds(4));
femaleActs(10:age , 1) = ones(7,1).*paramSet(paramsSub{idx}.inds(5));
femaleActs(3 , 2) = 0.6 .* femaleActs(3 , 1);
femaleActs(3 , 3) = 0.6 .* femaleActs(3 , 2);
for a = 4 : age
femaleActs(a , 2:3) = (femaleActs(a , 1)/femaleActs(a-1 , 1)) .* femaleActs(a-1 , 2:3);
end
else
load([paramDir , 'demoParamsFrmExcel'] , 'femaleActs');
end
% Male acts per partnership per year by age and risk group
if calibBool && any(8 == pIdx)
idx = find(8 == pIdx);
%maleActsmult = paramSet(paramsSub{idx}.inds(:));
%rowL = paramsSub{idx}.length/3;
%rl = paramsSub{idx}.inds(1:rowL);
%rm = paramsSub{idx}.inds(rowL+1 : rowL*2);
%rh = paramsSub{idx}.inds(rowL*2+1 : rowL*3);
%maleActs(1:2 , 1:risk) = zeros(2 , risk);
%maleActs(3:age , 1:risk) = [paramSet(rl) , paramSet(rm).*paramSet(rl) , paramSet(rh).*paramSet(rm).*paramSet(rl)];
%maleActs(3:age , 1:risk) = maleActs(3:age , 1:risk) .* maleActsmult;
maleActs = femaleActs;
maleActs(3:5 , 1:risk) = maleActs(3:5 , 1:risk) .* paramSet(paramsSub{idx}.inds(1));
maleActs(6:10 , 1:risk) = maleActs(6:10 , 1:risk) .* paramSet(paramsSub{idx}.inds(2));
else
%load([paramDir , 'demoParamsFrmExcel'] , 'maleActs');
maleActs(1:4 , 1:risk) = femaleActs(1:4 , 1:risk);
for a = 5 : age
maleActs(a , 1:risk) = femaleActs(a-1 , 1:risk);
end
end
% Convert 5-year age groups to 1-year age groups
if ~fivYrAgeGrpsOn
% Divide popInit age groups equally into five
popInit_orig = popInit;
[ageDim, valDim] = size(popInit_orig);
popInit = zeros(ageDim*5 , valDim);
for i = 1 : ageDim
popInit(((i-1)*5+1) : i*5 , :) = ones(5 , valDim) .* (popInit_orig(i , :)./5);
end
% Replicate rates across single age groups for other variables
vars5To1_nms = {'riskDistM' , 'riskDistF' , 'mue' , 'mue2' , 'mue3' , 'mue4' , ...
'fertility' , 'fertility2' , 'fertility3' , 'fertility4' , ...
'partnersM' , 'partnersF' , 'maleActs' , 'femaleActs'};
vars5To1_vals = {riskDistM , riskDistF , mue , mue2 , mue3 , mue4 , ...
fertility , fertility2 , fertility3 , fertility4 , ...
partnersM , partnersF , maleActs , femaleActs};
for j = 1 : length(vars5To1_vals)
valsA1 = age5To1(vars5To1_vals{j});
assignin('base', vars5To1_nms{j} , valsA1);
end
end
% Rename initial population size variables
mInit = popInit(: , 1); % initial male population size by age
fInit = popInit(: , 2); % initial female population size by age
% Rename risk distribution variable
riskDist = zeros(age , risk , 2);
riskDist(: , : , 1) = riskDistM;
riskDist(: , : , 2) = riskDistF;
ageSexDebut = (10/max(1 , fivYrAgeGrpsOn*5)+1);
% Mixing by age group
if calibBool && any(6 == pIdx);
idx = find(6 == pIdx);
%epsA = paramSet(paramsSub{idx}.inds(:));
epsA = ones(3,1).*paramSet(paramsSub{idx}.inds(:));
else
epsA = [0.4921 ; 0.4921 ; 0.4921];
end
% Mixing by risk group
if calibBool && any(7 == pIdx);
idx = find(7 == pIdx);
%epsR = paramSet(paramsSub{idx}.inds(:));
epsR = ones(3,1).*paramSet(paramsSub{idx}.inds(:));
else
epsR = [0.3 ; 0.3 ; 0.3];
end
yr = [1985; 1990; 2000];
epsA_vec = cell(size(yr , 1) - 1, 1); % save data over time interval in a cell array
epsR_vec = cell(size(yr , 1) - 1, 1);
for i = 1 : size(yr , 1) - 1 % interpolate epsA/epsR values at steps within period
period = [yr(i) , yr(i + 1)];
epsA_vec{i} = interp1(period , epsA(i : i + 1 , 1) , ...
yr(i) : timeStep : yr(i + 1));
epsR_vec{i} = interp1(period , epsR(i : i + 1 , 1) , ...
yr(i) : timeStep : yr(i + 1));
end
%% Save HIV natural history parameters
hivOn = 1; % bool to turn HIV on or off although model calibrated for HIV on
% Import from Excel HIV-associated death rate and CD4/VL transition rates
% file = [pwd , '/Config/HIV_parameters.xlsx'];
% muHIV = xlsread(file , 'Disease Data' , 'B20:G35');
% kCD4male = xlsread(file , 'Disease Data' , 'C45:F60');
% kCD4female = xlsread(file , 'Disease Data' , 'C62:F77');
% kVlmale = xlsread(file , 'Disease Data' , 'C84:F99');
% kVlfemale = xlsread(file , 'Disease Data' , 'C101:F116');
% save(fullfile(paramDir ,'hivNHParamsFrmExcel'), 'muHIV' , 'kCD4male' , ...
% 'kCD4female' , 'kVlmale' , 'kVlfemale');
% Load pre-saved HIV-associated death rate and CD4/VL transition matrices by age and gender
load([paramDir , 'hivNHParamsFrmExcel'] , 'muHIV' , 'kCD4male' , ...
'kCD4female' , 'kVlmale' , 'kVlfemale');
% Convert 5-year age groups to 1-year age groups
if ~fivYrAgeGrpsOn
% Replicate rates across single age groups for other variables
vars5To1_nms = {'muHIV' , 'kVlmale' , 'kVlfemale' , 'kCD4male' , 'kCD4female'};
vars5To1_vals = {muHIV , kVlmale , kVlfemale , kCD4male , kCD4female};
for j = 1 : length(vars5To1_vals)
valsA1 = age5To1(vars5To1_vals{j});
assignin('base', vars5To1_nms{j} , valsA1);
end
end
% HIV Vl state transition matrices
kVl = zeros(age , 4 , gender);
kVl(: , : , 1) = kVlmale;
kVl(: , : , 2) = kVlfemale;
% HIV CD4 state transition matrices
kCD4 = zeros(age , 4 , gender);
kCD4(: , : , 1) = kCD4male;
kCD4(: , : , 2) = kCD4female;
% Baseline HIV vaginal transmission rate
if calibBool && any(35 == pIdx);
idx = find(35 == pIdx);
baseVagTrans = paramSet(paramsSub{idx}.inds(:));
else
baseVagTrans = [0.000575];
end
% HIV tranmission rate
vagTransM = (baseVagTrans*1.0) * ones(risk , 1); % probability of transmission from male (insertive) to female (receptive) based on male's disease state; female acquisition
vagTransF = baseVagTrans * ones(risk , 1); % probability of transmission from female (receptive) to male (insertive) based on female's disease state; male acquisition
betaHIV_F2M = bsxfun(@times , [9.0 1.0 2.5 7.0 0.7 0.0; 9.0 1.0 2.5 7.0 0.7 0.0; 9.0 1.0 2.5 7.0 0.7 0.0] , vagTransF);
betaHIV_M2F = bsxfun(@times , [9.0 1.0 2.5 7.0 0.7 0.0; 9.0 1.0 2.5 7.0 0.7 0.0; 9.0 1.0 2.5 7.0 0.7 0.0] , vagTransM);
betaHIV_F2M_red = bsxfun(@times , [9.0*0.5 1.0*0.5 2.5*0.5 7.0*0.5 0.7 0.0; 9.0*0.5 1.0*0.5 2.5*0.5 7.0*0.5 0.7 0.0; 9.0*0.5 1.0*0.5 2.5*0.5 7.0*0.5 0.7 0.0] , vagTransF);
betaHIV_M2F_red = bsxfun(@times , [9.0*0.5 1.0*0.5 2.5*0.5 7.0*0.5 0.7 0.0; 9.0*0.5 1.0*0.5 2.5*0.5 7.0*0.5 0.7 0.0; 9.0*0.5 1.0*0.5 2.5*0.5 7.0*0.5 0.7 0.0] , vagTransM);
betaHIV = zeros(gender , age , risk , viral);
betaHIV_red = zeros(gender , age , risk , viral);
for a = 1 : age % calculate per-partnership probability of HIV transmission
% per-partnership beta: females to infect HIV-negative males,
% affected by betaHIV_F2M, probability of transmission from female (receptive) to male(insertive) based on female's disease state), and number of male acts
betaHIV(2 , a , : , :) = 1 - (bsxfun(@power, 1 - betaHIV_F2M , maleActs(a , :)'));
betaHIV_red(2 , a , : , :) = 1 - (bsxfun(@power, 1 - betaHIV_F2M_red , maleActs(a , :)'));
% per-partnership beta: males to infect HIV-negative females,
% affected by betaHIV_M2F, probability of transmission from male (insertive) to female (receptive) based on male's disease state), and number of female acts
betaHIV(1 , a , : , :) = 1 - (bsxfun(@power, 1 - betaHIV_M2F , femaleActs(a , :)'));
betaHIV_red(1 , a , : , :) = 1 - (bsxfun(@power, 1 - betaHIV_M2F_red , femaleActs(a , :)'));
end
betaHIV_mod = zeros(risk , age , viral , endpoints , gender);
for v = 1 : viral
for x = 1 : endpoints
for g = 1 : gender
for a = 1 : age
for r = 1 : risk
if (x > 1)
betaHIV_mod(r , a , v , x , g) = betaHIV_red(g , a , r , v);
else
betaHIV_mod(r , a , v , x , g) = betaHIV(g , a , r , v);
end
end
end
end
end
end
%% Import HPV/CIN/CC transition data from Excel
% file = [pwd , '/Config/HPV_parameters.xlsx'];
%
% ageTrends = xlsread(file , 'CIN transitions by type' , 'C38 : J40');
%
% kCin1_Inf_orig = zeros(1,2);
% kCin2_Cin1_orig = zeros(1,2);
% kCin3_Cin2_orig = zeros(1,2);
% kCC_Cin3_orig = zeros(1,2);
% rNormal_Inf_orig = zeros(1,2);
% kInf_Cin1_orig = zeros(1,2);
% kCin1_Cin2_orig = zeros(1,2);
% kCin2_Cin3_orig = zeros(1,2);
% % 9v HPV types
% kCin1_Inf_orig(1 , 1) = xlsread(file , 'CIN transitions by type' , 'C25'); % HPV to CIN1, ages 10-24
% kCin2_Cin1_orig(1 , 1) = xlsread(file , 'CIN transitions by type' , 'D25'); % CIN1 to CIN2
% kCin3_Cin2_orig(1, 1) = xlsread(file , 'CIN transitions by type', 'E25'); % CIN2 to CIN3
% kCC_Cin3_orig(1 , 1) = xlsread(file , 'CIN transitions by type' , 'F25'); % CIN3 to unlocalized
% rNormal_Inf_orig(1 , 1) = xlsread(file , 'CIN transitions by type' , 'G25'); % HPV to Well (natural immunity)
% kInf_Cin1_orig(1 , 1) = xlsread(file , 'CIN transitions by type' , 'H25'); % CIN1 to HPV
% kCin1_Cin2_orig(1 , 1) = xlsread(file , 'CIN transitions by type' , 'I25'); % CIN2 to CIN1
% kCin2_Cin3_orig(1 , 1) = xlsread(file , 'CIN transitions by type' , 'J25'); % CIN3 to CIN2
% % Non-9v HPV types
% kCin1_Inf_orig(1 , 2) = xlsread(file , 'CIN transitions by type' , 'M25'); % HPV to CIN1, ages 10-24
% kCin2_Cin1_orig(1 , 2) = xlsread(file , 'CIN transitions by type' , 'N25'); % CIN1 to CIN2
% kCin3_Cin2_orig(1 , 2) = xlsread(file , 'CIN transitions by type' , 'O25'); %CIN2 to CIN3
% kCC_Cin3_orig(1 , 2) = xlsread(file , 'CIN transitions by type' , 'P25'); % CIN3 to unlocalized
% rNormal_Inf_orig(1 , 2) = xlsread(file , 'CIN transitions by type' , 'Q25'); % HPV to Well (natural immunity)
% kInf_Cin1_orig(1 , 2) = xlsread(file , 'CIN transitions by type' , 'R25'); % CIN1 to HPV
% kCin1_Cin2_orig(1 , 2) = xlsread(file , 'CIN transitions by type' , 'S25'); % CIN2 to CIN1
% kCin2_Cin3_orig(1 , 2) = xlsread(file , 'CIN transitions by type' , 'T25'); % CIN3 to CIN2
%% Set HPV/CIN/CC transitions by age group based on pre-saved or calibrated values
% Set transitions in first age group from pre-saved or calibrated values
load([paramDir , 'hpvCinCCTransFrmExcel'] , 'kCin1_Inf_orig' , 'kCin2_Cin1_orig' , ...
'kCin3_Cin2_orig' , 'kCC_Cin3_orig' , 'rNormal_Inf_orig' , 'kInf_Cin1_orig' , ...
'kCin1_Cin2_orig' , 'kCin2_Cin3_orig' , 'ageTrends');
kCin1_Inf = zeros(16,2);
kCin2_Cin1 = zeros(16,2);
kCin3_Cin2 = zeros(16,2);
kCC_Cin3 = zeros(16,2);
rNormal_Inf = zeros(16,2);
kInf_Cin1 = zeros(16,2);
kCin1_Cin2 = zeros(16,2);
kCin2_Cin3 = zeros(16,2);
% HPV to CIN1, ages 10-29
if calibBool && any(27 == pIdx)
idx = find(27 == pIdx);
kCin1_InfMult = paramSet(paramsSub{idx}.inds(:));
kCin1_Inf(1 : 6 , 1) = kCin1_Inf_orig(1 , 1) * kCin1_InfMult(1);
kCin1_Inf(1 : 6 , 2) = kCin1_Inf_orig(1 , 2) * kCin1_InfMult(2);
else
kCin1_Inf(1 : 6 , 1) = kCin1_Inf_orig(1 , 1) * 0.8;
kCin1_Inf(1 : 6 , 2) = kCin1_Inf_orig(1 , 2) * 2.0;
end
% CIN1 to CIN2, ages 10-29
if calibBool && any(28 == pIdx)
idx = find(28 == pIdx);
kCin2_Cin1Mult = paramSet(paramsSub{idx}.inds(:));
kCin2_Cin1(1 : 6 , 1) = kCin2_Cin1_orig(1 , 1) * kCin2_Cin1Mult(1);
kCin2_Cin1(1 : 6 , 2) = kCin2_Cin1_orig(1 , 2) * kCin2_Cin1Mult(2);
else
kCin2_Cin1(1 : 6 , 1) = kCin2_Cin1_orig(1 , 1) * 1.4;
kCin2_Cin1(1 : 6 , 2) = kCin2_Cin1_orig(1 , 2) * 2.0;
end
% CIN2 to CIN3, ages 10-29
if calibBool && any(29 == pIdx)
idx = find(29 == pIdx);
kCin3_Cin2Mult = paramSet(paramsSub{idx}.inds(:));
kCin3_Cin2(1 : 6 , 1) = kCin3_Cin2_orig(1 , 1) * kCin3_Cin2Mult(1);
kCin3_Cin2(1 : 6 , 2) = kCin3_Cin2_orig(1 , 2) * kCin3_Cin2Mult(2);
else
kCin3_Cin2(1 : 6 , 1) = kCin3_Cin2_orig(1 , 1) * 1.3;
kCin3_Cin2(1 : 6 , 2) = kCin3_Cin2_orig(1 , 2) * 2.0;
end
% CIN3 to unlocalized cancer, ages 10-29
if calibBool && any(30 == pIdx)
idx = find(30 == pIdx);
kCC_Cin3Mult = paramSet(paramsSub{idx}.inds(:));
kCC_Cin3(1 : 6 , 1) = kCC_Cin3_orig(1 , 1) * kCC_Cin3Mult(1) * 2.0;
kCC_Cin3(1 : 6 , 2) = kCC_Cin3_orig(1 , 2) * kCC_Cin3Mult(2) * 2.0;
else
kCC_Cin3(1 : 6 , 1) = kCC_Cin3_orig(1 , 1) * 1.0;
kCC_Cin3(1 : 6 , 2) = kCC_Cin3_orig(1 , 2) * 5.0;
end
% HPV to Well (or natural immunity), ages 10-29
if calibBool && any(31 == pIdx)
idx = find(31 == pIdx);
rNormal_InfMult = paramSet(paramsSub{idx}.inds(:));
rNormal_Inf(1 : 6 , 1) = rNormal_Inf_orig(1 , 1) * rNormal_InfMult(1);
rNormal_Inf(1 : 6 , 2) = rNormal_Inf_orig(1 , 2) * rNormal_InfMult(2);
else
rNormal_Inf(1 : 6 , 1) = rNormal_Inf_orig(1 , 1) * 2.60;
rNormal_Inf(1 : 6 , 2) = rNormal_Inf_orig(1 , 2) * 1.41;
end
% CIN1 to HPV, ages 10-29
if calibBool && any(32 == pIdx)
idx = find(32 == pIdx);
kInf_Cin1Mult = paramSet(paramsSub{idx}.inds(:));
kInf_Cin1(1 : 6 , 1) = kInf_Cin1_orig(1 , 1) * kInf_Cin1Mult(1);
kInf_Cin1(1 : 6 , 2) = kInf_Cin1_orig(1 , 2) * kInf_Cin1Mult(2);
else
kInf_Cin1(1 : 6 , 1) = kInf_Cin1_orig(1 , 1) * 1.80;
kInf_Cin1(1 : 6 , 2) = kInf_Cin1_orig(1 , 2) * 0.97;
end
% CIN2 to CIN1, ages 10-29
if calibBool && any(33 == pIdx)
idx = find(33 == pIdx);
kCin1_Cin2Mult = paramSet(paramsSub{idx}.inds(:));
kCin1_Cin2(1 : 6 , 1) = kCin1_Cin2_orig(1 , 1) * kCin1_Cin2Mult(1);
kCin1_Cin2(1 : 6 , 2) = kCin1_Cin2_orig(1 , 2) * kCin1_Cin2Mult(2);
else
kCin1_Cin2(1 : 6 , 1) = kCin1_Cin2_orig(1 , 1) * 1.4;
kCin1_Cin2(1 : 6 , 2) = kCin1_Cin2_orig(1 , 2) * 0.2;
end
% CIN3 to CIN2, ages 10-29
if calibBool && any(34 == pIdx)
idx = find(34 == pIdx);
kCin2_Cin3Mult = paramSet(paramsSub{idx}.inds(:));
kCin2_Cin3(1 : 6 , 1) = kCin2_Cin3_orig(1 , 1) * kCin2_Cin3Mult(1);
kCin2_Cin3(1 : 6 , 2) = kCin2_Cin3_orig(1 , 2) * kCin2_Cin3Mult(2);
else
kCin2_Cin3(1 : 6 , 1) = kCin2_Cin3_orig(1 , 1) * 1.0;
kCin2_Cin3(1 : 6 , 2) = kCin2_Cin3_orig(1 , 2) * 0.2;
end
% Apply age trends to 9v HPV transitions
kCin1_Inf(7 : 10 , 1) = kCin1_Inf(1 , 1) * linspace((1.05-1)*0.25+1.0 , 1.05 , 4); %ageTrends(1,1); % ages 30-49
kCin2_Cin1(7 : 10 , 1) = kCin2_Cin1(1 , 1) * linspace((ageTrends(1,2)-1)*0.25+1.0 , ageTrends(1,2) , 4);
kCin3_Cin2(7 : 10 , 1) = kCin3_Cin2(1, 1) * linspace((1.6-1)*0.25+1.0 , 1.6 , 4); %ageTrends(1,3);
kCC_Cin3(7 : 10 , 1) = kCC_Cin3(1 , 1) * linspace((2.5-1.0)*0.25+1.0 , 2.5 , 4); %ageTrends(1,4);
rNormal_Inf(7 : 10 , 1) = rNormal_Inf(1 , 1) * linspace((1.0-1.0)*0.75+1.0 , 1.0 , 4); %ageTrends(1,5);
kInf_Cin1(7 : 10 , 1) = kInf_Cin1(1 , 1) * linspace((1.0-ageTrends(1,6))*0.75+ageTrends(1,6) , ageTrends(1,6) , 4);
kCin1_Cin2(7 : 10 , 1) = kCin1_Cin2(1 , 1) * linspace((1.0-ageTrends(1,7))*0.75+ageTrends(1,7) , ageTrends(1,7) , 4);
kCin2_Cin3(7 : 10 , 1) = kCin2_Cin3(1 , 1) * linspace((1.0-0.8)*0.75+0.8 , 0.8 , 4); %ageTrends(1,8);
kCin1_Inf(11 : 16 , 1) = kCin1_Inf(1 , 1) * linspace(1.05+((1.10-1.05)/6) , 1.10 , 6); %ageTrends(2,1); % ages 50-69
kCin2_Cin1(11 : 16 , 1) = kCin2_Cin1(1 , 1) * linspace(ageTrends(1,2)+((ageTrends(2,2)-ageTrends(1,2))/6) , ageTrends(2,2) , 6);
kCin3_Cin2(11 : 16 , 1) = kCin3_Cin2(1 , 1) * linspace(1.6+((2.0-1.6)/6) , 2.0 , 6); %ageTrends(2,3);
kCC_Cin3(11 : 16 , 1) = kCC_Cin3(1 , 1) * linspace(2.5+((9.0-2.5)/6) , 9.0 , 6); %ageTrends(2,4);
rNormal_Inf(11 : 16 , 1) = rNormal_Inf(1 , 1) * linspace((1.0-ageTrends(2,5))*(5/6)+ageTrends(2,5) , ageTrends(2,5) , 6);
kInf_Cin1(11 : 16 , 1) = kInf_Cin1(1 , 1) * linspace((ageTrends(1,6)-ageTrends(2,6))*(5/6)+ageTrends(2,6) , ageTrends(2,6) , 6);
kCin1_Cin2(11 : 16 , 1) = kCin1_Cin2(1 , 1) * linspace((ageTrends(1,7)-ageTrends(2,7))*(5/6)+ageTrends(2,7) , ageTrends(2,7) , 6);
kCin2_Cin3(11 : 16 , 1) = kCin2_Cin3(1 , 1) * linspace((0.8-0.6)*(5/6)+0.6 , 0.6 , 6); %ageTrends(2,8);
%kCin1_Inf(15 : 16 , 1) = kCin1_Inf(1 , 1) * 1.15; %ageTrends(3,1); % ages 70-79
%kCin2_Cin1(15 : 16 , 1) = kCin2_Cin1(1 , 1) * ageTrends(3,2);
%kCin3_Cin2(15 : 16 , 1) = kCin3_Cin2(1 , 1) * ageTrends(3,3);
%kCC_Cin3(15 : 16 , 1) = kCC_Cin3(1 , 1) * 4.0; %ageTrends(3,4);
%rNormal_Inf(15 : 16 , 1) = rNormal_Inf(1 , 1) * ageTrends(3,5);
%kInf_Cin1(15 : 16 , 1) = kInf_Cin1(1 , 1) * ageTrends(3,6);
%kCin1_Cin2(15 : 16 , 1) = kCin1_Cin2(1 , 1) * ageTrends(3,7);
%kCin2_Cin3(15 : 16 , 1) = kCin2_Cin3(1 , 1) * ageTrends(3,8);
% Apply age trends to non-9v HPV transitions
kCin1_Inf(7 : 10 , 2) = kCin1_Inf(1 , 2) * linspace((1.05-1)*0.25+1.0 , 1.05 , 4); %ageTrends(1,1); % ages 30-49
kCin2_Cin1(7 : 10 , 2) = kCin2_Cin1(1 , 2) * linspace((ageTrends(1,2)-1)*0.25+1.0 , ageTrends(1,2) , 4);
kCin3_Cin2(7 : 10 , 2) = kCin3_Cin2(1, 2) * linspace((1.6-1)*0.25+1.0 , 1.6 , 4); %ageTrends(1,3);
kCC_Cin3(7 : 10 , 2) = kCC_Cin3(1 , 2) * linspace((2.5-1.0)*0.25+1.0 , 2.5 , 4); %ageTrends(1,4);
rNormal_Inf(7 : 10 , 2) = rNormal_Inf(1 , 2) * linspace((1.0-1.0)*0.75+1.0 , 1.0 , 4); %ageTrends(1,5);
kInf_Cin1(7 : 10 , 2) = kInf_Cin1(1 , 2) * linspace((1.0-ageTrends(1,6))*0.75+ageTrends(1,6) , ageTrends(1,6) , 4);
kCin1_Cin2(7 : 10 , 2) = kCin1_Cin2(1 , 2) * linspace((1.0-ageTrends(1,7))*0.75+ageTrends(1,7) , ageTrends(1,7) , 4);
kCin2_Cin3(7 : 10 , 2) = kCin2_Cin3(1 , 2) * linspace((1.0-0.8)*0.75+0.8 , 0.8 , 4); %ageTrends(1,8);
kCin1_Inf(11 : 16 , 2) = kCin1_Inf(1 , 2) * linspace(1.05+((1.10-1.05)/6) , 1.10 , 6); %ageTrends(2,1); % ages 50-69
kCin2_Cin1(11 : 16 , 2) = kCin2_Cin1(1 , 2) * linspace(ageTrends(1,2)+((ageTrends(2,2)-ageTrends(1,2))/6) , ageTrends(2,2) , 6);
kCin3_Cin2(11 : 16 , 2) = kCin3_Cin2(1 , 2) * linspace(1.6+((2.0-1.6)/6) , 2.0 , 6); %ageTrends(2,3);
kCC_Cin3(11 : 16 , 2) = kCC_Cin3(1 , 2) * linspace(2.5+((9.0-2.5)/6) , 9.0 , 6); %ageTrends(2,4);
rNormal_Inf(11 : 16 , 2) = rNormal_Inf(1 , 2) * linspace((1.0-ageTrends(2,5))*(5/6)+ageTrends(2,5) , ageTrends(2,5) , 6);
kInf_Cin1(11 : 16 , 2) = kInf_Cin1(1 , 2) * linspace((ageTrends(1,6)-ageTrends(2,6))*(5/6)+ageTrends(2,6) , ageTrends(2,6) , 6);
kCin1_Cin2(11 : 16 , 2) = kCin1_Cin2(1 , 2) * linspace((ageTrends(1,7)-ageTrends(2,7))*(5/6)+ageTrends(2,7) , ageTrends(2,7) , 6);
kCin2_Cin3(11 : 16 , 2) = kCin2_Cin3(1 , 2) * linspace((0.8-0.6)*(5/6)+0.6 , 0.6 , 6); %ageTrends(2,8);
%kCin1_Inf(15 : 16 , 2) = kCin1_Inf(1 , 2) * 1.15; %ageTrends(3,1); % ages 70-79
%kCin2_Cin1(15 : 16 , 2) = kCin2_Cin1(1 , 2) * ageTrends(3,2);
%kCin3_Cin2(15 : 16 , 2) = kCin3_Cin2(1 , 2) * ageTrends(3,3);
%kCC_Cin3(15 : 16 , 2) = kCC_Cin3(1 , 2) * 4.0; %ageTrends(3,4);
%rNormal_Inf(15 : 16 , 2) = rNormal_Inf(1 , 2) * ageTrends(3,5);
%kInf_Cin1(15 : 16 , 2) = kInf_Cin1(1 , 2) * ageTrends(3,6);
%kCin1_Cin2(15 : 16 , 2) = kCin1_Cin2(1 , 2) * ageTrends(3,7);
%kCin2_Cin3(15 : 16 , 2) = kCin2_Cin3(1 , 2) * ageTrends(3,8);
% % if calibBool && any(25 == pIdx) % CJB note: old code
% % idx = find(25 == pIdx);
% % kProgrsMult = paramSet(paramsSub{idx}.inds(:));
% % else
% % kProgrsMult = 1.0;
% % end
% %
% % if calibBool && any(26 == pIdx)
% % idx = find(26 == pIdx);
% % kRegrsMult = paramSet(paramsSub{idx}.inds(:));
% % else
% % kRegrsMult = 1.0;
% % end
% % kCin1_Inf = [kCin1_Inf , kCin1_Inf .* kProgrsMult];
% % kCin2_Cin1 = [kCin2_Cin1 , kCin2_Cin1 .* kProgrsMult];
% % kCin3_Cin2 = [kCin3_Cin2 , kCin3_Cin2 .* kProgrsMult];
% % kCC_Cin3 = [kCC_Cin3 , kCC_Cin3 .* kProgrsMult];
% % rNormal_Inf = [rNormal_Inf , rNormal_Inf .* kRegrsMult];
% % kInf_Cin1 = [kInf_Cin1 , kInf_Cin1 .* kRegrsMult];
% % kCin1_Cin2 = [kCin1_Cin2 , kCin1_Cin2 .* kRegrsMult];
% % kCin2_Cin3 = [kCin2_Cin3 , kCin2_Cin3 .* kRegrsMult];
%% Save HPV natural history parameters
hpvOn = 1; % bool to turn HPV on or off although model not set up for HPV to be off
% Import from Excel CC-associated death rate
% file = [pwd , '/Config/HPV_parameters.xlsx'];
% muCC = xlsread(file , 'Cervical Cancer' , 'B6:D11');
% save(fullfile(paramDir ,'hpvNHParamsFrmExcel'), 'muCC');
% Load pre-saved CC-associated death rate
% load([paramDir , 'hpvNHParamsFrmExcel'] , 'muCC' );
% Import from Excel CC-associated detected and undetected death rate
% CC TREATMENT EDIT
% file = [pwd, '/Config/HPV_parameters.xlsx'];
% muCC_ud = xlsread(file, 'Cervical Cancer', 'G21:J26'); % detected CC mortality
% muCC_d = xlsread(file, 'Cervical Cancer', 'M21:O26'); % undetected CC mortality
% muCC = xlsread(file , 'Cervical Cancer' , 'B6:D11');
% save(fullfile(paramDir, 'hpvNHParamsFrmExcel'), 'muCC_ud', 'muCC_d', 'muCC');
load([paramDir, 'hpvNHParamsFrmExcel'], 'muCC_ud', 'muCC_d', 'muCC');
% Natural immunity multiplier
if calibBool && any(18 == pIdx)
idx = find(18 == pIdx);
lambdaMultImmmult = paramSet(paramsSub{idx}.inds(:));
lambdaMultImm = ones(age , 1) .* lambdaMultImmmult;
else
lambdaMultImm = ones(age , 1) .* (0.57479*0.90);
end
% Convert 5-year age groups to 1-year age groups
if ~fivYrAgeGrpsOn
% Replicate rates across single age groups for other variables
vars5To1_nms = {'kCin1_Inf' , 'kCin2_Cin1' , 'kCin3_Cin2' , 'kCC_Cin3' , ...
'rNormal_Inf' , 'kInf_Cin1' , 'kCin1_Cin2' , 'kCin2_Cin3' , 'lambdaMultImm'};
vars5To1_vals = {kCin1_Inf , kCin2_Cin1 , kCin3_Cin2 , kCC_Cin3 , ...
rNormal_Inf , kInf_Cin1 , kCin1_Cin2 , kCin2_Cin3 , lambdaMultImm};
for j = 1 : length(vars5To1_vals)
valsA1 = age5To1(vars5To1_vals{j});
assignin('base', vars5To1_nms{j} , valsA1);
end
end
% HPV immunity clearance multiplier for HIV-positive persons
rImmuneHiv = [1.4167; 1.5682; 1.9722; 2.8333];
% HPV infection multiplier for HIV-positive persons
hpv_hivMult = [1.78; 1.99; 2.12; 2.32];
% HPV clearance multiplier for HIV-positive persons
if calibBool && any(14 == pIdx)
idx = find(14 == pIdx);
hpv_hivClear = zeros(4 , 1);
hpv_hivClear(1,1) = paramSet(paramsSub{idx}.inds(1));
hpv_hivClear(2,1) = hpv_hivClear(1,1)*paramSet(paramsSub{idx}.inds(2));
hpv_hivClear(3,1) = hpv_hivClear(2,1)*paramSet(paramsSub{idx}.inds(3));
hpv_hivClear(4,1) = hpv_hivClear(3,1)*paramSet(paramsSub{idx}.inds(4));
else
hpv_hivClear = [0.60; 0.55; 0.45; 0.30];
end
% CIN2 to CIN3 progression multiplier for HIV-positive women
if calibBool && any(15 == pIdx)
idx = find(15 == pIdx);
c3c2multiplier = paramSet(paramsSub{idx}.inds(:));
c3c2Mults = [1.0; 2.0; 2.7; 3.5];
c3c2Mults(2 : end) = c3c2Mults(2 : end).*c3c2multiplier;
else
c3c2Mults = [1.0; 2.0; 2.7; 3.5];
end
% CIN1 to CIN2 progression multiplier for HIV-positive women
if calibBool && any(16 == pIdx)
idx = find(16 == pIdx);
c2c1multiplier = paramSet(paramsSub{idx}.inds(:));
c2c1Mults = [1.0; 1.9; 2.4; 2.7];
c2c1Mults(2 : end) = c2c1Mults(2 : end).*c2c1multiplier;
else
c2c1Mults = [1.0; 1.9; 2.4; 2.7];
end
% CIN3 to CIN2 regression multiplier for HIV-positive women
if calibBool && any(38 == pIdx)
idx = find(38 == pIdx);
c2c3multiplier = paramSet(paramsSub{idx}.inds(:));
c2c3Mults = [0.60; 0.55; 0.45; 0.30].*c2c3multiplier;
else
c2c3Mults = [0.60; 0.55; 0.45; 0.30];
end
% CIN2 to CIN1 regression multiplier for HIV-positive women
if calibBool && any(39 == pIdx)
idx = find(39 == pIdx);
c1c2multiplier = paramSet(paramsSub{idx}.inds(:));
c1c2Mults = [0.60; 0.55; 0.45; 0.30].*c1c2multiplier;
else
c1c2Mults = [0.60; 0.55; 0.45; 0.30];
end
% HPV tranmission rates
if calibBool && any(10 == pIdx)
idx = find(10 == pIdx);
perPartnerHpv_vax = paramSet(paramsSub{idx}.inds(:));
else
perPartnerHpv_vax = 0.01;
end
if calibBool && any(11 == pIdx)
idx = find(11 == pIdx);
perPartnerHpv_nonV = paramSet(paramsSub{idx}.inds(:));
else
perPartnerHpv_nonV = perPartnerHpv_vax;
end
% Decrease HPV transmission rate in women with cervical cancer as a proxy for decreased sexual activity
vagTrans_vax = ones(risk , 1) .* perPartnerHpv_vax; % [risk x 1]
vagTrans_nonV = ones(risk , 1) .* perPartnerHpv_nonV; % [risk x 1]
betaHPV_vax = bsxfun(@times , [1.0 0.5 0.1; 1.0 0.5 0.1; 1.0 0.5 0.1] , vagTrans_vax);
betaHPV_nonV = bsxfun(@times , [1.0 0.5 0.1; 1.0 0.5 0.1; 1.0 0.5 0.1] , vagTrans_nonV);
beta_hpvVax = zeros(gender , age , risk , 3); % age x risk x [normal transmission , reduced transmission (CC-regional / CC-distant) , reduced transmission (late-stage HIV)]
beta_hpvNonVax = zeros(gender , age , risk , 3);
for a = 1 : age % calculate per-partnership probability of HPV transmission
% VACCINE-TYPE HPV
% per-partnership beta: females to infect HPV-negative males
% affected by betaHPV_F2M_vax, probability of transmission based on cervical cancer status/progression, and number of male acts
beta_hpvVax(2 , a , : , :) = 1 - (bsxfun(@power, 1 - betaHPV_vax , maleActs(a , :)'));
% per-partnership beta: males to infect HPV-negative females,
% affected by betaHPV_M2F_vax, probability of transmission based on cervical cancer status/progression, and number of female acts
beta_hpvVax(1 , a , : , :) = 1 - (bsxfun(@power, 1 - betaHPV_vax , femaleActs(a , :)'));
% NON-VACCINE-TYPE HPV
% per-partnership beta: females to infect HPV-negative males
% affected by betaHPV_F2M_nonV, probability of transmission based on cervical cancer status/progression, and number of male acts
beta_hpvNonVax(2 , a , : , :) = 1 - (bsxfun(@power, 1 - betaHPV_nonV , maleActs(a , :)'));
% per-partnership beta: males to infect HPV-negative females,
% affected by betaHPV_M2F_nonV, probability of transmission based on cervical cancer status/progression, and number of female acts
beta_hpvNonVax(1 , a , : , :) = 1 - (bsxfun(@power, 1 - betaHPV_nonV , femaleActs(a , :)'));
end
beta_hpvVax_mod = zeros(risk , age , viral , endpoints , gender);
beta_hpvNonVax_mod = zeros(risk , age , viral , endpoints , gender);
for v = 1 : viral
for x = 1 : endpoints
for g = 1 : gender
for a = 1 : age
for r = 1 : risk
if (v == 5)
beta_hpvVax_mod(r , a , v , x , g) = beta_hpvVax(g , a , r , 3);
beta_hpvNonVax_mod(r , a , v , x , g) = beta_hpvNonVax(g , a , r , 3);
elseif (x > 1)
beta_hpvVax_mod(r , a , v , x , g) = beta_hpvVax(g , a , r , 2);
beta_hpvNonVax_mod(r , a , v , x , g) = beta_hpvNonVax(g , a , r , 2);
else
beta_hpvVax_mod(r , a , v , x , g) = beta_hpvVax(g , a , r , 1);
beta_hpvNonVax_mod(r , a , v , x , g) = beta_hpvNonVax(g , a , r , 1);
end
end
end
end
end
end
% Cervical cancer progression
kRL = 0.225;
kDR = 0.45;
% Cervical cancer probability of symptomatic detection
% Calibratio completed on August 6, 2023
filename = [paramDir 'kSympParams.xlsx'];
sheet = 1;
kSymp_mat = xlsread(filename, sheet, 'A2:C26');
kSymp = kSymp_mat(n, 1:end);
% Proportion of women who receive hysterectomy by stage
% Based on Campos, 2018
hystMult = [0.796 0.007 0];
% Immunity
rImmune = 0.024; % Clearance rate from Immune to Normal; for HPV16, Johnson (2012)
fImm(1 : age) = 1; % all infected individuals who clear HPV get natural immunity
% Male HPV clearance
if calibBool && any(37 == pIdx)
idx = find(37 == pIdx);
maleHpvClearMult = paramSet(paramsSub{idx}.inds(:));
else
maleHpvClearMult = 3.5;
end
% HIV and ART multipliers
if calibBool && any(21 == pIdx)
idx = find(21 == pIdx);
artHpvMult = paramSet(paramsSub{idx}.inds(:));
else
artHpvMult = 1.0;
end
%% Save intervention parameters
% Import from Excel HIV intervention parameters
% file = [pwd , '/Config/HIV_parameters.xlsx'];
% circProtect = xlsread(file , 'Protection' , 'B18');
% condProtect = xlsread(file , 'Protection' , 'B19');
% MTCTRate = xlsread(file , 'Disease Data' , 'B6:B8');
% artVScov = xlsread(file , 'Protection' , 'A33:C41'); % [years , females , males]
% save(fullfile(paramDir ,'hivIntParamsFrmExcel'), 'circProtect' , ...
% 'condProtect' , 'MTCTRate' , 'artVScov');
% Load pre-saved HIV intervention parameters
load([paramDir , 'hivIntParamsFrmExcel'] , 'circProtect' , ...
'condProtect' , 'MTCTRate' , 'artVScov');
% Intervention start years
hivStartYear = 1980;
circStartYear = 1960; % Year VMMC begins in ages 15-19
circNatStartYear = 2010; % Year SA National VMMC program begins, older men circumcised
vaxStartYear = 2014;
% Protection from HIV or HPV acquisition provided by circumcision and condoms
% Note: circProtect applies only to individuals placed in the HIV-negative, circumcised compartment
% condProtect applies to all individuals of that gender
circProtect = [[circProtect; 0.0] , [0.0; 0.0]]; % HIV protection , HPV protection (previously included 0.30 HPV protection for men)
condProtect = [ones(gender,1).*condProtect , [0.46; 0.70]]; % HIV protection , HPV protection
% Condom use
if calibBool && any(5 == pIdx);
idx = find(5 == pIdx);
condUse = paramSet(paramsSub{idx}.inds(:));
else
if fivYrAgeGrpsOn
condUse = 0.5 * 0.5;
else
condUse = 0.20;
end
end
% Background hysterectomy ********NOT UPDATED!!!!!!!!!!!!!!!!!
hyst = 0; % bool to turn background hysterectomy on or off
OMEGA = zeros(age , 1); % hysterectomy rate
% ART+VS coverage
% Instructions: listed below are four common options for ART scale-up (set
% the variables as exemplified below)
% 1) Linear scale-up to 90-90-90 targets from 2017 to 2030
% Run historicalSim and futureSim using the values below:
% maxRateM = [artVScov(:,3) ; 0.729] .* artOutMult;
% maxRateF = [artVScov(:,2) ; 0.729] .* artOutMult;
% 2) Stabilization at 2017 values
% Run historicalSim and futureSim using the values below:
% maxRateM = [artVScov(:,3) ; artVScov(end,3)] .* artOutMult;
% maxRateF = [artVScov(:,2) ; artVScov(end,2)] .* artOutMult;
% 3) Stabilization at 2020 values (assume linear scale-up to 90-90-90
% from 2017 to 2030, but then stabilize at intermediate 2020 values)
% Run historicalSim using the values from 1), then run futureSim using
% the values below:
% maxRateM = [artVScov((1:end-1),3) ; 0.508333 ; 0.508333] .* artOutMult;
% maxRateF = [artVScov((1:end-1),2) ; 0.627829 ; 0.627829] .* artOutMult;
% 4) Stabilization at 2021 values (assume linear scale-up to 90-90-90
% from 2017 to 2030, but then stabilize at intermediate 2021 values)
% Run historicalSim using the values from 1), then run futureSim using
% the values below:
% maxRateM = [artVScov((1:end-1),3) ; 0.530400 ; 0.530400] .* artOutMult;
% maxRateF = [artVScov((1:end-1),2) ; 0.637946 ; 0.637946] .* artOutMult;
artOutMult = 1.0; %0.95;
minLim = (0.70/0.81); % minimum ART coverage by age
maxLim = ((1-(0.78/0.81)) + 1); % maximum ART coverage by age, adjust to lower value to compensate for HIV-associated mortality
artYr = [(artVScov(:,1) - 1); (2030 - 1)]; % assuming 90-90-90 target reached by 2030; subtract years by 1 so that desired coverage is reached BY the given year
maxRateM = [artVScov(:,3) ; artVScov(end,3)] .* artOutMult; % population-level ART coverage in males
maxRateF = [artVScov(:,2) ; artVScov(end,2)] .* artOutMult; % population-level ART coverage in females
artYr_vec = cell(size(artYr , 1) - 1, 1); % save data over time interval in a cell array
artM_vec = cell(size(artYr , 1) - 1, 1);
artF_vec = cell(size(artYr , 1) - 1, 1);
for i = 1 : size(artYr , 1) - 1 % interpolate ART viral suppression coverages at steps within period
period = [artYr(i) , artYr(i + 1)];
artYr_vec{i} = interp1(period , artYr(i : i + 1 , 1) , ...
artYr(i) : timeStep : artYr(i + 1));
artM_vec{i} = interp1(period , maxRateM(i : i + 1 , 1) , ...
artYr(i) : timeStep : artYr(i + 1));
artF_vec{i} = interp1(period , maxRateF(i : i + 1 , 1) , ...
artYr(i) : timeStep : artYr(i + 1));
end
% VMMC coverage
% Instructions: listed below are four common options for VMMC scale-up (set
% the variables as exemplified below)
% 1) Linear scale-up to 70% target from 2017 to 2030
% Run historicalSim and futureSim using the values below:
% 0.459 0.42 0.318 0.204; ... % 2017
% 0.70 0.70 0.70 0.70]; % 2030 [year x age group]
% 2) Stabilization at 2017 values
% Run historicalSim and futureSim using the values below:
% 0.459 0.42 0.318 0.204; ... % 2017
% 0.459 0.42 0.318 0.204]; % 2030 [year x age group]
% 3) Stabilization at 2020 values (assume linear scale-up to 70% target
% from 2017 to 2030, but then stabilize at intermediate 2020 values)
% Run historicalSim using the values from 1), then run futureSim using
% the values below:
% 0.514542 0.484615 0.406362 0.318554; ... % 2017
% 0.514542 0.484615 0.406362 0.318554]; % 2030 [year x age group]
% 4) Stabilization at 2021 values (assume linear scale-up to 70% target
% from 2017 to 2030, but then stabilize at intermediate 2021 values)
% Run historicalSim using the values from 1), then run futureSim using
% the values below:
% 0.533087 0.506154 0.435725 0.356698; ... % 2017
% 0.533087 0.506154 0.435725 0.356698]; % 2030 [year x age group]
vmmcYr = [circStartYear; 2000; 2008; 2010; 2012; 2017; 2030];
circ_aVec = {4 , 5 , [6:10] , [11:age]}; % Ages: (15-19), (20-24), (25-49), (50+)
vmmcRate = [0.04 0.06 0.0 0.0; ... % 1960
0.10 0.13 0.0 0.0; ... % 2000
0.114 0.161 0.0 0.0; ... % 2008
0.143 0.201 0.14 0.12; ... % 2010
0.172 0.242 0.191 0.143; ... % 2012
0.459 0.42 0.318 0.204; ... % 2017
0.459 0.42 0.318 0.204]; % 2030 [year x age group]
vmmcYr_vec = cell(size(vmmcYr , 1) - 1 , 1); % save data over time interval in a cell array
vmmc_vec = cell(size(vmmcYr , 1) - 1 , length(circ_aVec));
for i = 1 : size(vmmcYr , 1) - 1 % interpolate VMMC coverages at steps within period
period = [vmmcYr(i) , vmmcYr(i + 1)];
xq = [vmmcYr(i) : timeStep : vmmcYr(i + 1)];
vmmcYr_vec{i} = interp1(period , vmmcYr(i : i + 1 , 1) , xq);
for aInd = 1 : length(circ_aVec)
vmmc_vec{i,aInd} = interp1(period , vmmcRate(i : i + 1 , aInd) , xq);
end
end
%% Vaccination efficacy
% Read in excel file where CLH pulled 100 values for vax efficacy from Costa Rica trial from a beta distribution
% --------- CHANGE ME: -------- update to "_bivalent" or "_nonavalent"
% depending on which vaccination is being modeled (for KZN CEA, it is
% bivalent for historicalSim and nonavalent for futureSim.
% Beta distribution code can be found in
% ccTreatment_KZN/vaxEfficacyBetaProb_3Dose.R
% Bivalent uncertainty comes from FDA Cervarix licensure,
% https://www.fda.gov/vaccines-blood-biologics/vaccines/cervarix
% Approval History / Clinical Review Memo
% 100% (98.67% CI: 74.4, 100)
% beta distribution alpha = 6.88
% beta distribution beta = 0.31
% lower CI: 0.7441952
% upper CI: 0.9999993
% median: 0.9878978
% Nonavalent uncertainty comes from FDA Gardasil licensure,
% https://www.fda.gov/vaccines-blood-biologics/vaccines/gardasil-9
% June 9, 2020 Clinical Review - GARDASIL 9
% 96.7 (80.9-99.8)
% beta distribution alpha = 15.66
% beta distribution beta = 0.82
% lower CI: 0.8091454
% upper CI: 0.9993367
% median: 0.9671358
%% Vaccination waning
waning = 1; % bool to turn waning on or off
vaxUncertainty = 1; % bool - if you want to pull from an uncertainty for vax efficacy
if vaxUncertainty == 1
filename = [paramDir 'VaxEfficacyRandVal_2dose_bivalent.xlsx'];
sheet = 1;
vaxEff_mat = xlsread(filename, sheet);
vaxEff = vaxEff_mat(paramSetIdx);
else
vaxEff = 1.0; % 9v vaccine
end
% Screening timeframe
screenYrs = [2000; 2003; 2016; currYear; 2030; 2045];
hpvScreenStartYear = screenYrs(1);
% Proportion of women screened who screen positive
% for CIN2+, this represents test sensitivity.
% for susceptible/immune/infected/CIN1, this represents (1-specificity)
cytoSens = [0.0 , 0.0 , 0.57 , 0.57; ... % Cytology
0.0 , 0.0 , 0.57 , 0.57; ... % columns: (susceptible/immune , infected/CIN1 , CIN2 , CIN3/CC)
0.0 , 0.0 , 0.57 , 0.57; ... % rows: HIV disease status
0.0 , 0.0 , 0.57 , 0.57; ...
0.0 , 0.0 , 0.57 , 0.57; ...
0.0 , 0.0 , 0.57 , 0.57; ...
0.0 , 0.0 , 0.57 , 0.57; ...
0.0 , 0.0 , 0.57 , 0.57];
hpvSens = [0.0 , 0.0 , 0.881 , 0.881; ... % careHPV (susceptible/immune , infected/CIN1 , CIN2 , CIN3/CC)
0.0 , 0.0 , 0.881 , 0.881; ... % columns: (susceptible/immune , infected/CIN1 , CIN2 , CIN3/CC)
0.0 , 0.0 , 0.881 , 0.881; ... % rows: HIV disease status
0.0 , 0.0 , 0.881 , 0.881; ...
0.0 , 0.0 , 0.881 , 0.881; ...
0.0 , 0.0 , 0.881 , 0.881; ...
0.0 , 0.0 , 0.881 , 0.881; ...
0.0 , 0.0 , 0.881 , 0.881];
hpvSensWHO = [0.0 , 0.0 , 0.90 , 0.94; ... % WHO HPV DNA test (susceptible/immune , infected/CIN1 , CIN2 , CIN3/CC)
0.0 , 0.0 , 0.90 , 0.94; ... % columns: (susceptible/immune , infected/CIN1 , CIN2 , CIN3/CC)
0.0 , 0.0 , 0.90 , 0.94; ... % rows: HIV disease status
0.0 , 0.0 , 0.90 , 0.94; ...
0.0 , 0.0 , 0.90 , 0.94; ...
0.0 , 0.0 , 0.90 , 0.94; ...
0.0 , 0.0 , 0.90 , 0.94; ...
0.0 , 0.0 , 0.90 , 0.94];
cytoSensSP = [0.07 , 0.07 , 0.57 , 0.57; ... % Screening paper cytology
0.07 , 0.07 , 0.57 , 0.57; ... % columns: (susceptible/immune , infected/CIN1 , CIN2 , CIN3/CC)
0.15 , 0.15 , 0.52 , 0.52; ... % rows: HIV disease status
0.15 , 0.15 , 0.52 , 0.52; ...
0.15 , 0.15 , 0.52 , 0.52; ...
0.15 , 0.15 , 0.52 , 0.52; ...