Skip to content
Chris Fonnesbeck edited this page Apr 12, 2016 · 1 revision

Put the following into simple_von_mises.py:

import pymc
import numpy as np

true_mu = -0.1
true_kappa = 50.0
N_samples = 500

mu = pymc.Uniform('mu', lower=-np.pi, upper=np.pi)
kappa = pymc.Uniform('kappa', lower=0.0, upper=100.0)


data = pymc.rvon_mises( true_mu, true_kappa, size=(N_samples,) )
y = pymc.VonMises('y',mu, kappa, value=data, observed=True)

Then execute the following:

import pymc
import simple_von_mises

model=pymc.MCMC(simple_von_mises)
model.sample(iter=1000, burn=500, thin=2)

print 'mu',model.mu.value
print 'kappa',model.kappa.value
Clone this wiki locally