Last active
January 12, 2021 19:51
-
-
Save WillKoehrsen/c4d0342738696a0723030647fce01f8a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Observations from multiple trips | |
c = np.array([[3, 2, 1], | |
[2, 3, 1], | |
[3, 2, 1], | |
[2, 3, 1]]) | |
with pm.Model() as model: | |
# Parameters are a dirichlet distribution | |
parameters = pm.Dirichlet('parameters', a=alphas, shape=3) | |
# Observed data is a multinomial distribution | |
observed_data = pm.Multinomial( | |
'observed_data', n=6, p=parameters, shape=3, observed=c) | |
trace = pm.sample(draws=1000, chains=2, tune=500, discard_tuned_samples=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wonderful article! In the 'c' parameter, what if you saw cubs there and now the total wasn't 6 for each trip to the zoo. For example one trip you saw [3, 2, 3], would that work and would any other parameter need to be changed?
Many thanks!