[R] comparing poisson distributions

Greg Snow Greg.Snow at imail.org
Thu Dec 20 21:19:44 CET 2007


There are a few different options that you can try depending on your
problem and your preferences:

1.  For large lambda the poisson can be approximated by a normal, for
large n (even for small lambda) the mean is approximately normal due to
the central limit theorem.  So if your lambda and n are large enough in
combination then you could just do a standard 2 sample t-test (t.test
function) and use the approximate p-value from there.

2.  Fit 2 models by maximum likelihood, one in which both lambdas are
equal and one in which they can differ (fitdistr from MASS may help, or
look at optim and friends), then do a likelihood ratio test on the
differences (-2 * likelihood diff is approx chisquared(1) under the
null).

3.  Do a permutation test:  find the difference in the
means/medians/(other stat of interest) between the 2 samples, then
permute the samples randomly (create 2 samples of the same sizes from
the original data values, but with random assignment as to which group a
value goes into) and find the same difference, repeate a bunch of times
(like 1998) and combine all the differences found into a vector, plot
the histogram of the values and look at where the original difference
fits into the distribution.  The number of values that are as or more
extreeme than the original value is your p-value.

4.  Create logical bins for values (e.g. 0-1, 2-3, 4-6, 7+) and count
how many from each group fall in each bin, use prop.test or chisq.test
to see if the proportions differ.

5.  Probably some others that don't come to mind right now.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
(801) 408-8111
 
 

> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of Mark Gosink
> Sent: Tuesday, December 18, 2007 12:31 PM
> To: r-help at r-project.org
> Subject: [R] comparing poisson distributions
> 
> Hello all,
> 
>             I would like to compare two sets of count data 
> which form Poisson distributions. I'd like to generate some 
> sort of p-value of the likely-hood that the distributions are 
> the same. Thanks in advance for your advice.
> 
>  
> 
> Cheers,
> 
> Mark
> 
>  
> 
> Mark Gosink, Ph.D.
> 
> Head of Computational Biology
> Scripps Florida
> 5353 Parkside Drive - RFA
> Jupiter, FL  33458
> tel: 561-799-8921
> fax: 561-799-8952
> gosink at scripps.edu
> 
>  
> 
> 
> 	[[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.
> 



More information about the R-help mailing list