Statistical Test to Compare Count Data I need to compare two vectors containing count data with different sample sizes.
The example problem is the following:
I have experiment on two groups of people that eat some number of apples until Experiment Day 50.
Group_1 = c(10, 11, 17, 20, ..., 12); N=40
Group_2 = c(11, 21, 17, 20, ..., 24); N=63

How can I compare these two groups of count data?
Is there better approach than just comparing the means or medians for two groups (T test, Mann-Whitney test)?
Thanks
 A: I think one option would be to fit a generalized linear model with famility distribution Poisson or, to allow extra variation above the Poisson, negative binomial. From the model fit you can check what is the difference between Group1 vs Group2. For example, in R using negative binomial GLM:
library(MASS)

set.seed(1)
Group_1 = rnbinom(n= 40, mu= 20, size= 30)
Group_2 = rnbinom(n= 63, mu= 25, size= 30)

dat <- data.frame(group= rep(c('g1', 'g2'), c(length(Group_1), length(Group_2))), 
    count= c(Group_1, Group_2))

fit <- glm.nb(data= dat, count ~ group)
summary(fit)

Call:
glm.nb(formula = count ~ group, data = dat, init.theta = 37.80452487, 
    link = log)

Deviance Residuals: 
     Min        1Q    Median        3Q       Max  
-2.63992  -0.86535   0.01778   0.78150   2.38985  

Coefficients:
            Estimate Std. Error z value Pr(>|z|)    
(Intercept)  3.03855    0.04311  70.476   <2e-16 ***
groupg2      0.13486    0.05425   2.486   0.0129 *  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for Negative Binomial(37.8045) family taken to be 1)

    Null deviance: 109.63  on 102  degrees of freedom
Residual deviance: 103.43  on 101  degrees of freedom
AIC: 665.37

Number of Fisher Scoring iterations: 1


              Theta:  37.8 
          Std. Err.:  14.1 

 2 x log-likelihood:  -659.372

