#model sd =pymc.Uniform('sd', lower = 5, upper = 100, value = 55.0) a = pymc.Uniform('a', lower = 0, upper = 100, value = 10.0) b = pymc.Uniform('b', lower = .05, upper = 2.0, value = .5) h = pymc.Normal('h', mu = a * Re ** b, tau = sd **-2, value = h_measured, observed = True) model = (sd, a, b) #fit M = pymc.MCMC(model) M.use_step_method(gs.HMCStep, model, step_size_scaling = .3) #M.use_step_method(pymc.AdaptiveMetropolis, model) #compare to without HMCStep M.isample(iter=1000, burn=0, thin=1) acceptance = M.trace('HMC' + '_acceptr' )() print mean(acceptance) #plot gs.show_samples(gs.plot,a.trace()) gs.show_samples(gs.plot,b.trace()) gs.show_samples(gs.plot,sd.trace()) gs.show_samples(gs.hist,a.trace()) gs.show_samples(gs.hist,b.trace()) gs.show_samples(gs.hist,sd.trace()) pl.figure() pl.hexbin(a.trace(), b.trace(), gridsize = 30) pl.show()