Skip to content

Instantly share code, notes, and snippets.

@takoika
Created January 25, 2016 03:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takoika/ac81a8aa36f5bc733add to your computer and use it in GitHub Desktop.
Save takoika/ac81a8aa36f5bc733add to your computer and use it in GitHub Desktop.
Sample code to call dice.stan with input data
#!/usr/bin/env python
import pystan
from numpy import random
import matplotlib.pyplot as plt
m = 6
N = 1000
prob = [1/float(m) for i in range(m)]
x = random.multinomial(N,prob)
dice_data = {'m': m, 'x': x}
fit = pystan.stan(file='dice.stan', data=dice_data, iter=100000, chains=1)
print(fit)
fit.plot()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment