Exemple #1
0
# <markdowncell>

# ### Rerun the model

# <codecell>

sim.run(0, 12)

# <markdowncell>

# ### Plot the posterior histogram

# <codecell>

model.plot_distributions()

# <markdowncell>

# ### Plot the posterior histogram with the normal approximation

# <codecell>

model.plot_distributions(show_normal=True)

# <markdowncell>

# ### Fit the model parameter, $a$, and the initial value of the variable, $h$

# <codecell>
# <markdowncell>

# ### Rerun the model

# <codecell>

sim.run(0,12)

# <markdowncell>

# ### Plot the posterior histogram

# <codecell>

model.plot_distributions()

# <markdowncell>

# ### Plot the posterior histogram with the normal approximation

# <codecell>

model.plot_distributions(show_normal=True)

# <markdowncell>

# ### Fit the model parameter, $a$, and the initial value of the variable, $h$

# <codecell>
# <codecell>

model=MCMCModel(sim,{'b':[0,10]})
model.fit(iter=25000)

# <codecell>

model.b

# <codecell>

sim.run(5)

# <codecell>

model.plot_distributions()

# <codecell>

model.sigma

# <codecell>

print "The parameter b has best estimate",model.mu['b'],' +/- ',model.sigma['b']

# <markdowncell>

# ## A linear growth example
# 
# Data from [http://www.seattlecentral.edu/qelp/sets/009/009.html](http://www.seattlecentral.edu/qelp/sets/009/009.html)
Exemple #4
0
# <codecell>

model = MCMCModel(sim, {'b': [0, 10]})
model.fit(iter=25000)

# <codecell>

model.b

# <codecell>

sim.run(5)

# <codecell>

model.plot_distributions()

# <codecell>

model.sigma

# <codecell>

print "The parameter b has best estimate", model.mu['b'], ' +/- ', model.sigma[
    'b']

# <markdowncell>

# ## A linear growth example
#
# Data from [http://www.seattlecentral.edu/qelp/sets/009/009.html](http://www.seattlecentral.edu/qelp/sets/009/009.html)
Exemple #5
0
sim.run(0, 350)

# <codecell>

model = MCMCModel(
    sim, {
        'beta0': [0, 1],
        'invGamma': [3.5, 10.7],
        'beta1': [0, 1],
        'q': [0, 100],
        'tau': [100, 150],
        'invk': [5, 22]
    })
#model = MCMCModel(sim,{'invGamma':[3.5,10.7],'q':[0,10]})
model.fit(iter=500)
model.plot_distributions()

# <codecell>

Beta0 = model.beta0

# <codecell>

Beta1 = model.beta1

# <codecell>

#beta = (Beta0 + Beta1)/2

# <codecell>