Exemplo n.º 1
0
    def _make_figures(self):
        """Generates CDFs and normal prob plots for weights and log weights."""
        weights = [record.wtkg2 for record in self.records if record.wtkg2 != 'NA']
        self._make_normal_model(weights, root='brfss_weight_model')
        _17_rankit._make_normal_plot(weights,
                                     root='brfss_weight_normal',
                                     title='Adult weight',
                                     ylabel='Weight (kg)')

        log_weights = [math.log(weight) for weight in weights]
        xmax = math.log(175.0)
        axis = [3.5, 5.2, 0, 1]
        self._make_normal_model(log_weights,
                                root='brfss_weight_log',
                                xmax=xmax,
                                xlabel='adult weight (log kg)',
                                axis=axis)
        _17_rankit._make_normal_plot(log_weights,
                                     root='brfss_weight_lognormal',
                                     title='Adult weight',
                                     ylabel='Weight (log kg)')
Exemplo n.º 2
0
def _make_figures():
    pops = _21_populations._read_data()
    print(len(pops))

    cdf = _13_Cdf._make_cdf_from_list(pops, 'populations')

    _05_myplot._clf()
    _05_myplot._cdf(cdf)
    _05_myplot._save(root='populations',
                     title='City/Town Populations',
                     xlabel='population',
                     ylabel='CDF',
                     legend=False)

    _05_myplot._clf()
    _05_myplot._cdf(cdf)
    _05_myplot._save(root='populations_logx',
                     title='City/Town Populations',
                     xlabel='population',
                     ylabel='CDF',
                     xscale='log',
                     legend=False)

    _05_myplot._clf()
    _05_myplot._cdf(cdf, complement=True)
    _05_myplot._save(root='populations_loglog',
                     title='City/Town Populations',
                     xlabel='population',
                     ylabel='Complementary CDF',
                     yscale='log',
                     xscale='log',
                     legend=False)

    t = [math.log(x) for x in pops]
    t.sort()
    _17_rankit._make_normal_plot(t, 'populations_rankit')
Exemplo n.º 3
0
def _make_normal_plot(weights):
    """Generates a normal probability plot of birth weights."""
    _17_rankit._make_normal_plot(weights,
                                 root='nsfg_birthwgt_normal',
                                 ylabel='Birth weights (oz)', )
Exemplo n.º 4
0
def main():
    results = _10_relay._read_results()
    speeds = _10_relay._get_speeds(results)
    _17_rankit._make_normal_plot(speeds,
                                 root='relay_normal',
                                 ylabel='Speed (MPH)')