Exercises for Chapter 2.2

Exercises for Chapter 2.2#

Exercise 2.7

Write R code to simulate the num_outcomes outcomes of rolling two six-sided dice and store the results as tuples. Additionally, display the simulated outcomes in tuple format.

Exercise 2.8

Develop a Microsoft Excel spreadsheet to simulate the outcomes of rolling two six-sided dice. Additionally, format the spreadsheet to display the simulated outcomes in tuple format, with the outcomes of the first die in Column A, the outcomes of the second die in Column B, and the outcomes in tuple format in Column C.

Exercise 2.9

Define the sample space for the sum of the results from rolling two six-sided dice. Additionally, include R code to simulate simulate the num_outcomes outcomes of this experiment.

Exercise 2.10

Calculate the theoretical probability of each outcome resulting from rolling two six-sided dice and summing the results.

Exercise 2.11

Write R code to verify the theoretical probability of each outcome obtained from rolling two six-sided dice and summing the results.

Hint: Consider using the replicate() function to simulate rolling two six-sided dice and summing the results multiple times. You can then compare the frequencies of the simulated outcomes to the theoretical probabilities. Here’s an example of how to use the replicate() function:

# Example of using replicate() function
num_simulations <- 1000

simulated_outcomes <- replicate(num_simulations, sum(sample(1:6, 2, replace = TRUE)))

Exercise 2.12

Create an Excel spreadsheet to simulate the results of rolling two six-sided dice and summing their outcomes. Additionally, confirm the theoretical probability of each outcome resulting from this process.