1. Other
  2. Other
  3. r1 in class we saw that if a computer is...

Question: r1 in class we saw that if a computer is...

Question details

R1. In class, we saw that if a computer is correctly generating random numbers from the ex ponential distribution, then about 50% of those numbers will be less than the median. In fact, there is nothing special about using the median and 50%. What percent of the random num- bers generated from Exp(X) should be less than the number q > 0? (This does not require the computer to solve.) R2. The goal in this problem is to create something called a P-P plot (youll need the result from R1 at a key place). Heres the idea: We start by choosing (say) 100 values for q evenly spaced between 0 and 10 (qvals). We also generate (say) 100000 random numbers from what R claims is an exponential distribution with (say) λ-1/2. Using a for loop, for each value of q, we calculate what percentage of numbers from the exponential distribution we expect to be less than q (see R1), and also, what percentage of numbers from our list of 100000 that actually are less than q. After doing all this, we plot the 100 expected percentages against the 100 actual percentages Think about what graph we should get before you complete the code and then run the below code. Include a rough sketch of your plot and explain why it is shaped the way it is 1 set.seed (3.1415) # bring our randomnesses into alignment # how many values for q 4 lambda - 1/2 5 qvals # use seq function to help you # set up vector for expected values # set up vector for actual values # how many random numbers to create # make the random nums 6 expectedpercentages - 7 actualpercentages 8 nnums 9 nums- 10 11 for (i in 1:nqs) 12 expectedpercentages[i]- 13 actualpercentages [1]= 14 15 16 plot(

R1. In class, we saw that if a computer is correctly generating random numbers from the exponential distribution, then about 50% of those numbers will be less than the median. In fact, there is nothing special about using the median and 50%. What percent of the random numbers generated from Exp(λ) should be less than the number q > 0? (This does not require the computer to solve.) R2. The goal in this problem is to create something called a P-P plot (you’ll need the result from R1 at a key place). Here’s the idea: We start by choosing (say) 100 values for q evenly spaced between 0 and 10 (qvals). We also generate (say) 100000 random numbers from what R claims is an exponential distribution with (say) λ = 1/2. Using a for loop, for each value of q, we calculate what percentage of numbers from the exponential distribution we expect to be less than q (see R1), and also, what percentage of numbers from our list of 100000 that actually are less than q. After doing all this, we plot the 100 expected percentages against the 100 actual percentages. Think about what graph we should get before you complete the code and then run the below code. Include a rough sketch of your plot and explain why it is shaped the way it is.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution