Assume a probability matrix is A(nxm)
, then I want to generate a matrix(B) of random numbers of which each follows Bernoulli distribution with corresponding probability in A
. That means B[i,j] ~ Bernoulli(A[i,j)
. Is there anybody knowing how to do that conveniently in R? I even tried rbinom(n*m,1,B)
, but it didn't work.
↧
About generating matrix of random numbers following Bernoulli distribution with a probability matrix in R
↧