Re: [R] comparing poisson distributions

From: Greg Snow <Greg.Snow_at_imail.org>
Date: Thu, 20 Dec 2007 13:19:44 -0700

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.
>
______________________________________________ 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.
Received on Thu 20 Dec 2007 - 20:22:31 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 20 Dec 2007 - 22:30:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.