turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Function to Return Poisson Parameter

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-20-2011 02:21 PM

Hello!

The functions POISSON(λ,x) and CDF('POISSON',x,λ) return the value of P(X > x | X ~ Poisson(λ)) given the value of the parameter, λ, and the observed count, x, are input.

I would like to do somewhat the opposite: given a probability, p, and an observed count, x, is there a function that will return the value of λ?

Thanks.

The functions POISSON(λ,x) and CDF('POISSON',x,λ) return the value of P(X > x | X ~ Poisson(λ)) given the value of the parameter, λ, and the observed count, x, are input.

I would like to do somewhat the opposite: given a probability, p, and an observed count, x, is there a function that will return the value of λ?

Thanks.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Kastchei

06-21-2011 05:06 AM

have you looked at CALL RANPOI()

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Peter_C

06-21-2011 04:36 PM

Thanks for the tip Peter C. However, when I looked at the call, it returns random numbers from a Poisson distribution. I am looking for something to return the parameter of a Poisson distribution that matches certain criteria.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Kastchei

06-22-2011 01:52 AM

I think you may be looking for the QUANTILE function.

[pre]

data a;

m=1;

n=2;

x = poisson(m,n);

y=quantile('POISSON',x,m);

put x= y=;

run;

[/pre]

There used to be a series of probability and inverse prob functions. Although some are still documented most have been supplanted by the more powerful PDF, CDF, and QUANTILE functions.

[pre]

data a;

m=1;

n=2;

x = poisson(m,n);

y=quantile('POISSON',x,m);

put x= y=;

run;

[/pre]

There used to be a series of probability and inverse prob functions. Although some are still documented most have been supplanted by the more powerful PDF, CDF, and QUANTILE functions.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to ArtC

06-22-2011 07:44 AM

This still returns the x value in the OP. I believe he is looking to return lambda (or m in this example).

The problem is that m is the solution for a cumulative sum of the following type:

probability = sum (i from 0 to n) {exp (-m) * (m**i) / i!}

I can only guess that some sort of grid search/optimization scenario would be able to do this on a general basis.

SteveDenham

The problem is that m is the solution for a cumulative sum of the following type:

probability = sum (i from 0 to n) {exp (-m) * (m**i) / i!}

I can only guess that some sort of grid search/optimization scenario would be able to do this on a general basis.

SteveDenham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SteveDenham

06-22-2011 10:59 AM

Yes, Steve, this is what I was hoping for. I thought maybe SAS had a numerical algorithm already in place to find this. I guess I can write a macro though.

Thanks!

Thanks!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Kastchei

06-28-2011 02:45 PM

This is a root-finding problem. Define

f(lambda) = target - cdf("poisson", n, lambda);

and solve for the zeros of f. This is always possible (and has a unique solution) because the CDF is an increasing function of lambda. (Of course, 0<target<1).

To solve the problem, find a root-finding algorithm such as the bisection method implemented in SAS. (I believe that the %inv macro at

http://ftp.sas.com/samples/A57496 gives you what you need; Although it is written as a macro, you ought to be able to decipher it.)

If you have SAS/IML, see