Posterior of a categorical variable

69 Views Asked by At

I am new to pymc and probabilistic programming. I have a question, let's say I have a random variable x which is coming from a categorical distribution. The domain for x is (1,2,3) and I have a prior on x as (1->0.3, 2->0.2, 3->.5). Then I get a set of observations from x, let's say it is D=[1,1,1,2,2,3,1,3,3,3,3,3,3,2,1,2,2,2]. Considering this data if I plug everything in the Bayese equation I can calculate the posterior. How can I do this using pymc? Basically I am asking how can I estimate the posterior of a categorical (multinomial) distribution from another categorical(multinomial) distribution as it's prior having some observed data? (I know the fact categorical variable and drichelet form a conjugate but I want the solution when both are categorical)

BTW, Is this true? If theta is my proportion, then P(theta|D)= P(D|theta)P(theta)/P(D) Where my p(theta)=(.3,.2,.5) and P(D|theta) is just empirical distribution estimation of my values in D (like for D in my example is going to be (5/20, 6/20,7/20)). I think my likelihood is ML estimation of proportions.

0

There are 0 best solutions below