Skip to content

Instantly share code, notes, and snippets.

@WillKoehrsen
Created February 10, 2018 04:12
Show Gist options
  • Save WillKoehrsen/d25c08af178df6c5c5c786fa9fb7a604 to your computer and use it in GitHub Desktop.
Save WillKoehrsen/d25c08af178df6c5c5c786fa9fb7a604 to your computer and use it in GitHub Desktop.
with pm.Model() as duration_model:
# Three parameters to sample
alpha_skew = pm.Normal('alpha_skew', mu=0, tau=0.5, testval=3.0)
mu_ = pm.Normal('mu', mu=0, tau=0.5, testval=7.4)
tau_ = pm.Normal('tau', mu=0, tau=0.5, testval=1.0)
# Duration is a deterministic variable
duration_ = pm.SkewNormal('duration', alpha = alpha_skew, mu = mu_,
sd = 1/tau_, observed = duration)
# Metropolis Hastings for sampling
step = pm.Metropolis()
duration_trace = pm.sample(N_SAMPLES, step=step)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment