Question

6. Give an algorithm to generate values from the distribution with pdf (2 - x)/(0,2)(a). Be specific and write out all steps.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

fix) 3 x. (2x). 0(222 let x tat) then oct<l... dad: dt., 1.1. L of (t) 3:2+ (2-2t). 2. dt. :,1 DE E(+) ö Octice flt) = .68

Will generate 100 samples from Beta (2,2) in R and then it will be multiplied by 2.

Function to draw random number from beta in R is rbeta( )

 t=rbeta(100,2,2) x=2*t x

Output is,

 [1] 1.5582783 1.6039734 1.2201315 1.4405282 1.5007335 1.3370944 0.8708103 [8] 0.8098790 1.5731602 0.7457258 0.9854792 0.7353379 0.6074758 0.2908834 [15] 0.7869355 1.5257643 1.0475687 0.5529783 0.5456791 0.6802026 0.6092636 [22] 0.9126117 0.5627589 0.7198942 1.5154912 0.8201053 0.9097525 0.9484670 [29] 1.2356291 0.5428112 1.0959315 0.3699838 1.1217686 0.3939439 0.5579835 [36] 1.6988901 1.0752203 1.3584601 0.7216062 0.3656002 0.7987595 0.9680716 [43] 1.4226405 1.6125100 1.1151312 0.8845204 1.2896969 1.9116699 0.6925500 [50] 1.7111937 0.5341476 0.7082916 1.3114769 0.8973720 1.7350655 1.1170240 [57] 1.5814704 0.8235949 0.9456731 0.7143550 1.4872364 0.7650228 0.3804932 [64] 0.7327053 0.9053093 0.7383733 0.5910263 0.3845381 0.8107306 0.5313765 [71] 1.2690471 1.1899929 0.7925245 1.3675230 0.9941857 0.8575182 1.1348649 [78] 1.0741182 1.3468594 0.8690843 1.4056383 1.3618515 1.2447546 0.7114879 [85] 1.0075237 1.8290382 1.0219989 0.7888365 0.6346732 0.3790619 0.9426859 [92] 0.6868371 0.4009776 0.3544348 0.6614919 0.2907846 1.2991316 0.6920730 [99] 1.2696694 1.5963454

See all the values are between 0 and 2.

Add a comment
Know the answer?
Add Answer to:
6. Give an algorithm to generate values from the distribution with pdf (2 - x)/(0,2)(a). Be...
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