# Re: [R] simulation from truncated poisson

Date: Mon, 16 May 2011 21:19:34 -0600

Another possibility is to find the probability of being in the truncated region, then generate a uniform between that value and 1, then feed that uniform into the qpois function.

From: cassie jones [mailto:cassiejones26_at_gmail.com] Sent: Monday, May 16, 2011 7:46 PM
To: Greg Snow
Cc: r-help_at_r-project.org
Subject: Re: [R] simulation from truncated poisson

It is truncated from left.
On Mon, May 16, 2011 at 6:33 PM, Greg Snow <Greg.Snow_at_imail.org<mailto:Greg.Snow_at_imail.org>> wrote: Which direction is it truncated? (only values less than a allowed or only greater?).

One simple approach is rejection sampling, just generate from a regular poisson distribution, then throw away any values in the truncated region. Another approach if the legal values are those from 0 to a, so that there is a finite number of possibilities, then you can use the sample function with replace=TRUE and using probabilities from the poisson in the legal range.

-----Original Message-----
From: r-help-bounces_at_r-project.org<mailto:r-help-bounces_at_r-project.org> [mailto:r-help-bounces_at_r-project.org<mailto:r-help-bounces_at_r-project.org>] On Behalf Of cassie jones Sent: Monday, May 16, 2011 5:28 PM
To: r-help_at_r-project.org<mailto:r-help_at_r-project.org> Subject: [R] simulation from truncated poisson

Dear all,

I need to simulate values from a Poisson distribution which is truncated at certain value 'a'. Can anyone tell me if there is in-built package in R which can simulate from a truncated Poisson? If not, what should be the steps to write a function which would do that?

Cassie

[[alternative HTML version deleted]]

R-help_at_r-project.org<mailto:R-help_at_r-project.org> mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 17 May 2011 - 03:22:39 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 17 May 2011 - 06:50:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.