I have a question about how to make a comparison between the aggregate values of two experimental groups.
Say that in an experiment with a control group and a treatment I collect the number of times that individuals have performed a certain action. The data I collect are the following (in R code):
> set.seed(42) > a <- rpois(200, 20) > b <- rpois(220, 19) > mean(a)  19.77 > mean(b)  18.57727
Now, if I wanted to know if the treatment causes individuals to do a greater number of actions, I could perform a t-test, for example:
> t.test(a, b) Welch Two Sample t-test data: a and b t = 2.6794, df = 417.72, p-value = 0.007667 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 0.3177131 2.0677414 sample estimates: mean of x mean of y 19.77000 18.57727
It seems that the average of actions of treatment group is lower than that of the control group.
Let us say that treatment also influences the number of individuals who perform some action, and that I am interested in comparing the total of actions that have been performed in each group:
> sum(a)  3954 > sum(b)  4087
At first glance it seems that treatment, although associated with a lower average of actions than the control group, has achieved a higher aggregate number of actions than the control group. But it is clear to me that the samples obtained could have been different ones, and that this could obviously influence the sum of actions of each group.
The t-test works because it is carried out with a sample of values (200 and 220) and the distribution of these values is taken into account to calculate whether the difference in means is statistically significant. But in the case of the sum of actions of each group I only have a sample of sums in each group. How can I compare these two sums statistically? Is there an appropriate test for this? Perhaps one could compare the sums of both groups by calculating the confidence intervals for each sum? If so, how would such confidence intervals be calculated?