Question: Solve in RStudio: Consider the following problem: we roll a D6 (6-sided) die and a D8 (8-sided) die simultaneously. We want to simulate the probability
Solve in RStudio:
Consider the following problem: we roll a D6 (6-sided) die and a D8 (8-sided) die simultaneously. We want to simulate the probability that the sum of results will be greater than 10. To do that in R we can create a random vector (of length n) of simulated rolls for each of the dice (e.g. for a D6 die it could be done like this: D6 <- floor(runif(n, 1, 7)), add those vectors to one another and calculate what percentage of simulated sums (D6+D8) is greater than 10.
1. We roll a D6 die and a D8 die simultaneously. Estimate (simulate) the probability that the sum of results will be greater than s = 10. Use n = 10000 simulated results.
2. Use a for loop to approximate the probability from point 1 for n = 1; 2; :::; 1000. Present your results on a line plot.
3. We roll a Da (a-sided) die and a Db (b-sided) die simultaneously. Write a function that will allow you to estimate the probability that the sum of results will be greater than s, for any positive integers a, b, s, n.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
