Next: rsample() Up: MacAnova Help File Previous: rowplot()   Contents


rpoi(n,lambda), n positive integer, lambda scalar >= 0 or non-negative
  vector of length n.

Keywords: random numbers
rpoi(N,lambda) generates a vector of N independent Poisson pseudo-random
variables with mean lambda.  N must be a positive integer.

lambda must be a REAL scalar >= 0 or a REAL vector of length N with
lambda[i] >= 0.  If lambda is a scalar, it is used for every element of
the result.  Otherwise, element of the result will be Poisson with mean

When used together with invgamma(), rpoi() can be used to generate
pseudo-random negative binomial random variables.

  Cmd> y <- rpoi(N, m*invgamma(runi(N),alpha)) # m > 0, alpha > 0

will generate negative binomial random variables with shape or index
alpha and mean alpha*m, with probabilities
 p[y=x]={(1-m)^alpha}*alpha*(alpha+1)...*(alpha+x-1)*m^x/x!, x=0,1,... .

If the random number generator has not been initialized by setseeds(),
setoptions() or previous use of rbin(), rnorm(), rpoi() or runi(), the
generator's "seeds" will be initialized automatically using the current
time and date, and their values will be printed out.

The algorithm is based on C. D. Kemp and A. W. Kemp, Appl Statist 40
(1991) 143-158.

See also setseeds(), getseeds(), setoptions(), runi(), rnorm(), rbin(),
invgamma(), cumpoi(), subtopic 'options:"seeds"'.

Gary Oehlert 2003-01-15