search for: probvectori

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

2008 Mar 11
0
Generating a new matrix using rbinom and a matrix ofprobabilities.
...nomial distribution where the probability of getting a 1 is the corresponding element in the matrix of probabilities. Example Code: -------------------------------------------- ## First I generate the matrix of probabilities for example purposes. probMatrix <- matrix(NA,5,5){ for (i in 1:5) probVectorI <- runif(5,0,1) probMatrix[i,] <- probVectorI } # Now I want to take each element in probMatrix and use it as the probability parameter in rbinom draw and generate a new matrix. Something like this: binomialMatrix <- rbinom(1,1,probMatrix) # But that does not work. I know I can run a...