BookmarkSubscribeRSS Feed
Kastchei
Pyrite | Level 9
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.
6 REPLIES 6
Peter_C
Rhodochrosite | Level 12
have you looked at CALL RANPOI()
Kastchei
Pyrite | Level 9
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.
ArtC
Rhodochrosite | Level 12
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.
SteveDenham
Jade | Level 19
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
Kastchei
Pyrite | Level 9
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!
Rick_SAS
SAS Super FREQ

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

http://support.sas.com/documentation/cdl/en/imlug/63541/HTML/default/viewer.htm#imlug_genstatexpls_s...

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1310 views
  • 0 likes
  • 5 in conversation