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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started