Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a R Studio question. # Flip a coin three times, heads is 1, tails is zero flips = sample(x = C(O. 1), size

This is a R Studio question.

image text in transcribed
# Flip a coin three times, heads is 1, tails is zero flips = sample(x = C(O. 1), size = 3, replace = T) # Calculate the number of times it landed heads sum_flips = sum(flips) # If it landed on heads more than zero times execute the code in brackets if (sum_flips > 0) { # Roll die sum_flips times rolls sample(1:6, size = sum_flips, replace # Add up the different rolls sum_rolls = sum(rolls) } else { # If it didn't land on heads, let sum_flips be zero sum_rolls = 0 } # Store sum_flips and sum_rolls in a data set sim_results data.frame(sum_flips, sum_rolls) T) Modify the code using a for-loop to simulate that process 100,000 times. (a) Use the results to approximate the answers to question 4. In other words, using the results of your simulation, nd an approximation of the following probabilities if the sum of the rolls of the dice add up to four. i. Probability that the coin landed on heads once ii. Probability that the coin landed on heads twice iii. Probability that the coin landed on heads three times iv. Expected value of the number of times the coin landed on heads. (1)) Now approximate the same values if the rolls of the dice added up to twelve instead of four

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

College Geometry Using The Geometer's Sketchpad

Authors: Barbara E Reynolds, William E Fenton

1st Edition

1118213408, 9781118213407

More Books

Students also viewed these Mathematics questions

Question

8. What values do you want others to associate you with?

Answered: 1 week ago