Re: [R] Create Artificial Binary Matrix based on probability

2009-11-03 Thread Erik Iverson
Try matrix(rbinom(100, 1, prob = 0.048), nrow = 10) -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of bikemike42 Sent: Tuesday, November 03, 2009 11:49 AM To: r-help@r-project.org Subject: [R] Create Artificial Binary Matrix

Re: [R] Create Artificial Binary Matrix based on probability

2009-11-03 Thread Mike Treglia
Sent: Tuesday, November 03, 2009 11:49 AM To: r-help@r-project.org Subject: [R] Create Artificial Binary Matrix based on probability Dear All, I am trying to create an artificial binary matrix such that each cell has a probability of 0.048 of having a 1. So far the closest I've come is us

[R] Create Artificial Binary Matrix based on probability

2009-11-03 Thread bikemike42
Dear All, I am trying to create an artificial binary matrix such that each cell has a probability of 0.048 of having a 1. So far the closest I've come is us by using a random poisson distribution with a mean of 0.048, but I can't figure out how to limit the max value to 1. Otherwise that would

[R] Create Artificial Binary Matrix based on probability

2009-11-03 Thread bikemike42
Dear All, I am trying to create an artificial binary matrix such that each cell has a probability of 0.048 of having a 1. So far the closest I've come is us by using a random poisson distribution with a mean of 0.048, but I can't figure out how to limit the max value to 1. Otherwise that would

Re: [R] Create Artificial Binary Matrix based on probability

2009-11-03 Thread Tony Plate
x - matrix(sample(0:1, 1200, replace=T, prob=c(0.952, 0.048)), ncol=30) table(x) x 01 1131 69 x - matrix(sample(0:1, 1200, replace=T, prob=c(0.952, 0.048)), ncol=30) table(x) x 01 1151 49 bikemike42 wrote: Dear All, I am trying to create an artificial binary matrix