def RelativeRisk(first, others, week=38): """Computes relative risk of the conditional prob of having a baby for each week, first babies compared to others. first: Pregnancies table others: Pregnancies table week: """ print(type(first)) first_cond = ConditionOnWeeks(first.pmf, week, 'first babies') other_cond = ConditionOnWeeks(others.pmf, week, 'others') risk.ComputeRelativeRisk(first_cond, other_cond)
def RelativeRisk(first, others, week=38): first_cond = ConditionOnWeeks(first.pmf, week, 'first babies') other_cond = ConditionOnWeeks(others.pmf, week, 'others') risk.ComputeRelativeRisk(first_cond, other_cond) return myplot.Pmfs( [first_cond, other_cond], xlabel='weeks', ylabel=r'Prob{x $=$ weeks | x $\geq$ weeks}', title='Conditional Probability', show=True, )