1
$\begingroup$

I want to compare the frequency of retweets between 2 groups of unequal size. I've got the total tweet count and the retweet count for each user. I was hoping the R Cookbook webpage would help but the tests presented there seem to be more suited for repeated measures and equal sample sizes for the two groups: http://www.cookbook-r.com/Statistical_analysis/Frequency_tests/ I will be grateful for advice on what test to use here. My dataset looks a bit like this:

userid tweetCount ReTweetcount Group
1      45        3             A
2      100       25            A
3      23        0             B
$\endgroup$
2
  • $\begingroup$ How unequal? If your smaller group isn't too small, you should be able to find something that works. Are you trying to infer that the difference in your samples reflects a difference in the populations, or just trying to describe the difference in your sample with an effect size statistic? $\endgroup$ Jul 14, 2014 at 11:15
  • 2
    $\begingroup$ N = 7468 and N = 7451, so not very unequal. I guess, in the worst case, I could remove 17 randomly chosen rows from the larger sample to make them equal. If there is a difference, I would like to be able to infer that it reflects a population difference. With the large sample size I have, p value is likely to be low, so I need to look at the effect size. $\endgroup$ Jul 14, 2014 at 12:27

1 Answer 1

1
$\begingroup$

I think most people would consider $N_A=7468,N_B=7451$ to be negligibly unequal for your purpose, and I agree that you're likely to falsify the default null of group equality if there's any difference at all with samples that large. Effect size estimation sounds like the way to go, but you could also use a nonzero value for the null hypothesis if you have some idea of which group is likely to have higher counts than the other (not that I'm particularly enthusiastic about this suggestion – its utility depends on your purposes).

One way to estimate the group difference is by fitting a generalized linear model with a binary dummy predictor representing group membership, e.g., 0=A, 1=B. The regression coefficient would then represent the effect size of the group difference, and you could calculate a confidence interval around that if you like (e.g., using confint). Since your outcome data are counts of events, you could use negative binomial regression (glm.nb in the MASS package for ) to match the error distribution. You could also consider a bootstrap test if you want to go nonparametric.

$\endgroup$
1
  • $\begingroup$ Just realized I didn't even convert my simulated group data to 0s and 1s; glm.nb handled As and Bs just fine. $\endgroup$ Jul 14, 2014 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.