Please use SAS programming. Do not use an array. Please provide the code, answer, and explanation.
Find answers to the following questions by simulation using SAS (use rand('uniform') to generate random numbers). You must provide a final answer once you have observed the output from SAS and give reasons for your answers. That is if there is convergence, why and what is the final answer. However, if there is divergence, why.
2. A one unit stick is broken randomly into two pieces.
a) Find the expected value of (the short piece divided by the long piece).
b) Find expected value of (the long piece divided by the short piece).
(a)
for (trails=0 ; trails<10000000; trails++) (L=rand(); // break the stick anywhere between 0 and 1 if (L>1/2) sum+=L; else sum+=1-L; // select the long piece)
print trails '' ''sum '' '' sum/trails;
10000000 7.50006 e +006
0.750006
(b)
for (trails=0 ; trails<10000000; trails++) (S=rand(); // break the stick anywhere between 0 and 1 if (S<1/2) sum+=S; else sum+=1-0.750006; // select the short piece)
print trails '' ''sum '' '' sum/trails;
10000000 2.50006 e +004
0.250004
ANSWERED PLEASE RATE ME POSITIVE THANKS
Get Answers For Free
Most questions answered within 1 hours.