[R] rpois > 0

peter dalgaard pdalgd at gmail.com
Sat Oct 15 16:45:11 CEST 2011


On Oct 15, 2011, at 01:44 , Rolf Turner wrote:

> On 15/10/11 10:15, knut-o wrote:
>> Hello
>> what is the easiest way to generate rpois(m,lambda) but only values greater
>> than 0 and length = m.
>> tanks, knut
> 
> The rpospois() function from the VGAM package is what you are looking for.
> 

Or, 

qpois(runif(m,dpois(0,lambda),1),lambda)

should do the trick.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list