Hello what is the easiest way to generate rpois(m,lambda) but only values greater than 0 and length = m. tanks, knut -- View this message in context: http://r.789695.n4.nabble.com/rpois-0-tp3906239p3906239.html Sent from the R help mailing list archive at Nabble.com.
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, knutThe rpospois() function from the VGAM package is what you are looking for. I found this by doing: RSiteSearch("truncated Poisson") and scrabbling through the results a bit. [Give a man a fish and you feed him for a day. Teach a man to fish ... and you destroy an eco-system. :-) ] cheers, Rolf Turner
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