Question

5. For α > 0 and β > 0, consider the following accept-reject algorithm: (1) Generate Ul and U2 iid uniform (0. 1) random variables. Set Vi-Ulla and U11/g ; else go to step l (3) Deliver X. Show that X has a beta distribution with parameter α and β.

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

I have done this problem using R

> rm(list=ls())
> #Generating uniform for Uniform distribution
> u1<-runif(10000,0,1)
> u2<-runif(10000,0,1)
> #now taking alpha(a)=1.2 and beta(b)=1.5
> a<-1.2
> b<-1.5
> #Generating V1 and V2
> v1<-u1^(1/a)
> v2<-u2^(1/b)
> #Generating W
> w=v1+v2
> #Accessing the positions for which w<=1
> pos<-which(w<=1)
> #Accesing v1 and w for which w<=1
> nv1<-v1[pos]
> nw<-w[pos]
> #Prnting how many points under the condition w<=1
> length(pos)
[1] 3532
> #creating Random variable X=V1/W
> x<-(nv1/nw)
> #Plotting the distribution of obtained x
> par(mfrow=c(2,1))
> plot(density(x))

> #Plotting density for beta with parameter alpha=1.2 and beta=1.5 with same
> #length of x
> plot(density(rbeta(length(pos),1.2,1.5)))

> # A view of the generated data.density.default(x x) 0.0 0.2 0.4 0.6 0.8 1.0 N 3532 Bandwidth 0.04522 density.default(x = rbeta(length(pos), 1.2, 1.5)) 凸丈 0.

> head(data.table(u1,u2,v1,v2,w))
u1 u2 v1 v2 w
1: 0.5777117 0.04967083 0.6330325 0.1351246 0.7681571
2: 0.9039229 0.52912337 0.9192694 0.6541911 1.5734605
3: 0.3109522 0.43463077 0.3777850 0.5737821 0.9515671
4: 0.1067732 0.13919905 0.1550191 0.2685906 0.4236098
5: 0.9949222 0.50549031 0.9957667 0.6345637 1.6303304
6: 0.1682814 0.04683880 0.2264801 0.1299383 0.3564184
> head(data.table(nv1,nw))
nv1 nw
1: 0.6330325 0.7681571
2: 0.3777850 0.9515671
3: 0.1550191 0.4236098
4: 0.2264801 0.3564184
5: 0.2086407 0.8312930
6: 0.5256138 0.8683544
> a
[1] 1.2
> b
[1] 1.5
> head(x)
[1] 0.8240925 0.3970135 0.3659480 0.6354333 0.2509834 0.6052988

Conclusion : Density curve obtained by both generated through acceptance rejection algorthim and direct by rbeta() for the parameters alpha=1.2 and beta=1.5 are same hence we can say that x follows beta(alpha,beta)

Add a comment
Know the answer?
Add Answer to:
5. For α > 0 and β > 0, consider the following accept-reject algorithm: (1) Generate...
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