def __init__(self, simulated_cohort): """ extracts outputs from a simulated cohort :param simulated_cohort: a cohort after being simulated """ self._survivalTimes = [] # patients' survival times self._times_to_Stroke = [] # patients' times to have had a stroke # survival curve self._survivalCurve = \ PathCls.SamplePathBatchUpdate('Population size over time', id, simulated_cohort.get_initial_pop_size()) # find patients' survival times for patient in simulated_cohort.get_patients(): # get the patient survival time survival_time = patient.get_survival_time() if not (survival_time is None): self._survivalTimes.append( survival_time) # store the survival time of this patient self._survivalCurve.record(survival_time, -1) # update the survival curve # get the patient's time to post stroke time_to_stroke = patient.get_time_to_Stroke() if not (time_to_stroke is None): self._times_to_Stroke.append(time_to_stroke) # summary statistics self._sumStat_survivalTime = StatCls.SummaryStat( 'Patient survival time', self._survivalTimes) self._sumState_timeToStroke = StatCls.SummaryStat( 'Time until AIDS', self._times_to_Stroke)
def __init__(self, simulated_cohort): """ extracts outputs from a simulated cohort :param simulated_cohort: a cohort after being simulated """ self._survivalTimes = [] # patients' survival times self._strokes = [] # survival curve self._survivalCurve = \ PathCls.SamplePathBatchUpdate('Population size over time', id, simulated_cohort.get_initial_pop_size()) # find patients' survival times for patient in simulated_cohort.get_patients(): a = patient.get_numberofstroke() self._strokes.append(a) # get the patient survival time survival_time = patient.get_survival_time() if not (survival_time is None): self._survivalTimes.append( survival_time) # store the survival time of this patient self._survivalCurve.record(survival_time, -1) # update the survival curve # summary statistics self._sumStat_survivalTime = StatCls.SummaryStat( 'Patient survival time', self._survivalTimes)
def __init__(self, simulated_cohort): """ extracts outputs from a simulated cohort :param simulated_cohort: a cohort after being simulated """ self._survivalTimes = [] # patients' survival times self._times_to_Stroke = [] # patients' times to stroke self._count_strokes = [] self._utilities = [] self._costs = [] # survival curve self._survivalCurve = \ PathCls.SamplePathBatchUpdate('Population size over time', id, simulated_cohort.get_initial_pop_size()) # find patients' survival times for patient in simulated_cohort.get_patients(): # get the patient survival time survival_time = patient.get_survival_time() if not (survival_time is None): self._survivalTimes.append(survival_time) # store the survival time of this patient self._survivalCurve.record(survival_time, -1) # update the survival curve count_strokes = patient.get_number_of_strokes() self._count_strokes.append(count_strokes) self._costs.append(patient.get_total_discounted_cost()) self._utilities.append(patient.get_total_discounted_utility()) # summary statistics self._sumStat_survivalTime = StatCls.SummaryStat('Patient survival time', self._survivalTimes) self._sumState_number_strokes = StatCls.SummaryStat('Time until stroke', self._count_strokes) self._sumStat_cost = StatCls.SummaryStat('Patient discounted cost', self._costs) self._sumStat_utility = StatCls.SummaryStat('Patient discounted utility', self._utilities)
def __init__(self, simulated_cohort): self._survivalTimes = [] self._numberStrokes_cohort = [] # survival curve self._survivalCurve = \ Path.SamplePathBatchUpdate('Population size over time', id, simulated_cohort.get_initial_pop_size()) # find patients' survival times for patient in simulated_cohort.get_patients(): # get the patient survival time survival_time = patient.get_survival_time() if not (survival_time is None): self._survivalTimes.append(survival_time) self._survivalCurve.record(survival_time, -1) # summary statistic self._sumStat_survivalTime = Stat.SummaryStat('Patient survival time', self._survivalTimes) # find patients' number of strokes for patient in simulated_cohort.get_patients(): self._numberStrokes_cohort.append( patient.get_number_strokes_individual()) # summary statistic of strokes self._sumStat_numberStrokes = Stat.SummaryStat( 'Patient number of strokes', self._numberStrokes_cohort)
def __init__(self, simulated_cohort): """ extracts outputs from a simulated cohort :param simulated_cohort: a cohort after being simulated """ self._survivalTimes = [] # patients' survival times self._timeToSTROKE = [] # patients' stroke times #we dont need costs or utilities here. # survival curve self._survivalCurve = \ PathCls.SamplePathBatchUpdate('Population size over time', id, simulated_cohort.get_initial_pop_size()) # find patients' survival times for patient in simulated_cohort.get_patients(): # get the patient survival time survival_time = patient.get_survival_time() if not (survival_time is None): self._survivalTimes.append( survival_time) # store the survival time of this patient self._survivalCurve.record(survival_time, -1) # update the survival curve # get the patient's time to AIDS time_To_STROKE = patient.get_these_stroke_times() if not (time_To_STROKE is None): self._time_To_STROKE.append(stroke_times) # summary statistics self._sumStat_survivalTime = StatCls.SummaryStat( 'Patient survival time is... ', self._survivalTimes) self._sumState_timeToSTROKE = StatCls.SummaryStat( 'Time until STROKE is...', self._timeToSTROKE)
def __init__(self, simulated_cohort): """ extracts outputs from a simulated cohort :param simulated_cohort: a cohort after being simulated """ self._eclampsiaTimes = [] # patients' eclampsia times self._utilities = [] self._costs = [] # eclampsia curve self._eclampsiaCurve = \ PathCls.SamplePathBatchUpdate('Population size over time', id, simulated_cohort.get_initial_pop_size()) # find patients' ec times for patient in simulated_cohort.get_patients(): # get the patient EC time eclampsia_time = patient.get_eclampsia_time() if not (eclampsia_time is None): self._eclampsiaTimes.append( eclampsia_time) # store the EC time of this patient self._eclampsiaCurve.record(eclampsia_time, -1) # update the EC curve self._costs.append(patient.get_total_discounted_cost()) self._utilities.append(patient.get_total_discounted_utility()) # summary statistics self._sumStat_ECTime = StatCls.SummaryStat('Patient Eclampsia time', self._eclampsiaTimes) self._sumStat_cost = StatCls.SummaryStat('Patient discounted cost', self._costs) self._sumStat_utility = StatCls.SummaryStat( 'Patient discounted utility', self._utilities)
def get_survival_curve(self): """ returns the sample path for the number of living patients over time """ # find the initial population size n_pop = 2000 # sample path (number of alive patients over time) n_living_patients = PathCls.SamplePathBatchUpdate('# of living patients', 0, n_pop) # record the times of deaths for obs in self._simulatedCohort.get_survival_time(): n_living_patients.record(time=obs, increment=-1) return n_living_patients
def __init__(self, simulated_cohort): self._survivalTimes = [] self._survivalCurve = PathClasses.SamplePathBatchUpdate( 'Population over time', id, simulated_cohort.get_initial_pop_size()) for patient in simulated_cohort.get_patients(): survival_time = patient.get_survival_time() if not (survival_time is None): self._survivalTimes.append(survival_time) self._survivalCurve.record(survival_time, -1) self._sumStat_survivalTime = StatClasses.SummaryStat( 'Patient Survival Time', self._survivalTimes)
def get_survival_curve(self): """ returns the sample path for the number of living patients over time """ # find the initial population size n_pop = self._simulatedCohort.get_initial_pop_size() # sample path (number of alive patients over time) n_living_patients = PathCls.SamplePathBatchUpdate('# of living patients', 5, n_pop) # record the times of deaths for obs in self._simulatedCohort.get_survival_times(): n_living_patients.record(time=obs, increment=-1) return n_living_patients after5 = n_living_patients / n_pop print('Percentage of living patients after 5 years:', after5 )
def __init__(self, simulated_cohort): """ extracts outputs from a simulated cohort :param simulated_cohort: a cohort after being simulated """ self._survivalTimes = [] # patients' survival times self._times_to_CANCER = [] # patients' times to CANCER self._costs = [] # patients' discounted total costs self._utilities = [] # patients' discounted total utilities # survival curve self._survivalCurve = \ PathCls.SamplePathBatchUpdate('Population size over time', id, simulated_cohort.get_initial_pop_size()) # find patients' survival times for patient in simulated_cohort.get_patients(): # get the patient survival time survival_time = patient.get_survival_time() if not (survival_time is None): self._survivalTimes.append( survival_time) # store the survival time of this patient self._survivalCurve.record(survival_time, -1) # update the survival curve # get the patient's time to CANCER time_to_CANCER = patient.get_time_to_CANCER() if not (time_to_CANCER is None): self._times_to_CANCER.append(time_to_CANCER) # cost and utility self._costs.append(patient.get_total_discounted_cost()) self._utilities.append(patient.get_total_discounted_utility()) # summary statistics self._sumStat_survivalTime = StatCls.SummaryStat( 'Patient survival time', self._survivalTimes) self._sumState_timeToCANCER = StatCls.SummaryStat( 'Time until Cancer', self._times_to_CANCER) self._sumStat_cost = StatCls.SummaryStat('Patient discounted cost', self._costs) self._sumStat_utility = StatCls.SummaryStat( 'Patient discounted utility', self._utilities)
def __init__(self, simulated_cohort): """ extracts outputs from a simulated cohort :param simulated_cohort: a cohort after being simulated """ self._survivalTimes = [] # patients' survival times self._times_to_POST_STROKE = [] # patients' times to POST_STROKE self._strokeCount = [] # survival curve self._survivalCurve = \ PathCls.SamplePathBatchUpdate('Population size over time', id, simulated_cohort.get_initial_pop_size()) # find patients' survival times for patient in simulated_cohort.get_patients(): # get the patient survival time survival_time = patient.get_survival_time() if not (survival_time is None): self._survivalTimes.append( survival_time) # store the survival time of this patient self._survivalCurve.record(survival_time, -1) # update the survival curve stroke_count = patient.get_stroke_count() if not (stroke_count is None): self._strokeCount.append(stroke_count) # get the patient's time to POST_STROKE time_to_POST_STROKE = patient.get_time_to_POST_STROKE() if not (time_to_POST_STROKE is None): self._times_to_POST_STROKE.append(time_to_POST_STROKE) # summary statistics self._sumStat_survivalTime = StatCls.SummaryStat( 'Patient survival time', self._survivalTimes) self._sumState_timeToPOST_STROKE = StatCls.SummaryStat( 'Time until POST_STROKE', self._times_to_POST_STROKE) self._sumStat_stroke = StatCls.SummaryStat('Number of strokes', self._strokeCount)
def __init__(self, simulated_cohort): """ extracts outputs from a simulated cohort :param simulated_cohort: a cohort after being simulated """ self._infectionTimes = [] # patients' infection times self._count_infections = [] self._utilities = [] self._costs = [] self._count_treated = [] #infection curve self._infectionCurve = \ PathCls.SamplePathBatchUpdate('Population size over time', id, simulated_cohort.get_initial_pop_size()) # find patients' infection times for patient in simulated_cohort.get_patients(): # get the patient infection time infection_time = patient.get_infection_duration() if not (infection_time is None): self._infectionTimes.append(infection_time) # store the infection time of this patient self._infectionCurve.record(infection_time, -1) # update the infection curve count_infections = patient.get_number_of_infections() count_treated = patient.get_number_of_infections() self._count_infections.append(count_infections) self._infectionTimes.append(infection_time) self._costs.append(patient.get_total_discounted_cost()) self._utilities.append(patient.get_total_discounted_utility()) self._count_treated.append(count_treated) # summary statistics self._sumStat_infectionTime = StatCls.SummaryStat('Patient infection time', self._infectionTimes) self._sumStat_number_infections = StatCls.SummaryStat('Time until infection', self._count_infections) self._sumStat_cost = StatCls.SummaryStat('Patient discounted cost', self._costs) self._sumStat_utility = StatCls.SummaryStat('Patient discounted utility', self._utilities) self._sumStat_treated= StatCls.SummaryStat('Number of Infections Treated', self._count_treated)
def __init__(self, simulated_cohort): """ extracts outputs from a simulated cohort :param simulated_cohort: a cohort after being simulated """ self._survivalTimes = [] # patients' survival times self._times_to_AIDS = [] # patients' times to AIDS self._stroke_total_number = [] # survival curve self._survivalCurve = \ PathCls.SamplePathBatchUpdate('Population size over time', id, simulated_cohort.get_initial_pop_size()) # find patients' survival times for patient in simulated_cohort.get_patients(): self._stroke_total_number.append( patient._stateMonitor.get_stroke_number()) # get the patient survival time survival_time = patient.get_survival_time() if not (survival_time is None): self._survivalTimes.append( survival_time) # store the survival time of this patient self._survivalCurve.record(survival_time, -1) # update the survival curve # get the patient's time to AIDS time_to_AIDS = patient.get_time_to_AIDS() if not (time_to_AIDS is None): self._times_to_AIDS.append(time_to_AIDS) # summary statistics self._sumStat_survivalTime = StatCls.SummaryStat( 'Patient survival time', self._survivalTimes) self._sumState_timeToAIDS = StatCls.SummaryStat( 'Time until AIDS', self._times_to_AIDS) self._sumStat_strokenumber = StatCls.SummaryStat( "number of stroke", self.get_stroke_total())