How to solve a Multinomial Distribution IN MATLAB

1 view (last 30 days)
hello, i'm trying to solve this question using Matlab
According to USA Today (March 18, 1997), of 4 million workers in the general workforce, 0.8% tested positive for drugs. Of those testing positive, 22.5% were cocaine users and 54.4% marijuana users.
(a) What is the probability that of 10 workers testing positive, 2 are cocaine users, 0 marijuana users, and 3 users of other drugs?
I solved it by hand as the following
p(2 Cocaine, 5 Marjuana, 3 Others) = 10!/2!5!3! (0.225)^2(0.544)^5(0.231)^3
but i'm not sure how to use the formula. Can you please help me and thanks in advance.

Answers (1)

Image Analyst
Image Analyst on 21 Apr 2019
I believe that formula in MATLAB would be
p = factorial(10) / (factorial(2) * factorial(5) * factorial(3)) * (0.225)^2 * (0.544)^5 * (0.231)^3

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!