simulation from truncated poisson

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

simulation from truncated poisson

cassie jones
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?

Thanks in advance.


Cassie

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: simulation from truncated poisson

Greg Snow-2
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: [hidden email] [mailto:[hidden email]] On Behalf Of cassie jones
Sent: Monday, May 16, 2011 5:28 PM
To: [hidden email]
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?

Thanks in advance.


Cassie

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: simulation from truncated poisson

cassie jones
It is truncated from left.

On Mon, May 16, 2011 at 6:33 PM, Greg Snow <[hidden email]> 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: [hidden email] [mailto:[hidden email]]
> On Behalf Of cassie jones
> Sent: Monday, May 16, 2011 5:28 PM
> To: [hidden email]
> 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?
>
> Thanks in advance.
>
>
> Cassie
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: simulation from truncated poisson

Greg Snow-2
So there is no maximum value, just a minimum (greater than 0)? Correct?  In that case the sample option will not work (unless you choose some really high value and say that you won't go above that), but the rejection sampling would still work.  How efficiently it works will depend on how much probability a regular poisson would put into the truncated region.

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:[hidden email]]
Sent: Monday, May 16, 2011 7:46 PM
To: Greg Snow
Cc: [hidden email]
Subject: Re: [R] simulation from truncated poisson

It is truncated from left.
On Mon, May 16, 2011 at 6:33 PM, Greg Snow <[hidden email]<mailto:[hidden email]>> 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: [hidden email]<mailto:[hidden email]> [mailto:[hidden email]<mailto:[hidden email]>] On Behalf Of cassie jones
Sent: Monday, May 16, 2011 5:28 PM
To: [hidden email]<mailto:[hidden email]>
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?

Thanks in advance.


Cassie
       [[alternative HTML version deleted]]

______________________________________________
[hidden email]<mailto:[hidden email]> 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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: simulation from truncated poisson

cassie jones
Thanks for the help. I appreciate.

On Mon, May 16, 2011 at 10:19 PM, Greg Snow <[hidden email]> wrote:

> So there is no maximum value, just a minimum (greater than 0)? Correct?  In
> that case the sample option will not work (unless you choose some really
> high value and say that you wonÂ’t go above that), but the rejection sampling
> would still work.  How efficiently it works will depend on how much
> probability a regular poisson would put into the truncated region.
>
>
>
> 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:[hidden email]]
> *Sent:* Monday, May 16, 2011 7:46 PM
> *To:* Greg Snow
> *Cc:* [hidden email]
> *Subject:* Re: [R] simulation from truncated poisson
>
>
>
> It is truncated from left.
>
> On Mon, May 16, 2011 at 6:33 PM, Greg Snow <[hidden email]> 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: [hidden email] [mailto:[hidden email]]
> On Behalf Of cassie jones
> Sent: Monday, May 16, 2011 5:28 PM
> To: [hidden email]
> 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?
>
> Thanks in advance.
>
>
> Cassie
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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]]


______________________________________________
[hidden email] 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.