Help with dimension shape ( DirichletMultinomial )


I need assistance with using the proper ‘shape’ for my data/model. I recorded the number of green, yellow, and black squares for ten Wordle games for two people and used this example to find the parameters for a single player, but I would like to expand it to encompass two people. Ideally, give each player their own hyper-priors.

Here is my data:

d = {'Player' : [ "P1" if n < 10 else "P2" for n in np.arange(0, 20)],
     'Green': [7, 15,9,7,12,17,12,9,6,12,8,9,8,15,15,11,10,12,11,8], 
     'Yellow': [2,2,9,2,2,2,3,1,6,4,11,0,1,2,3,3,2,2,1,4], 
     'Black': [21,13,12,21,16,11,15,20,18,14,11,21,21,13,12,16,18,16,18,18]

df = pd.DataFrame(data=d)

and here I sub-select ( which I no longer want to do ) and define some basic input variables:

# fit for one single player
df_sub = df[ df['Player'] == 'P1']
# create observations
obs = df_sub[['Green', 'Yellow', 'Black']].to_numpy()
# types of categories
k = 3
# number of games
n = len(df_sub)
# sum of values in rows
total_count = 30

k, n, total_count

and finally, here is the model for a single player:

with pm.Model() as model:
    frac = pm.Dirichlet("frac", a=np.ones(k))
    conc = pm.Lognormal("conc", mu=1, sigma=1)
    counts = pm.DirichletMultinomial(

How do I change the shapes of my ‘frac’, ‘conc’, and ‘counts’ to incorporate two players?

I’m fairly new to pymc3 and bayesian analysis, and although I’ve viewed the tutorial on partial-pooling I’m having trouble generalizing the concepts to the pm.DirichletMultinomial distribution ( which currently has shape 10, 3 for a single player ). Like, if I want a separate lognormal for each player…how would I do that?

Thank you for reading!