UCL / hivpy

MIT License
0 stars 0 forks source link

PrEP willingness #197

Closed pineapple-cat closed 1 month ago

pineapple-cat commented 2 months ago

Determine PrEP preferences among the population and mark people who are willing to take PrEP if offered.

* PrEP preference between different modalities (oral, injectable, vaginal ring) based on beta distribution ;    
* Individuals values for each PrEP type are currently independent of one another - we may want to correlate preferences for different types in future ;

if (caldate{t} = date_prep_oral_intro > . and age ge 15) or (age = 15 and caldate{t} >= date_prep_oral_intro > .) then do;
    * pref_prep_oral;   * pref_prep_oral=rand('beta',5,2); pref_prep_oral=rand('beta',pref_prep_oral_beta_s1,5);            
end;    

if (caldate{t} = date_prep_inj_intro > . and age ge 15) or (age = 15 and caldate{t} >= date_prep_inj_intro > .) then do;
    if pop_wide_tld = 1 then pref_prep_inj_beta_s1 = pref_prep_inj_beta_s1 - 0.7 ; 
    * pref_prep_inj;    pref_prep_inj=rand('beta',pref_prep_inj_beta_s1,5);
end;

if (caldate{t} = date_prep_vr_intro > . and age ge 15) or (age = 15 and caldate{t} >= date_prep_vr_intro > .) then do;
    * pref_prep_vr;     pref_prep_vr=.; if gender=2 then pref_prep_vr=rand('beta',pref_prep_vr_beta_s1,5);  *women only;        
end;

if . < caldate{t} < date_prep_oral_intro or date_prep_oral_intro=. then pref_prep_oral = 0;
if . < caldate{t} < date_prep_inj_intro or date_prep_inj_intro=. then pref_prep_inj = 0;
if . < caldate{t} < date_prep_vr_intro or date_prep_vr_intro=. then pref_prep_vr = 0;

* highest_prep_pref;
* does not show people who are not willing to take any PrEP type;
if      pref_prep_oral > pref_prep_inj and pref_prep_oral > pref_prep_vr then highest_prep_pref=1;  * 1=preference for oral PrEP;
else if pref_prep_inj > pref_prep_oral and pref_prep_inj > pref_prep_vr then highest_prep_pref=2;   * 2=preference for injectable PrEP;
else if pref_prep_vr > pref_prep_oral and pref_prep_vr > pref_prep_inj then highest_prep_pref=3;    * 3=preference for vaginal ring;            
* lapr - encode no preference between types? / no type acceptable? ;

* willingness to take prep if offered;

if caldate{t} ge date_prep_oral_intro then do;
    if  pref_prep_oral > prep_willingness_threshold then prep_oral_willing =1;
    q=rand('uniform');
    if pop_wide_tld=1 and prep_oral_willing =0 and q < 0.05 then prep_oral_willing =1; 
end;

if caldate{t} ge date_prep_inj_intro then do;
    if  pref_prep_inj  > prep_willingness_threshold then prep_inj_willing =1;
end;

if caldate{t} ge date_prep_vr_intro then do;
    if  pref_prep_vr > prep_willingness_threshold   then prep_vr_willing =1;
end;

if prep_dependent_prev_vg1000=1 and . < prev_vg1000_1549 < prep_vlg1000_threshold then do; 
    prep_oral_willing=0; prep_inj_willing=0; prep_vr_willing=0;
end;

prep_any_willing = 0;
if prep_oral_willing = 1 or prep_inj_willing = 1 or prep_vr_willing = 1 then prep_any_willing = 1;