Re: [R] Sum of binominal distributed random numbers

2007-10-23 Thread Charles C. Berry
?rbinom only says: size: number of trials (zero or more). prob: probability of success on each trial. But they can be vectors. BTW, you were aked to "PLEASE ... provide minimal, self-contained, reproducible code." What you show cannot run without correction. Most likel

[R] Sum of binominal distributed random numbers

2007-10-23 Thread Rainer M Krug
Hi I have two vectors, prob and size, and I want to add the random deviates of these two, i.e. sum( sapply( 1:length(prob), function(n){ rbinom(1, size(n), prob(n) } ) ) My problem is that I have to do this for a large number of value combinations. Is there a