Conversation
Add fixes for: -KP new infections exceeding new infections in a given age/district -PSE for KPs exceeding size of non-regular partners group -survey_year included in call
jeffeaton
left a comment
There was a problem hiding this comment.
Thanks very much -- I've done a couple of formatting PRs, mostly for standardizing white space around operators.
See a few questions and comments; nothing substantive.
| Year set to year of most recent survey with sexual risk behaviour data and to 2018 for countries where | ||
| most recent sexual risk behaviour survey is older that 2018. |
There was a problem hiding this comment.
What is the rationale for specifying this as 2018 for earlier surveys rather than the year of the survey? [Not suggesting a change, just a question for interest and clarification.]
R/shipp.R
Outdated
| survey_year = 2018, | ||
| survey_year = 2022, |
There was a problem hiding this comment.
The NEWS.md refers to default survey year being set to 2018, but here in the code 2018 is changed to 2022. Is that referring to the same thing, or is this different from the changes about default year referenced in the NEWS bullet?
R/shipp.R
Outdated
| survey_year = 2018, | ||
| survey_year = 2022, |
There was a problem hiding this comment.
Same as previous question about 2018 vs. 2022 in NEWS
R/shipp.R
Outdated
| incidence_sexnonkp = ((incidence_sexnonreg * susceptible_sexnonreg) + | ||
| (incidence_sexcohab * susceptible_sexcohab)) / susceptible_sexnonkp, |
There was a problem hiding this comment.
Could this be equivalently calculated as
incidence_sexnonkp = infections_sexnonkp / susceptible_sexnonkp
?
Might prefer that for clarity if that's correct
R/shipp.R
Outdated
| # Non-KP total: sexcohab + sexnonreg | ||
| pop_low_inc_nonkp = ifelse(incidence_sexnonkp < 0.002, susceptible_sexnonkp, 0.0), | ||
| pop_mod_inc_nonkp = ifelse(incidence_sexnonkp >= 0.002 & incidence_sexnonkp < 0.005, | ||
| susceptible_sexnonkp, 0.0), | ||
| pop_high_inc_nonkp = ifelse(incidence_sexnonkp >= 0.005 & incidence_sexnonkp < 0.02, | ||
| susceptible_sexnonkp, 0.0), | ||
| pop_vhigh_inc_nonkp = ifelse(incidence_sexnonkp >= 0.02, susceptible_sexnonkp, 0), | ||
|
|
||
| # KP: FSW (sexpaid12m) | ||
| pop_low_inc_kp = ifelse(incidence_sexpaid12m < 0.002, susceptible_sexpaid12m, 0.0), | ||
| pop_mod_inc_kp = ifelse(incidence_sexpaid12m >= 0.002 & incidence_sexpaid12m < 0.005, | ||
| susceptible_sexpaid12m, 0.0), | ||
| pop_high_inc_kp = ifelse(incidence_sexpaid12m >= 0.005 & incidence_sexpaid12m < 0.02, | ||
| susceptible_sexpaid12m, 0.0), | ||
| pop_vhigh_inc_kp = ifelse(incidence_sexpaid12m >= 0.02, susceptible_sexpaid12m, 0.0), | ||
|
|
||
| # Non-KP: One cohabiting partner (sexcohab) | ||
| pop_low_inc_cohab = ifelse(incidence_sexcohab < 0.002, susceptible_sexcohab, 0.0), | ||
| pop_mod_inc_cohab = ifelse(incidence_sexcohab >= 0.002 & incidence_sexcohab < 0.005, | ||
| susceptible_sexcohab, 0.0), | ||
| pop_high_inc_cohab = ifelse(incidence_sexcohab >= 0.005 & incidence_sexcohab < 0.02, | ||
| susceptible_sexcohab, 0.0), | ||
| pop_vhigh_inc_cohab = ifelse(incidence_sexcohab >= 0.02, susceptible_sexcohab, 0.0), | ||
|
|
||
| # Non-KP: Non-regular partner | ||
| pop_low_inc_sexnonreg = ifelse(incidence_sexnonreg < 0.002, susceptible_sexnonreg, 0.0), | ||
| pop_mod_inc_sexnonreg = ifelse(incidence_sexnonreg >= 0.002 & incidence_sexnonreg < 0.005, | ||
| susceptible_sexnonreg, 0.0), | ||
| pop_high_inc_sexnonreg = ifelse(incidence_sexnonreg >= 0.005 & incidence_sexnonreg < 0.02, | ||
| susceptible_sexnonreg, 0.0), | ||
| pop_vhigh_inc_sexnonreg = ifelse(incidence_sexnonreg >= 0.02, susceptible_sexnonreg, 0.0) |
There was a problem hiding this comment.
What is the source and importance of the 0.002, 0.005, and 0.02 magic numbers in the code block below? Are those the incidence threshold categories specified by UNAIDS?
Can we add a comment at the top of this block describing what those numbers are?
And perhaps ideally code those once to variables and reuse the variable name throughout the code below.
R/shipp.R
Outdated
| incidence_sexnonkp = ((incidence_sexnonreg * susceptible_sexnonreg) + | ||
| (incidence_sexcohab* susceptible_sexcohab))/susceptible_sexnonkp, |
There was a problem hiding this comment.
See comment above -- about whether this can be simplified using the infections_sexnonkp created on the previous line.
R/shipp.R
Outdated
|
|
||
| # Create new variables for population sizes by incidence category | ||
|
|
||
| # Non-KP total: sexcohab + sexnonreg |
There was a problem hiding this comment.
See comment above about changing magic numbers to variable.
Update to sum pop groups by risk category by 5-year age band
…utils into 2025-shipp-update
| prev_sexnonreg = plhiv_sexnonreg/(susceptible_sexnonreg + plhiv_sexnonreg), | ||
| prev_sexpaid12m = plhiv_sexpaid12m/(susceptible_sexpaid12m + plhiv_sexpaid12m), | ||
| rr_sexpaid12m = NA) | ||
| rr_sexpaid12m = incidence_sexpaid12m/incidence_sexcohab) |
There was a problem hiding this comment.
@krisher1 RR calculated here for combined age categories
| @@ -1910,11 +1953,25 @@ shipp_combine_cats_female <- function(age_filter, shipp, naomi_output) { | |||
|
|
|||
| shipp_combine_cats_male <- function(age_filter, shipp, naomi_output) { | |||
There was a problem hiding this comment.
@krisher1 Updated to sum population groups from 5-year age bands
Updated risk population sums
-Input consensus_est = NA if not using Goals or KP Workbooks for the KP new infections
Updates to SHIPP calculations after 2025/2026 survey update:
survey_yearincluded ingenerate_shipp_toolcallUpdates to SHIPP calculations to separate KPs from elevated risk group:
Adapted
shipp_combine_cats_female()to replace 'elevrisk' group with 'sexnonkp and 'kp' group:Adapted
shipp_combine_cats_male()to replace 'elevrisk' group with 'sexnonkp and 'kp' group:Calculate new variables for non-KP risk group (combining sexcohab and sexnonreg)
Calculate new variables for KP risk group (combining pwid and msm)
Calculated low, mod, high and v.high incidence risk groups for: