The ppois(q, lambda, ...other options...) in R has similar syntax to the SAS
function POISSON(m,n) (see POISSON in the SASv8 online doc).
1) q = n
2) lambda = m (= mu).
It's not obvious to me how you deal with an alpha in SAS other than by
observation, i.e., for a given mu and alpha does the cumulative prob of an
observation exceed alpha or not. In R you can get the n corresponding to a
given alpha by using qpois.
from the R console:
> #the mean is assumed to be 1.2
> lambda<-1.2
> #the Poisson cdf for q = 0 to 10
> ppois(0:10,lambda)
[1] 0.3011942 0.6626273 0.8794871 0.9662310 0.9922542 0.9984998 0.9997489
0.9999630 0.9999951 0.9999994 0.9999999
> #if the observed y is 1 and the mean is 1.2 the cumulative probability is
> ppois(1,1.2)
[1] 0.6626273
>
Similar SAS output:
73 data _NULL_;
74 *the mean is assumed to be 1.2;
75 lambda = 1.2;
76 do y = 0 to 10;
77 upper = 1-poisson(lambda,y);
78 lower = poisson(lambda,y);
79 put "lower.tail=" lower "upper.tail=" upper "y="y;
80 end;
81 run;
lower.tail=0.3011942119 upper.tail=0.6988057881 y=0
lower.tail=0.6626272662 upper.tail=0.3373727338 y=1
lower.tail=0.8794870988 upper.tail=0.1205129012 y=2
lower.tail=0.9662310318 upper.tail=0.0337689682 y=3
lower.tail=0.9922542117 upper.tail=0.0077457883 y=4
lower.tail=0.9984997749 upper.tail=0.0015002251 y=5
lower.tail=0.9997488875 upper.tail=0.0002511125 y=6
lower.tail=0.9999630211 upper.tail=0.0000369789 y=7
lower.tail=0.9999951412 upper.tail=4.8588287E-6 y=8
lower.tail=0.9999994238 upper.tail=5.7615681E-7 y=9
lower.tail=0.9999999378 upper.tail=6.2236183E-8 y=10
NOTE: DATA statement used:
real time 0.01 seconds
cpu time 0.01 seconds
Note that the upper tail is prob > y and not prob of >= y.
good luck
bob
-----Original Message-----
From: Mark St.John [mailto:[EMAIL PROTECTED]
Sent: Friday, January 09, 2004 10:12 AM
To: [EMAIL PROTECTED]
Subject: [R] Poisson distribution help requested
Could somebody help me to understand the syntax of R's ppois function? I'm
looking to calculate the cumulative probability density of an observed value
(y) given the expected mean (mu) and the level of significance (alpha). I'm
coming from using SAS to do this and don't recognize the descriptions of the
arguments for ppois. The definitions of lambda and p as stated in the R
manuals are foreign to me!
Thanks, Mark
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
[[alternative HTML version deleted]]
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html