Reference no: EM132492305
Assignment -
Part 1 - R Studio code & Results for the following: Generate a set of 1000 pairs of standard Uniform Random values R1 & R2. Then perform the following algorithm for each of these 1000 pairs: Let the output of this algorithm be denoted by Y.
Step 1: Generate random values XX11 = -LLLL(rr11) and XX22 = -LLLL(rr22)
Step 2: Calculate kk = (xx11 - 11)22. If xx22 ≥ kk, then generate a random number rr.
If rr > 00.5522 accept xx11 as YY (that is, let YY = xx11); otherwise if rr ≤ 00.55, else accept -xx11 as YY (that is, let YY = -xx11).
If xx22 < kk, no result is obtained, and the algorithm returns to step 1. This means that the algorithm skips the pair rr11 and rr22 for which xx22 < KK without generating any result and moves to the next pair rr11 and rr22.
After repeating the above algorithm 1000 times, a number N of the Y values will be generated. Obviously NN ≤ 1100, 000000 since there will be instances when a pair rr11 and rr22 would not generate any result, and consequently that pair would be wasted.
Investigate the probability distribution of YY by doing the following:
1. Create a relative frequency histogram of YY.
2. Select a probability distribution that, in your judgement, is the best fit for YY.
3. Support your assertion above by creating a probability plot for YY.
4. Support your assertion above by performing a Chi-squared test of best fit with a 0.05 level of significance.
Part 2 - In the algorithm of Part 1, there are instances when the generated random values do not satisfy the condition xx22 ≥ kk In order to obtain an acceptable value for YY. In such cases, the algorithm returns to step 1 and generates another two values to check for acceptance. Let MM be the number of iterations needed to generate NN of the accepted YY values (MM ≥ NN). Let WW = MMNN.
(For example, suppose that the algorithm has produced 700 YY values (NN = 770000) after 1000 iterations (MM = 11000000). Then WW = 11000000 = 11.4433. This means that it takes the algorithm 770000 1.43 iterations to produce one output. In fact, WW itself is a random variable. Theoretically, EE(WW) - the expected value (i.e., average) of WW - of an algorithm is a measure of efficiency of that algorithm.)
Investigate WW by the following sequence of exploratory data analytic methods:
1. Estimate the expected value and the standard deviation of WW.
2. Select a probability distribution that, in your judgement, is the best fit for WW.
3. Support your assertion above by performing a Chi-squared test of best fit with a 0.05 level of significance.
4. As the number of iterations MM becomes larger, the values WW will approach a certain limiting value. Investigate this limiting value of WW by completing the following table and plotting WW versus MM. What value do you propose for the limiting value that WW approaches to?
M
|
W
|
10
|
|
20
|
|
30
|
|
40
|
|
50
|
|
60
|
|
70
|
|
80
|
|
90
|
|
100
|
|
200
|
|
300
|
|
400
|
|
500
|
|
600
|
|
700
|
|
800
|
|
900
|
|
1000
|
|
Note - No paper needed, just the R Studio code and results & explanation for each step. ONLY r code and results required.