(1)Use "sample" function to generate a random vector that follows a multinomial distribution with probability (0.2, 0.3, 0.5) 2) Without use the sample function, generate a random vector that follows a multinomial distribu- ion with probability (0.2, 0.3, 0.5). Hint: Using runif (or rbinom) and loop. Please write several lines of R scripts to simulate a multi- nomial distribution with probability (0.2, 0.3, 0.5).
Added by Lauren C.
Close
Step 1
First, we need to specify the probabilities for each category in the multinomial distribution. In this case, the probabilities are (0.2, 0.3, 0.5). Show more…
Show all steps
Your feedback will help us improve your experience
Brooke Bussoletti and 82 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
(1) Use 'sample' function to generate a random vector that follows a multinomial distribution with probability (0.2, 0.3, 0.5). (2) Without use the 'sample' function, generate a random vector that follows a multinomial distribution with probability (0.2, 0.3, 0.5). Hint: Using "runif" (or "rbinom") and loop. Please write several lines of R scripts to simulate a multinomial distribution with probability (0.2, 0.3, 0.5).
Krishna G.
In R, we can use rXXXX to generate a random sample from the distribution XXXX; to compute the probability mass/density function, we can use dXXXX; to compute the tail probability or the cumulative distribution function, it is convenient to use pXXXX. As shown in class, XXXX can be unif (uniform), norm (normal), binom (binomial), multinom (multinomial), pois (Poisson). List 4 other distributions that can be used in such a way in R; for each of them, say whether it is discrete or continuous.
Lucas F.
Using R, give an algorithm to simulate the value of a random variable X such that P(x=1) =0.35, P(X=2)=0.15, P(X=3)=0.4, P(X=4)=0.1.
T. L.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Watch the video solution with this free unlock.
EMAIL
PASSWORD