import numpy as np import matplotlib.pyplot as plt from pymc import Normal, deterministic, MCMC, Matplot %matplotlib inline mu = np.random.normal(0.0, 0.1, 100) plt.hist(mu) x_sample = np.random.normal(loc=1.0, scale=1.0, size=5) mu = Normal('mu', 0, 1 / (0.1 ** 2)) x = Normal('x', mu=mu, tau=1/(1.0**2), value=x_sample, observed=True) M = MCMC(input=[mu, x]) M.sample(iter=10000) Matplot.plot(mu) x_sample = np.random.normal(loc=1.0, scale=1.0, size=1000) mu = Normal('mu', 0, 1 / (0.1 ** 2)) x = Normal('x', mu=mu, tau=1/(1.0**2), value=x_sample, observed=True) M = MCMC(input=[mu, x]) M.sample(iter=10000) Matplot.plot(mu)