def print_comparative_outcomes(calibrated_model_no_drug,
                               calibrated_model_with_drug):
    """ prints expected and percentage increase in average survival time when drug is available
    :param calibrated_model_no_drug: calibrated model simulated when drug is not available
    :param calibrated_model_with_drug: calibrated model simulated when drug is available
    """
    # increase in survival time
    increase_stat = Stat.DifferenceStatPaired(
        name='Increase in mean survival time',
        x=calibrated_model_with_drug.multiCohorts.multiCohortOutcomes.
        meanSurvivalTimes,
        y_ref=calibrated_model_no_drug.multiCohorts.multiCohortOutcomes.
        meanSurvivalTimes)
    # mean and prediction interval
    mean = increase_stat.get_mean()
    pred_int = increase_stat.get_PI(alpha=D.ALPHA)

    print(
        "Expected increase in mean survival time (years) and {:.{prec}%} prediction interval:"
        .format(1 - D.ALPHA, prec=0), mean, pred_int)

    # % increase in mean survival time
    relative_diff_stat = Stat.RelativeDifferencePaired(
        name='% increase in mean survival time',
        x=calibrated_model_with_drug.multiCohorts.multiCohortOutcomes.
        meanSurvivalTimes,
        y_ref=calibrated_model_no_drug.multiCohorts.multiCohortOutcomes.
        meanSurvivalTimes)
    # estimate and prediction interval
    mean = relative_diff_stat.get_mean()
    pred_int = relative_diff_stat.get_PI(alpha=D.ALPHA)

    print(
        "Expected percentage increase in mean survival time and {:.{prec}%} confidence interval:"
        .format(1 - D.ALPHA, prec=0), mean, pred_int)
Beispiel #2
0
    def get_diff_mean_interval(self,
                               scenario_name_base,
                               scenario_names,
                               outcome_name,
                               deci=0,
                               form=None,
                               multiplier=1,
                               interval_type='p'):

        if type(scenario_names) is not list:
            scenario_names = [scenario_names]

        list_mean_PI = {}
        for name in scenario_names:
            stat = Stat.DifferenceStatPaired(
                name='',
                x=self.scenarios[name].outcomes[outcome_name],
                y_ref=self.scenarios[scenario_name_base].outcomes[outcome_name]
            )

            list_mean_PI[name] = Support.get_mean_interval(
                stat=stat,
                interval_type=interval_type,
                deci=deci,
                form=form,
                multiplier=multiplier)

        if len(scenario_names) == 1:
            return list_mean_PI[scenario_names[0]]
        else:
            return list_mean_PI
def print_comparative_outcomes(multi_cohort_outcomes_mono,
                               multi_cohort_outcomes_combo):
    """ prints average increase in survival time, discounted cost, and discounted utility
    under combination therapy compared to mono therapy
    :param multi_cohort_outcomes_mono: outcomes of a multi-cohort simulated under mono therapy
    :param multi_cohort_outcomes_combo: outcomes of a multi-cohort simulated under combination therapy
    """

    # increase in mean survival time under combination therapy with respect to mono therapy
    increase_mean_survival_time = Stat.DifferenceStatPaired(
        name='Increase in mean survival time',
        x=multi_cohort_outcomes_combo.meanSurvivalTimes,
        y_ref=multi_cohort_outcomes_mono.meanSurvivalTimes)

    # estimate and PI
    estimate_PI = increase_mean_survival_time.get_formatted_mean_and_interval(
        interval_type='p', alpha=D.ALPHA, deci=2)
    print(
        "Increase in mean survival time and {:.{prec}%} uncertainty interval:".
        format(1 - D.ALPHA, prec=0), estimate_PI)

    # increase in mean discounted cost under combination therapy with respect to mono therapy
    increase_mean_discounted_cost = Stat.DifferenceStatPaired(
        name='Increase in mean discounted cost',
        x=multi_cohort_outcomes_combo.meanCosts,
        y_ref=multi_cohort_outcomes_mono.meanCosts)

    # estimate and PI
    estimate_PI = increase_mean_discounted_cost.get_formatted_mean_and_interval(
        interval_type='p', alpha=D.ALPHA, deci=2, form=',')
    print(
        "Increase in mean discounted cost and {:.{prec}%} uncertainty interval:"
        .format(1 - D.ALPHA, prec=0), estimate_PI)

    # increase in mean discounted QALY under combination therapy with respect to mono therapy
    increase_mean_discounted_qaly = Stat.DifferenceStatPaired(
        name='Increase in mean discounted QALY',
        x=multi_cohort_outcomes_combo.meanQALYs,
        y_ref=multi_cohort_outcomes_mono.meanQALYs)

    # estimate and PI
    estimate_PI = increase_mean_discounted_qaly.get_formatted_mean_and_interval(
        interval_type='p', alpha=D.ALPHA, deci=2)
    print(
        "Increase in mean discounted utility and {:.{prec}%} uncertainty interval:"
        .format(1 - D.ALPHA, prec=0), estimate_PI)
def mytest_diff_stat_paired(x, y):
    # define
    stat = Stat.DifferenceStatPaired(x, y, name='Test DifferenceStatPaired')
    print('Testing DifferenceStatPaired:')
    print_results(stat)