bnldev: should result decrease if n increases?


KevinKillion
03-10-2005, 10:48 AM
bnldev(pp, n, idum) -- returns a random deviate representing the number of successes, when drawing n trials each of probability pp.

Suppose pp = 0.2, n = 20. Then we might expect somewhere around 4 successes. Successive calls to bnldev might return: 3, 6, 2, 5, 4, 2, ...

BUT!! Suppose that we re-initialize the random number generator between each call, and instead try successive values of n. That is, for the SAME sequence of random numbers, how many successes do we observe in 20 trials, 21 trial, 22 trials?

What I found was that, even with re-initing the random numbers between calls, bnldev could return such things as:
20 trials --> 3 successes
21 trials --> 1 success

I have an application where I need to project (for each of a series of people) the number of successes for x trials and x+1 trials. I do not want the numbver of successes to decline for a person when an additional trial is added!

Is there a tweak necessary in bnldev, or is it operating as expected? If operating as expected, are there any other algorithms to do a binomial draw like this that would not have this behavior?

THANK YOU!