Question: Using R studio First, a refresher example again. Let's suppose that you roll a fair six-sided die twice and keep track of the larger of

Using R studio

First, a refresher example again. Let's suppose that you roll a fair six-sided die twice and keep track of the larger of the two dice rolls. You then procedure 1000 times, recording the results each time.

keeptrack = NA

for(i in 1:1000){

rolls = sample(1:6, 2, replace = TRUE)

keeptrack[i] = max(rolls)

}

Your turn #1

a) Run the above code, and then find the mean and standard deviation. Also, plot a histogram of the results. Are the results what you expected to find?

b) Change the above code to use a 100-sided die instead of the standard 6-sided die. Run the code again and compare results.

c) Use your 100-sided die again, but this time roll the die 20 times before finding the maximum. How did the results change?

d) Roll your 100-sided die again, using 20 rolls before finding the maximum as before, but this time change the option of replace=TRUE to replace=FALSE. This is the equivalent of replacing your die with 100 cards that have the numbers 1 through 100 on them and choosing 20 without replacement. How does this change the results?

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 Mathematics Questions!