This post gives an example of Multinomial Distribution.
Two chess players have the probability Player A would win is 0.40, Player B would win is 0.35, game would end in a draw is 0.25.
The multinomial distribution can be used to answer questions such as: “If these two chess players played 12 games, what is the probability that Player A would win 7 games, Player B would win 2 games, the remaining 3 games would be drawn?”
That post has solved the problem programmatically in R.
dmultinom(x=c(7,2,3), prob = c(0.4,0.35,0.25))
## [1] 0.02483712
Could someone please give a hint about how to solved the problem mathematically?
someone gave a formula for this
$$n = \frac{12!}{7! \times 2! \times 3!}$$
the denominator represents all the possible unique ways to get the combination of (Player A wins 7 games, Player B wins 2 games, 3 drawn)
what does the $12!$ part represent?
the corresponding R code is
(factorial(x = 12) / (factorial(x = 7) * factorial(x = 2) * factorial(x = 3))) * (0.4 ^ 7) * (0.35 ^ 2) * (0.25 ^ 3)
and got
#> [1] 0.02483712
the result is equal to the first one, but why? where does this code from?
R
code is useful for textbook exercises but fails (due to underflow or overflow) on real problems where the numbers might be a little larger. Use logarithms and log factorials (lfactorial
) instead. $\endgroup$