# Comparing sum of values of two groups

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)
[1] 19.77
> mean(b)
[1] 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)
[1] 3954
> sum(b)
[1] 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?

• "the number of times that individuals have performed a certain action". But in your simulation, Normal distribution was used. The question is your responsible is count (integer) or continuous? # of individuals in two groups are equal or not at the beginning? – user158565 Dec 11 '18 at 23:00
• I'm sorry, I did not give you enough information. Experimental situations are using different scents that supposedly attract mosquitoes and cause more activity. I measure the activity by counting the actions (integers). I want to answer the following questions: Does the smell used in the treatment situation attract more mosquitoes? Does the odor used in the treatment situation cause a higher activity activity in mosquitoes? The total number of actions performed by mosquitoes is greater in the treatment situation? – giltrapo Dec 12 '18 at 7:10
• You're right, @user158565, I set my example wrong. I edited my question by changing the normal distribution for a poisson. – giltrapo Dec 12 '18 at 15:57
• Do you know the total number of mosquitoes in each group? For example, 500 in each group. In group A, 200 of them have some activity, 300 no activity. For group B, 220 have some activity and 280 no activity. – user158565 Dec 15 '18 at 21:02
• Yes, there are 300 mosquitoes in each group. – giltrapo Dec 16 '18 at 23:39