########## # Using the accept-reject algorithm to generate data from beta(2,2) distribution. M<-3/2 N<-10000 v<-runif(N,0,1) ## generating candidate data from a uniform distribution fy.v<-6*v*(1-v) u<-runif(N,0,1) y1<-ifelse(u