logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Pankaj ThrejaComputer science
(5/5)

683 Answers

Hire Me
expert
Laurence FarrellStatistics
(5/5)

1000 Answers

Hire Me
expert
Dayanara AliPolitical science
(5/5)

607 Answers

Hire Me
expert
Max ManuelaMarketing
(5/5)

863 Answers

Hire Me
R Programming
(5/5)

Write a function to investigate this question. Your function should have two inputs k = the number of sides on your die and N = the number of iterations for your function.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

INTRODUCTION TO PROBABILITY AND SIMULATION

Here’s what you must turn in:

• Your answers to the questions on the second page, typed hardcopy.

• Your R script, typed hardcopy.

• A written explanation of how your functions work, typed hardcopy.

• Your R script

• You should submit a single R script that includes your functions followed by all commands you had to execute to get your numerical results. I will run your script, and I should get back similar results that are sufficient to answer all of the questions in this assignment.

Suppose you have a standard, fair, 6-sided die. You’re going to roll it again and again until all 6 sides have come up at least once. How long will this take, on average? More generally, if you have a fair k-sided die (or cards marked 1 through k that you’re sampling with replacement), what’s the expected number of tries required to see all k numbers?

Write a function to investigate this question. Your function should have two inputs: k = the number of sides on your die, and N = the number of iterations for your function. Your function should have a single output: a vector of N simulated values of the random variable X= number of rolls required to see all k sides.

Use your program to answer the following.

1. Assume k = 6. Create a histogram of at least 10,000 values of the variable X = number of rolls to see all k sides.

2. Construct and interpret in context a 95% confidence interval for the expected value of X, µ = E(X), when k = 6.

3. Construct and interpret in context a 95% confidence interval for the true standard deviation of X, σ = SD(X), when k = 6.

4. Construct and interpret in context a 95% prediction interval for a single future value of X.

Now you’re going to investigate how the mean of X grows with k. It should be obvious that the mean of X is at least k, since X itself is at least k (do you see why?). But is the mean of X something like 2k? 3k? k2?

To find out, run your program for k = 1, 4, 9, 16, 25, 36, 49, 64 (with just N = 1000 runs for each distinct k; otherwise, it’ll take a really long time). For each run of 1000, record the sample mean x . You will need those eight x values for question 5.

5. For k = 1, 4, …, 64, plot ( x ÷ k) versus k, with ( x ÷ k) on the vertical axis and k on the horizontal axis. If you use the plot function in R with the option type="l", you should get a graph with your eight (k, x ÷ k) points connected by line segments — that’s what I want.

A plot like the one you just made can help us understand the growth rate of the mean of X. For example, if the mean grows linearly with k (like 2k or 3k), then x ÷ k is a constant and your graph should be essentially flat. On the other hand, if the mean is quadratic in k, then ( x ÷ k) should be roughly linear.

6. Based on your plot, do you think the mean of X grows linearly with k, quadratically with k, or something else? Use my explanation above to justify your answer.

There’s one last part, and this will require either modifying your original function or writing a new one.

7. Define Y = the number of rolls of a fair six-sided die required to see all six sides at least twice. Repeat 1-4 for the random variable Y.

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme