Is it possible to create a mixture of named distributions to estimate parameters of mixture components?
Say I have two banks of coins (A and B) with two fractions of coins in them. Each fraction has its own fairness (p1, p2) and I know the composition of each bank (wA is the proportion of coins 1 in bank A). I draw NA and NB coins from each bank and throw them one by one recording the number of heads (KA and KB).
I would setup it like this (in pseudo-pymc):
p1 = pm.Beta('p1', 2,2)
p2 = pm.Beta('p2', 2,2)
pA = pm.Mixture.dist([p1, p2], w = [wA, 1-wA])
pB = pm.Mixture.dist([p1, p2], w = [wB, 1-wB])
likeA = pm.Binomial('likeA', n = NA, p = pA, observed = KA )
likeB = pm.Binomial('likeB', n = NB, p = pB, observed = KB )
This however does not compile because pm.Mixture.dist cannot accept named distributions.
Or I’m thinking in the wrong direction?