Question

4 Sampling, Scoring, and Precision 96 8. Verify by calculation the following rejection technique for sampling values of x dis

Exploring monte carlo method example

0 0
Add a comment Improve this question Transcribed image text
Answer #1

I have generated random numbers p1, p2 , p3 in the range of 0 to 1. I did this exercise in excel and since I can not attach excel sheets, I gave a detailed explanation of how to get the efficiency number in excel below.

Step 1: Generating random sample of x and y values

Generate random number p1 and p2 between 0 and 1, by using the function rand()

Next get x and y values as -ln(p1) and -ln(p2) respectively. Excel has 'ln' function to get x and y values

Step 2 : Validating the condition between sample X and Y values

We can go to next step if the following condition holds otherwise we consider this sampling as failure and  will repeat the first step to get new samples of x and y values.

Condition : y>=0.5*(x-1)^2

Step 3: Getting final X value

Generate random number p3. if p3 >0.5 then x value remains same otherwise assign x to the negative sign.

Step 4: Calculating efficiency

Efficiency is ratio of samples which satisfy the condition in step-2 and total number of sample generated .

Following are the formulas to generate the sample in excel:

p1 p1 x y condition p3 final x value
=RAND() =RAND() =-LN(C5) =-LN(D5) =IF(F5>=0.5*(E5-1)^2,1,0) =IF(G5=1,RAND(),-99) =IF(G5=0,-99,IF(H5<=0.5,-1*E5,E5))

if the condition holds true it will be assigned value of 1 otherwise 0. if the condition does not hold true I'm assigning value of -99 to p3 and final x values otherwise I calculate the p3 and final x values as mentioned above.

After simulating for 1000 sample i get the count of final x values with not equal to -99 value (good samples), and divide it by 1000 (total number of samples) to get the efficiency. Final efficiency i got was 0.764

Add a comment
Know the answer?
Add Answer to:
Exploring monte carlo method example 4 Sampling, Scoring, and Precision 96 8. Verify by calculation the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT