search for: mshape2

Displaying 1 result from an estimated 1 matches for "mshape2".

Did you mean: shape2
2012 Aug 27
3
How to generate a matrix of Beta or Binomial distribution
Hi folks, I have a question about how to efficiently produce random numbers from Beta and Binomial distributions. For Beta distribution, suppose we have two shape vectors shape1 and shape2. I hope to generate a 10000 x 2 matrix X whose i th rwo is a sample from reta(2,shape1[i]mshape2[i]). Of course this can be done via loops: for(i in 1:10000) { X[i,]=rbeta(2,shape1[i],shape2[i]) } However, the above code is time consuming. It would be better to directly generate X without any loops. I tried the following code X<- rbeta(2,shape1,shape2) but it looks not right. So I was w...