Question: USING R Die outcomes using multiplication You now understand how to simulate the rolling of two six-sided die and how to obtain the sum of

USING R

Die outcomes using multiplication

You now understand how to simulate the rolling of two six-sided die and how to obtain the sum of the two die values. Using the "expand.grid" function in R you calculated the possible outcomes for rolling various combinations of die such as rolling a six-sided die with a four-sided die.

In this activity, you will investigate the outcomes of rolling two four-sided die with one big difference. Instead of adding the two die values to obtain their sum you will multiply the two die values to obtain their product.

Roll the dice!

Modify your die rolling function to return the results of MULTIPLYING the two die values together instead of adding them.

Use your new function to roll two FOUR-SIDED die containing only the values 1, 2, 3, and 4. Replicate 10,000 rolls of the four-sided die and plot the results in a histogram.

Document your code and the histogram in an HTML R Markdown document and submit the HTML file for this assignment.

Hint: Notice that the sample function returns a vector consisting of multiple values. Research how you may access the individual values of an R vector.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!