search for: rbimon

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

Did you mean: raimon
2010 May 23
2
Bernoulli random variable with different probability
...like to generate a variable that takes 0 or 1, and each subject has different probabilities of taking the draw. So, which of the following code I should use ? suppose there are 5 subjects, and their probabilities of this Bernoulli variable is p=c(0.2, 0.9, 0.15, 0.8, 0.75) n<-5 Ber.var <- rbimon(n,1,p) ## I doubt if this will take the first probability, which is 0.2, but won't change for each subject ?? ## or should I use Ber.var <- sample(c(0,1), n, prob=p, replace=TRUE) Or any suggestions on how I can check if the probability of drawing this binary variable is based on the subje...