Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Consider a multinomial trial with outcomes \(1,2, \ldots, k\) and respective probabilities \(p_{1}, p_{2}, \ldots, p_{k} .\) Let ps denote the \(\mathrm{R}\) vector for \(\left(p_{1}, p_{2}, \ldots, p_{k}\right) .\) Then a single random trial of this multinomial is computed with the command multitrial (ps), where the required \(\mathrm{R}\) functions are: \({ }^{2}\) (a) Compute 10 random trials if \(\mathrm{ps}=\mathrm{c}(.3, .2, .2, .2, .1)\). (b) Compute 10,000 random trials for ps as in (a). Check to see how close the estimates of \(p_{i}\) are with \(p_{i}\).

Short Answer

Expert verified
The commands to compute the random trials are trials_10 <- rmultinom(10, 1, c(.3, .2, .2, .2, .1)) and trials_10000 <- rmultinom(10000, 1, c(.3,.2,.2,.2,.1)) for 10 and 10,000 trials respectively. The command to estimate the probabilities is estimate <- colSums(trials_10000)/10000. The closer the estimated probabilities are to the original probabilities, the better the estimate.

Step by step solution

01

Generating Random Trials with Small Size

The task is to compute 10 random trials with ps = c(.3, .2, .2, .2, .1). In R, use the rmultinom function from the stats package. The rmultinom function generates multinomial random numbers. The syntax is rmultinom(n, size, prob), where n is the number of random numbers to generate, size is the number of trials, and prob is a vector of probability weights. For this task, the command will be trials_10 <- rmultinom(10, 1, c(.3, .2, .2, .2, .1)).
02

Generating Random Trials with Large Size

Similarly, generate 10,000 random trials with the same probabilities. The R command will be trials_10000 <- rmultinom(10000, 1, c(.3,.2,.2,.2,.1)).
03

Estimating Probabilities

The next step after generating these random trials is to compute the estimates of the probabilities p_i. This can be done by taking the sum of each outcome and dividing by the total number of trials. In R, if the output was stored in a matrix (where each row corresponds to an outcome and each column corresponds to a trial), the command to get the estimates will be estimate <- colSums(trials_10000)/10000.
04

Compare Estimated Probabilities with Original Probabilities

Upon obtaining the estimated probabilities, these should be compared with the original probabilities, i.e., c(.3, .2, .2, .2, .1). The comparison can be done visually by creating a table of the original probabilities and estimated probabilities, or numerically by calculating the absolute difference between the estimated and original probabilities. If the difference between the original and estimated probabilities is smaller, it can be inferred that the estimate is closer to the actual value.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Study anywhere. Anytime. Across all devices.

Sign-up for free