Skip to content

Commit

Permalink
Merge pull request #25 from RTIInternational/exp-consistent-summary
Browse files Browse the repository at this point in the history
Merge exp-consistent-lifespans and exp-consistent summary
  • Loading branch information
pzirali authored Jul 30, 2024
2 parents e113128 + dfe9b87 commit f811d6c
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions crcsim/experiment/summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,40 @@ def add_derived_variables(df: pd.DataFrame) -> pd.DataFrame:
+ df["discounted_cost_treatment"]
)

df["cost_treatment_per_1k_40yo"] = (
df["cost_treatment_initial_per_1k_40yo"]
+ df["cost_treatment_ongoing_per_1k_40yo"]
+ df["cost_treatment_terminal_per_1k_40yo"]
)

df["discounted_cost_treatment_per_1k_40yo"] = (
df["discounted_cost_treatment_initial_per_1k_40yo"]
+ df["discounted_cost_treatment_ongoing_per_1k_40yo"]
+ df["discounted_cost_treatment_terminal_per_1k_40yo"]
)

df["cost_total_per_1k_40yo"] = (
df["cost_routine_per_1k_40yo"]
+ df["cost_diagnostic_per_1k_40yo"]
+ df["cost_surveillance_per_1k_40yo"]
+ df["cost_treatment_per_1k_40yo"]
)

df["discounted_cost_total_per_1k_40yo"] = (
df["discounted_cost_routine_per_1k_40yo"]
+ df["discounted_cost_diagnostic_per_1k_40yo"]
+ df["discounted_cost_surveillance_per_1k_40yo"]
+ df["discounted_cost_treatment_per_1k_40yo"]
)

df["total_colonoscopy"] = (
df["Colonoscopy_performed_diagnostic_per_1k_40yo_mean"] + df["Colonoscopy_performed_surveillance_per_1k_40yo_mean"]
)

return df



def summarize_results(df: pd.DataFrame) -> pd.DataFrame:
""" Compute the mean and standard deviation of every analysis variable, by scenario. """
groups = df.groupby("scenario")
Expand All @@ -131,6 +162,7 @@ def summarize_results(df: pd.DataFrame) -> pd.DataFrame:
select_columns = ["scenario",
"Colonoscopy_performed_diagnostic_per_1k_40yo_mean",
"Colonoscopy_performed_surveillance_per_1k_40yo_mean",
"total_colonoscopy",
"FIT_performed_routine_per_1k_40yo_mean",
"clin_crc_per_1k_40yo_mean",
"deadcrc_per_1k_40yo_mean",
Expand All @@ -141,25 +173,34 @@ def summarize_results(df: pd.DataFrame) -> pd.DataFrame:
"discounted_cost_treatment_initial_mean",
"discounted_cost_treatment_ongoing_mean",
"discounted_cost_treatment_terminal_mean",
"discounted_cost_treatment",
"discounted_cost_total",
"cost_routine_mean",
"cost_diagnostic_mean",
"cost_surveillance_mean",
"cost_treatment_initial_mean",
"cost_treatment_ongoing_mean",
"cost_treatment_terminal_mean",
"cost_treatment",
"cost_total",
"discounted_cost_routine_per_1k_40yo_mean",
"discounted_cost_diagnostic_per_1k_40yo_mean",
"discounted_cost_surveillance_per_1k_40yo_mean",
"discounted_cost_treatment_initial_per_1k_40yo_mean",
"discounted_cost_treatment_ongoing_per_1k_40yo_mean",
"discounted_cost_treatment_terminal_per_1k_40yo_mean",
"discounted_cost_treatment_per_1k_40yo_mean",
"discounted_cost_total_per_1k_40yo",
"cost_routine_per_1k_40yo_mean",
"cost_diagnostic_per_1k_40yo_mean",
"cost_surveillance_per_1k_40yo_mean",
"cost_treatment_initial_per_1k_40yo_mean",
"cost_treatment_ongoing_per_1k_40yo_mean",
"cost_treatment_terminal_per_1k_40yo_mean",
"cost_treatment_per_1k_40yo_mean",
"cost_total_per_1k_40yo",
"discounted_lifeobs_if_unscreened_undiagnosed_at_40_mean"]

summary_subset = summary[select_columns]

return summary, summary_subset
Expand Down

0 comments on commit f811d6c

Please sign in to comment.