Skip to content

Commit

Permalink
fix: 🐛 Ensure mortality for cancer is larger than the general population
Browse files Browse the repository at this point in the history
Previously, the mortality for people with and without cancer were assessed separately, and mortality for people with cancer was independent of age. This lead to some weird results, where mortality for some older ages could be greater if a person did not have cancer, than if it had it. This commit fixes this bug by considering that cancer mortality is always additional to a baseline (non-cancer related) age-adjusted mortality.
  • Loading branch information
bcbernardo committed Oct 17, 2024
1 parent 6a7875a commit 70aabdf
Show file tree
Hide file tree
Showing 4 changed files with 291 additions and 147 deletions.
15 changes: 0 additions & 15 deletions seed/natural_history_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -477,21 +477,6 @@ ALL_TYPES:
# NOTE: The following transitions do not come from Kim et al. (2017) #
# ######################################################################### #

# Undetected cancer mortalities
# We take the steepest year of mortality from Carmo & Luiz (2011) and assume
# this is the constant mortality for undetected cancers. In fact, we do not
# know the true mortality rates for undetected cancers, but this approach at
# least ensures that detecting a cancer will always be as good as or better
# than not detecting it.
"LOCAL_UNDETECTED,DECEASED":
0: 0.0042

"REGIONAL_UNDETECTED,DECEASED":
0: 0.0287

"DISTANT_UNDETECTED,DECEASED":
0: 0.0821

# Detected cancer cure
# We assume all cancers get cured exactly at the 60th month after detection.
# This a very rough approximation.
Expand Down
80 changes: 49 additions & 31 deletions seed/survival_curves.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,52 @@
# Kaplan-Meier curves were extracted from Carlo & Luiz (2011) Figure 1. We used the WebPlotDigitizer tool (available from: https://web.eecs.utk.edu/~dcostine/personal/PowerDeviceLib/DigiTest/index.html) to extract the approximate data points.


I:
0: 1.000
12: 0.980
24: 0.953
36: 0.937
48: 0.901
60: 0.856

II:
0: 1.000
12: 0.909
24: 0.744
36: 0.634
48: 0.554
60: 0.512

III:
0: 1.000
12: 0.752
24: 0.456
36: 0.345
48: 0.271
60: 0.244

IV:
0: 1.000
12: 0.426
24: 0.152
36: 0.083
48: 0.060
60: 0.059
curves_by_stage_at_detection:
I:
0: 1.000
12: 0.980
24: 0.953
36: 0.937
48: 0.901
60: 0.856

II:
0: 1.000
12: 0.909
24: 0.744
36: 0.634
48: 0.554
60: 0.512

III:
0: 1.000
12: 0.752
24: 0.456
36: 0.345
48: 0.271
60: 0.244

IV:
0: 1.000
12: 0.426
24: 0.152
36: 0.083
48: 0.060
60: 0.059

# Age composition, in years, of the sample for each survival curve. The 0 key
# indicates participants below the age of 65 years, and the 65 key indicates
# participants aged 65 years and above. See Carmo & Luiz (2011), Table 1.
sample_by_age:
I:
0: 842
65: 100
II:
0: 905
65: 228
III:
0: 950
65: 266
IV:
0: 120
65: 29
9 changes: 3 additions & 6 deletions src/hpv_progression_model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,9 @@ def next(self):
infections_to_keep.add(infection)
self.infections = infections_to_keep

# Add non-cancer death probability to the transition probabilities
# NOTE: Cancer states have their own mortality curves that also
# include mortality from other causes
if self.state not in CANCER_STATES:
if self.non_cancer_death_probability >= RNG.random():
self.state = HPVInfectionState.DECEASED
# Apply non-cancer related death probability
if self.non_cancer_death_probability >= RNG.random():
self.state = HPVInfectionState.DECEASED

# Do not consider infections for deceased individuals
if self.state == HPVInfectionState.DECEASED:
Expand Down
Loading

0 comments on commit 70aabdf

Please sign in to comment.