def main(): results = _10_relay._read_results() speeds = _10_relay._get_speeds(results) # plot the distribution of actual speeds pmf = _04_Pmf._make_pmf_from_list(speeds, 'actual speeds') # myplot.Clf() # myplot.Hist(pmf) # myplot.Save(root='observed_speeds', # title='PMF of running speed', # xlabel='speed (mph)', # ylabel='probability') # plot the biased distribution seen by the observer biased = _bias_pmf(pmf, 7.5, name='observed speeds') _05_myplot._clf() _05_myplot._hist(biased) _05_myplot._save(root='observed_speeds', title='PMF of running speed', xlabel='speed (mph)', ylabel='probability') cdf = _13_Cdf._make_cdf_from_pmf(biased) _05_myplot._clf() _05_myplot._cdf(cdf) _05_myplot._save(root='observed_speeds_cdf', title='CDF of running speed', xlabel='speed (mph)', ylabel='cumulative probability')
def _make_figures(pool, firsts, others): """Creates several figures for the book.""" # plot PMFs of birth weights for first babies and others _05_myplot._clf() _05_myplot._hist(firsts.weight_pmf, linewidth=0, color='blue') _05_myplot._hist(others.weight_pmf, linewidth=0, color='orange') _05_myplot._save(root='nsfg_birthwgt_pmf', title='Birth weight PMF', xlabel='weight (ounces)', ylabel='probability') # plot CDFs of birth weights for first babies and others _05_myplot._clf() _05_myplot._cdf(firsts.weight_cdf, linewidth=2, color='blue') _05_myplot._cdf(others.weight_cdf, linewidth=2, color='orange') _05_myplot._save(root='nsfg_birthwgt_cdf', title='Birth weight CDF', xlabel='weight (ounces)', ylabel='probability', axis=[0, 200, 0, 1])
def _cdf_time_interval(): timeInterval = _calc_time_interval() pmf = _04_Pmf._make_pmf_from_list(timeInterval, "baby birth interval") _05_myplot._clf() _05_myplot._hist(pmf) _05_myplot._save( root="baby_birth_interval_pmf", title="PMF of baby birth interval", xlabel="interval(minutes)", ylabel="probability", ) cdf = _13_Cdf._make_cdf_from_pmf(pmf) _05_myplot._clf() _05_myplot._cdf(cdf) _05_myplot._save( root="baby_birth_interval_cdf", title="CDF of baby birth interval", xlabel="interval(minutes)", ylabel="cumulative probability", )