def plot_survival_curves_and_histograms(sim_outcomes_mono, sim_outcomes_combo):
    """ draws the survival curves and the histograms of time until HIV deaths
    :param sim_outcomes_mono: outcomes of a cohort simulated under mono therapy
    :param sim_outcomes_combo: outcomes of a cohort simulated under combination therapy
    """

    # get survival curves of both treatments
    survival_curves = [
        sim_outcomes_mono.nLivingPatients, sim_outcomes_combo.nLivingPatients
    ]

    # graph survival curve
    Path.plot_sample_paths(sample_paths=survival_curves,
                           title='Survival curve',
                           x_label='Simulation time step (year)',
                           y_label='Number of alive patients',
                           legends=['Mono Therapy', 'Combination Therapy'],
                           color_codes=['green', 'blue'])

    # histograms of survival times
    set_of_survival_times = [
        sim_outcomes_mono.survivalTimes, sim_outcomes_combo.survivalTimes
    ]

    # graph histograms
    Hist.plot_histograms(data_sets=set_of_survival_times,
                         title='Histogram of patient survival time',
                         x_label='Survival time (year)',
                         y_label='Counts',
                         bin_width=1,
                         legends=['Mono Therapy', 'Combination Therapy'],
                         color_codes=['green', 'blue'],
                         transparency=0.6)
def draw_survival_curves_and_histograms(calibrated_model_no_drug,
                                        calibrated_model_with_drug):
    """ draws the histograms of average survival time
    :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
    """

    # get survival curves of both treatments
    survival_curves = [
        calibrated_model_no_drug.multiCohorts.multiCohortOutcomes.
        survivalCurves, calibrated_model_with_drug.multiCohorts.
        multiCohortOutcomes.survivalCurves
    ]

    # graph survival curve
    Path.plot_sets_of_sample_paths(sets_of_sample_paths=survival_curves,
                                   title='Survival curve',
                                   x_label='Simulation time step',
                                   y_label='Number of alive patients',
                                   legends=['No Drug', 'With Drug'],
                                   color_codes=['blue', 'orange'],
                                   transparency=0.25)

    # histograms of average survival times
    set_of_survival_times = [
        calibrated_model_no_drug.multiCohorts.multiCohortOutcomes.
        meanSurvivalTimes, calibrated_model_with_drug.multiCohorts.
        multiCohortOutcomes.meanSurvivalTimes
    ]

    # graph histograms
    Hist.plot_histograms(data_sets=set_of_survival_times,
                         title='Histogram of average patient survival time',
                         x_label='Survival time',
                         y_label='Counts',
                         bin_width=0.5,
                         legends=['No Drug', 'With Drug'],
                         color_codes=['blue', 'orange'],
                         transparency=0.5,
                         x_range=[6, 20])
示例#3
0
def plot_survival_curves_and_histograms(sim_outcomes_none, sim_outcomes_anticoag):
    """ draws the survival curves and the histograms of time until HIV deaths
    :param sim_outcomes_none: outcomes of a cohort simulated under no therapy
    :param sim_outcomes_anticoag: outcomes of a cohort simulated under anticoagulation
    """

    # get survival curves of both treatments
    survival_curves = [
        sim_outcomes_none.nLivingPatients,
        sim_outcomes_anticoag.nLivingPatients
    ]

    # graph survival curve
    Path.plot_sample_paths(
        sample_paths=survival_curves,
        title='Survival curve',
        x_label='Simulation time step (year)',
        y_label='Number of alive patients',
        legends=['No Therapy', 'Anticoagulation'],
        color_codes=['red', 'blue']
    )

    # histograms of survival times
    set_of_strokes = [
        sim_outcomes_none.nStrokes,
        sim_outcomes_anticoag.nStrokes
    ]

    # graph histograms
    Hist.plot_histograms(
        data_sets=set_of_strokes,
        title='Histogram of number of strokes',
        x_label='Number of Strokes',
        y_label='Counts',
        bin_width=1,
        legends=['No Therapy', 'Anticoagulation'],
        color_codes=['red', 'blue'],
        transparency=0.5
    )
def plot_survival_curves_and_histograms(multi_cohort_outcomes_mono,
                                        multi_cohort_outcomes_combo):
    """ plot the survival curves and the histograms of survival times
    :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
    """

    # get survival curves of both treatments
    sets_of_survival_curves = [
        multi_cohort_outcomes_mono.survivalCurves,
        multi_cohort_outcomes_combo.survivalCurves
    ]

    # graph survival curve
    Path.plot_sets_of_sample_paths(
        sets_of_sample_paths=sets_of_survival_curves,
        title='Survival Curves',
        x_label='Simulation Time Step (year)',
        y_label='Number of Patients Alive',
        legends=['Mono Therapy', 'Combination Therapy'],
        transparency=0.4,
        color_codes=['green', 'blue'])

    # histograms of survival times
    set_of_survival_times = [
        multi_cohort_outcomes_mono.meanSurvivalTimes,
        multi_cohort_outcomes_combo.meanSurvivalTimes
    ]

    # graph histograms
    Hist.plot_histograms(data_sets=set_of_survival_times,
                         title='Histograms of Average Patient Survival Time',
                         x_label='Survival Time (year)',
                         y_label='Counts',
                         bin_width=0.25,
                         x_range=[5.25, 17.75],
                         legends=['Mono Therapy', 'Combination Therapy'],
                         color_codes=['green', 'blue'],
                         transparency=0.5)
示例#5
0
def draw_survival_curves_and_histograms(cohort_no_drug, cohort_with_drug):
    """ draws the survival curves and the histograms of survival time
    :param cohort_no_drug: a cohort simulated when drug is not available
    :param cohort_with_drug: a cohort simulated when drug is available
    """

    # get survival curves of both treatments
    survival_curves = [
        cohort_no_drug.cohortOutcomes.nLivingPatients,
        cohort_with_drug.cohortOutcomes.nLivingPatients
    ]

    # graph survival curve
    Path.plot_sample_paths(sample_paths=survival_curves,
                           title='Survival curve',
                           x_label='Simulation time step',
                           y_label='Number of alive patients',
                           legends=['No Drug', 'With Drug'],
                           color_codes=['blue', 'orange'],
                           transparency=0.5)

    # histograms of survival times
    set_of_survival_times = [
        cohort_no_drug.cohortOutcomes.survivalTimes,
        cohort_with_drug.cohortOutcomes.survivalTimes
    ]

    # graph histograms
    Hist.plot_histograms(data_sets=set_of_survival_times,
                         title='Histogram of patient survival time',
                         x_label='Survival time',
                         y_label='Counts',
                         bin_width=2,
                         legends=['No Drug', 'With Drug'],
                         color_codes=['blue', 'orange'],
                         transparency=0.5)