Last active
August 29, 2015 14:18
-
-
Save fonnesbeck/f724b1d7bf21b81d2ef2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymc as pm | |
import numpy as np | |
missing_fill_value = 16.172 | |
data = np.array([None, None, None, 12, 17, 20]) | |
#data = np.where(data == np.array(None), missing_fill_value, data) | |
#masked_values = np.ma.masked_equal(data, value=missing_fill_value) | |
masked_values = np.ma.masked_array(data, np.equal(data, None), fill_value=10) | |
mu = pm.Normal('mu', 10, 1e-6, value=10) | |
tau = pm.Exponential('tau', 0.01, value=10) | |
x = pm.TruncatedNormal('x', mu=mu, tau=tau, a=7, b=27, value=data, observed=True) | |
M = pm.MCMC(locals()) | |
M.sample(2000, burn=1000) | |
mu.summary() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment