A bag contain 5 dices and each have six faces with probability $p_1$=$p_2$=$p_3$=$2p_4$=$2p_5$=$3*p_6$. What is the probability of selecting two dice with face 4, and three dice with face 1? Someone have try the codes for this problem in r shown in picture but I not understand how the probability is obtained. Kindly explain me the answer for this problem.
First, find p_i
s values based on the given equalities and the following assumption (replace all p_i
s based on their relations with p_6
to find it, then find the value of each p_i
):
p_1 + p_2 + p_3 + p_4 + p_5 + p_6 = 1
To find the probability, we need to select 2
out of 5
of dices with face 4
which its probability is p_4^2
and for other dices, they should have face 1
that it's probability is p_1^3
.
Now, to understand the last step, you should read the explanation of the dmultinom(x, size, prob)
function (from this post):
Generate multinomially distributed random number vectors and compute multinomial probabilities. If
x
is a K-component vector,dmultinom(x, prob)
is the probabilityP(X[1]=x[1], … , X[K]=x[k]) = C * prod(j=1 , …, K) p[j]^x[j]
. whereC
is the ‘multinomial coefficient’C = N! / (x[1]! * … * x[K]!)
andN = sum(j=1, …, K) x[j]
. By definition, each componentX[j]
is binomially distributed asBin(size, prob[j])
forj = 1, …, K
.
Therefore, dmultinom(j, n, p)
means C(5,2) * p_1^3 * p_4^2
, as j = (3, 0, 0, 2, 0)
, n=5
, and p = (p_1, p_2, p_3, p_4, p_5, p_6)
.