Exemple #1
0
import scipy.interpolate

import graphics
import book_graphics

reload(book_graphics)


import age_group_models as agm

reload(agm)

m = {}

mc.np.random.seed(12345)
f = scipy.interpolate.interp1d([0, 20, 40, 60, 100], [0, 0.1, 0.9, 0.2, 0])
model = agm.simulate_age_group_data(N=25, delta_true=5e2, pi_true=f)
agm.fit_age_integrating_model(model)

m[0] = model

mc.np.random.seed(12345)
f = scipy.interpolate.interp1d([0, 20, 40, 60, 100], [0, 0.1, 0.9, 0.2, 0])
model = agm.simulate_age_group_data(N=25, delta_true=5, pi_true=f)
agm.fit_age_integrating_model(model)
m[1] = model

agm.plot_fits(m)
pl.savefig("age_group_integrate.pdf")
pl.show()
Exemple #2
0
import graphics
import book_graphics

reload(book_graphics)

import age_group_models as agm

reload(agm)

mc.np.random.seed(123456)

m = {}

f = scipy.interpolate.interp1d([0, 20, 40, 60, 100], [0, .1, .9, .2, 0])
model = agm.simulate_age_group_data(N=25, delta_true=5e2, pi_true=f)
agm.fit_midpoint_covariate_model(model)
m[0] = model

mc.np.random.seed(123456)

f = scipy.interpolate.interp1d([0, 20, 40, 60, 100], [0, .1, .9, .2, 0])
model = agm.simulate_age_group_data(N=25, delta_true=5, pi_true=f)
agm.fit_midpoint_covariate_model(model)
m[1] = model

agm.plot_fits(m)
pl.savefig('book/graphics/age_group_midpoint_covariate.pdf')

pl.show()