Compute Per-Profile Fatal Prevalence of Resistance R_Kdelta* (Eq. 13)
Source:R/yll.R
compute_fatal_resistance_prevalence.RdFor each **resistant** profile delta of pathogen K, computes the fatal prevalence of resistance:
Usage
compute_fatal_resistance_prevalence(
profiles_with_rr,
probability_col = "probability",
rr_profile_col = "RR_LOS_profile",
dominant_class_col = "dominant_class",
facility_col = NULL,
facility_name = NULL
)Arguments
- profiles_with_rr
Named list from
assign_rr_to_profiles(rr_col = "RR_death"), one element per pathogen. Each element must containprobability_col,rr_profile_col, anddominant_class_col.- probability_col
Character. Profile prevalence column R'_Kdelta. Default
"probability".- rr_profile_col
Character. Dominant-class converted RR. Default
"RR_LOS_profile".- dominant_class_col
Character. Column identifying the dominant class (or
"all_susceptible"). Default"dominant_class".- facility_col
Character or
NULL. Facility identifier column. DefaultNULL.- facility_name
Character or
NULL. If provided, stored in the output for provenance tracking. DefaultNULL.
Value
Named list (one per pathogen). Each element:
per_profileData frame of resistant profiles augmented with
R_star(R*_Kdelta per profile) andnumerator_delta.R_K_starScalar: \(\sum_\delta R^*_{K\delta}\) = total fatal resistance prevalence for pathogen K.
sum_r_primeScalar: \(\sum_\delta R'_{K\delta}\) (resistant profiles only).
susceptible_fractionScalar: \(1 - \sum_\delta R'_{K\delta}\).
denominatorScalar: shared denominator for all profiles.
n_resistant_profilesInteger: number of resistant profiles.
Details
$$ R^*_{K\delta} = \frac{R'_{K\delta} \cdot RR_{Kd^*}} {\left(1 - \textstyle\sum_\delta R'_{K\delta}\right) + \textstyle\sum_\delta R'_{K\delta} \cdot RR_{Kd^*}} $$
where the sums \(\sum_\delta\) run over resistant profiles only
(profiles with at least one resistant antibiotic class, i.e.
dominant_class != "all_susceptible"). The term
\((1 - \sum_\delta R'_{K\delta})\) is the susceptible fraction and must
be > 0 for the formula to give R*_Kdelta < 1.
Important: pass the output of assign_rr_to_profiles()
directly – do not call filter_profiles_to_rr_classes()
first, because renormalisation would set \(\sum R'_{K\delta} = 1\) and
collapse the denominator, producing R*_Kdelta = 1 for every pathogen.