コード例 #1
0
pl.subplot(1,2,1)
dismod3.plotting.plot_intervals(dm, [d for d in dm.data if dm.relevant_to(d, 'prevalence', 'all', 'all', 'all')],
                                color='black', print_sample_size=False, alpha=.75, plot_error_bars=False,
                                linewidth=1)
pl.axis([10,60,-.01,1])
pl.yticks([0,.25,.5,.75])
pl.ylabel('Prevalence (per 1)')
pl.xlabel('Age (years)')
pl.title('a) All data')


pl.subplot(1,2,2)
dismod3.plotting.plot_intervals(dm, [d for d in dm.data if dm.relevant_to(d, 'prevalence', region, year, sex)],
                                color='black', print_sample_size=False, alpha=.75, plot_error_bars=False,
                                linewidth=1)
book_graphics.plot_rate(dm, dismod3.utils.gbd_key_for('prevalence', region, year, sex), linestyle='-')

pl.axis([10,60,-.01,1])
pl.yticks([0,.25,.5,.75])
pl.ylabel('Prevalence (per 1)')
pl.xlabel('Age (years)')
pl.title('b) North America, High Income, %s'%year)

pl.subplots_adjust(bottom=.15, wspace=.25, top=.85, left=.1, right=.95)

pl.savefig('pms-prev.pdf')

book_graphics.plot_age_patterns(dm, region=region, year=year, sex=sex,
                                xticks=[15, 25, 35, 45, 55], rate_types='incidence remission prevalence'.split(),
                                yticks=dict(incidence=[0, .05, .1, .15, .2], remission=[0, .5, 1, 1.5, 2.], prevalence=[0, .25, .5, .75, 1]))
コード例 #2
0
ファイル: pms_grids.py プロジェクト: aflaxman/gbd
    results[grid] = dm
    try:
        results['dic_%s'%grid] = dm.mcmc.dic
    except Exception, e:
        print e
        results['dic_%s'%grid] = 'TK'


pl.figure(**book_graphics.quarter_page_params)
for ii, grid in enumerate('abcd'):
    dm = results[grid]
    pl.subplot(1,4,ii+1)
    dismod3.plotting.plot_intervals(dm, [d for d in dm.data if dm.relevant_to(d, 'prevalence', region, year, sex)],
                                    color='black', print_sample_size=False, alpha=1., plot_error_bars=False,
                                    linewidth=2)
    book_graphics.plot_rate(dm, dismod3.utils.gbd_key_for('prevalence', region, year, sex), linestyle='-')
    pl.axis([10, 60, -.05, .8])
    pl.xlabel('Age (Years)')
    pl.xticks([15,35,55])
    if ii == 0:
        pl.yticks([0, .2, .4, .6], [0, 20, 40, 60])
        pl.ylabel('Prevalence (per 100)')
    else:
        pl.yticks([0, .2, .4, .6], ['', '', '', '']) 
    pl.text(12, .75, '(%s)'% grid, va='top', ha='left')


pl.subplots_adjust(wspace=0, bottom=.15, left=.1, right=.99, top=.97)
pl.savefig('pms_grids.pdf')
book_graphics.save_json('pms_grids.json', vars())
コード例 #3
0
ファイル: nuts_and_seeds.py プロジェクト: studentmicky/gbd
models.append(dm)

dm = initialize_model()
dm.params['gamma_effect_%s'%type] = dict(mean=list(pl.log(.01*pl.ones_like(dm.get_estimate_age_mesh()))),
                                         std=list(2.*pl.ones_like(dm.get_estimate_age_mesh())))
dismod3.neg_binom_model.fit_emp_prior(dm, type, map_only=True, store_results=False)
models.append(dm)


dm = initialize_model()
dismod3.neg_binom_model.fit_emp_prior(dm, type, map_only=True, store_results=False)
models.append(dm)

for ii, dm in enumerate(models):
    pl.subplot(1, len(models), len(models)-ii)
    dismod3.plotting.plot_intervals(dm, [d for d in dm.data if dm.relevant_to(d, type, region, year, sex)],
                                    color='black', print_sample_size=False, alpha=1., plot_error_bars=False,
                                    linewidth=2)
    key = dismod3.utils.gbd_key_for(type, region, year, sex)
    dm.vars = {key: dm.vars} # HACK: put the rate model in the dictionary as expected
    book_graphics.plot_rate(dm, key)
    dm.vars = dm.vars[key]
    pl.axis([0, 100, 0, ymax])
    pl.title('')
    pl.xticks([0,25,50,75])
    pl.xlabel('Age (Years)')
    pl.text(5, ymax*.9, '$\\gamma\sim N(%.2f, 2^2)$' % dm.params.get('gamma_effect_%s'%type, {}).get('mean', [0])[0], va='top', ha='left')
        
pl.title('Nuts and Seeds with different priors on $\\gamma$')
pl.show()