Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The Geometric Probability Distribution 8; Weak Law of Large Numbers A random variable with the geometric probability distribution is associated with an experiment that shares
The Geometric Probability Distribution 8; Weak Law of Large Numbers A random variable with the geometric probability distribution is associated with an experiment that shares some of the characteristics of a binomial experiment. This experiment also involves identical and independent trials, each of which can result in one of two outcomes: success or failure. The probability of success is equal to p and is constant from trial to trial. However, instead of the number of successes that occur in in trials, the geometric random variable is the number of trials on which the rst success occurs. The geometric probability distribution is often used to model distributions of lengths of waiting times. Let us roll a K sided die with numbers 1, . . . , K written on them where K > 1. Each number is equally likely to be rolled. Let X be a random variable representing the number of rolls needed to get the number K for the rst time. (Note: number of rolls includes the roll where K appears.) 1. 2. 3. On any roll, what is the probability of rolling the value K '3' \"That are all of the possible values of X? Create a function with arguments, K and simulations, with simulations representing the number of times we should play out this scenario. Your function should return the number of times the die was rolled in order to get the value K. {Helpful hint: Try using a while loop) . For K = [2, 6, 12, 15] simulate 100 rounds of the scenario and plot each set of results with a bar graph. . Repeat question 4 by simulating 100 new rounds of each scenario and plot the results. Have your results changed? Please explain how they have changed. Why might your results be dierent? . For each combination of 'simulations = [100, 1000, 5000, 20000] and K = [2, 6, 12, 15] calculate the average number of rolls required to get K. Show these results in a table where your columns are values of n_sim and your rows are values of K. . How would you describe a general formula for calculating the average number of rolls? . For K = 6 and simulations = 1000, estimate the following probabilities using your simulation function: 1 2 3 4 5 6 TorG-reater _------ 9. In theory, is the probability P{X = 500) > 0 when K = 6? Explain. 10. Given that the probability mass function for the a. geometric distributed random variable X is 21 P{X = a") = P[Fo,Faif, ...,Fa, Success) = qq...q;p = qm'lp Use the functions dgeomO and pgeomO to calculate the probabilitll in question 8. For the : arguments, enter the outcomes x-1 and your answer for #1 for the argument prob. (Hint: Check ?dgeorn if you need help) 11. Create a gure with two plots side by side: The rst plot of the empirical probability mass function estimate based on the data simulated in #8 (histogram is acceptable - use prob=TRUE}. The second plot should plot the theorical probability mass function for our data in #10. 12. 13. 14. 15. 16. How close are your answers from your simulation to the probabilities from the geometric distribution you just created? Describe this given what we've learned about the Weak Law of Large Numbers in lecture 8. 1What parameters need to change in our function in order for our empirical probabilities to match the theoretical values for {X = I) For K = E, and simulations = [1 - 5000] (Hint: use a for loop) plot the mean of each sample as a line graph. Add a horizontal line at the theorical mean {6). 'What is your observation of this relationship between n_sim and the mean of our sample? If your code tallies longer than 5 minutes to run you may reduce the simulations to a lower number. For X = 6, what is the probability that it takes more than 12 rolls to roll a B? For K = fl, what is the probability that you roll a E in your rst three rolls? For K = 6, what is the 95th percentile for number of rolls. required to roll a 6'? The Exponential Probability Distribution & Central Limit Theorem The magnitude of earthquakes in North America can be modeled as having an exponential distribution with mean & of 2.4. For an exponential distribution: Mean: E[X] = > Variance: E[X] - (E[X])? = 12 18. Simulate 1000 earthquakes and plot the distribution of Richter Scale values (Hint: rexp (x, rate = 1/lambda)). Let this data represent X. Create a histogram of X and describe the shape of this distribution. How does this differ from the normal distribution? 19. Find the probability that an earthquake occurring in North America will fall between 2 and 4 on the Richter Scale. 20. How rare is an earthquake with a Richter Scale value of greater than 9? 21. Create a function which will simulate multiple independent samples drawn from an exponential distribution with A = 2.4 (Hint: rexp(x, rate = 1/lambda) and return a vector containing the mean values for each of your samples. Your arguments should be lambba to represent the population mean of our exponential distribution, n to represent the sample size of each independent sample (Hint: rexp(n, rate = 1/lambda), and simulations to represent the number of independent samples of size n to be created. The output of your function should be a vector containing the mean values for each sample and therefore should be a vector with a length equal to simulations. This function will create the sampling distribution of X for a given sample size (n). 22. Use your function with arguments lambda = 2.4, simulations = 1000, n = 40 to create a vector of sample mean values of Richter Scale readings. Let X represent this data. Plot a histogram of the data. Describe the distribution of X. Is X distributed differently than X? 23. Calculate the sample mean and sample variance for the data simulated in #18. Calculate the population variance given A = 2.4. 24. Create a plot of X. Make sure to set prob=TRUE in the hist () function. Include vertical lines for the sample and theoretical mean values (red = sample mean, blue = theoretical mean). 25. Add lines to our plot of X to plot the density for both our simulated sample and theoretical population (Hint: use dnorm (x, mean=lambda, sd=(lambda/sqrt (n) ) to calculate theorical population density). Make sure to set prob=TRUE in the hist () function. See the example plot below for guidance:Normal Distribution and Simulation Results Simulation Theoretical Density of Averages 0.0 0.1 0.2 03 04 0.5 0.6 Averages of Exponential Samples 26. The Central Limit Theorem states that if you take many repeated samples from a population, and calculate the averages or sum of each one, the collection of those averages will be normally distributed. Does the shape of the distribution of X matter with respect to the distribution of X7 Is this true for all any parent distribution of X? 27. What will happen to the distribution of X if you re-run your function with arguments lambda = 2.4, simulations = 10000, n = 407 How does the variance of X change from our data simulated for X in #257 Create a figure with the histograms (prob TRUE) for both of our X sampling distributions. Explain the difference in the two distributions of X (simulations = 1000, simulations = 10000). 28. Now explore what will happen to the distribution of X if you re-run your function with arguments lambda - 2.4, simulations = 10000, n = 107 How does the variance of X change from our data simulated for X in #257 Create a figure with the histograms (prob TRUE) for our X sampling distributions (n = 40, n = 10). Explain the difference in the two distributions of X 29. In 3-4 sentences, summarize your findings for questions 26-28. What role does n (sample size) play in the variance of X? EXTRA CREDIT: Choose a probability distribution that we have not studied in class and repeat the above exercises
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