Displaying 1 result from an estimated 1 matches for "binomialmatrix".
2008 Mar 11
0
Generating a new matrix using rbinom and a matrix ofprobabilities.
...ities 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 loop across each vector
of the matrix, but this seems like an bad way to do this.
---------------------------End Code--------------------------------
So any help would be appreciated.
Thanks,
EG
________________________...