# Can we apply hypothesis testing to not-actively sampled groups?

For argument's sake, in the below please assume that the hypothesis test we'd be considering would be a simple z-test to check whether an observed difference between two groups' means or proportions is statistically significant.

Looking at the literature for hypothesis testing, it almost always seems to assume that the groups we are applying a statistical test on have been actively sampled from a larger population. For example, you may be looking to find whether there is a difference between the average income of men vs women. For that, you would:

1. Sample a group of men and a group of women out of the larger well-defined population
2. Apply a two-tailed z-test to aim to reject the null hypothesis that the average income of the two groups is the same.

The literature on this is vast and well understood, and I feel confident applying statistical tests in such scenarios. But what if the groups have not been actively sampled from a larger well-defined population? Are statistical tests in-principle applicable then?

Imagine we work for a Retail business:

• In Week 1: 5,690 orders were placed with an AOV = £150 (AOV = Average Order Value)
• In Week 2: 6,152 orders were placed with an AOV = £155

Imagine the leadership team celebrating: "Hooray! We've increased AOV by £5 in a single week!". "Not so fast!", you may say, thinking to apply a z-test to verify that this difference didn't just happen by chance, but it's actually statistically significant. In the same way that you can flip an unbiased coin 6 times and get 6 consecutive HEADS, similarly the AOV may have increased just by chance because a small bunch of customers happened to spend lots of money on the same week.

Assuming all test's assumptions are satisfied: Can we in-principle apply a statistical test in this scenario?

Notice that the two groups were not actively sampled from a larger population. In Week 1, the group consists of all 5,690 orders that were placed that week. There is no larger "population" which contains additional orders that we could have sampled from. We also didn't actively select the orders either, as customers shopped on their own free will. Same with Week 2.

In this light, of not being able to define a larger population, when the two groups in question is "all we have".. is it possible to in-principle apply a statistical test to test whether the observed difference happened by chance?

Intuitively my answer would be 'yes', but searching through the literature I can only find applications of Hypothesis Testing in cases where a well-defined larger population exists.

So do you think statistical tests are applicable? If yes, can you point me to relevant literature that confirms that?

I'd be forever in your debt :)

I am not familiar with the term "not-actively sampled groups". But let's assume that the main issue for you is that you think there is no "larger population." and you can't use the law of large numbers.

1. As a general rule, I suggest you always prove that "all test's assumptions are satisfied". Devil is in the details
2. if you define the population as "people who bought something on the 4th July of 1981", then you have a discrete distribution, and you don't need to estimate the expected value because you already have a population.
3. If you have two expected values for two populations, there is no need for a "z-test" because these are not estimates.

More useful population:

1. Let's define our population as "people who bought something."
2. Each day for that definition is a sample, and we don't know the real expected value for the population
3. We perform a z-test to check if they are from the same population

The main problem here is that it would be hard to prove one of the assumptions for CLT (the foundation of the z-test): independent and identically distributed (iid). In real-world problems, you have seasonality, trends and occasional events that impact the sample. But it is another question.

I hope that it helped you to understand the idea behind population in split-testing!

• (Comment 1/3) Thank you @lispsil, that's really helpful. One one hand, I like your point, that we can define a larger population by considering all the customers that bought; so each day's (or week's) worth of customers can be considered a sample. However, this "experimental design" you are suggesting doesn't look similar in nature to what I can find in the literature, e.g.: (1) A standard randomised A/B experiment, where two samples were randomly selected from the same population (2) An experiment where two samples were randomly drawn from two different populations Aug 12, 2022 at 8:47
• (Comment 2/3) It feels that our example corresponds to a different experimental design. Although, both groups can be assumed to have come from the same population "customers that bought", and you may argue that they went through different experimental conditions (because they shopped in different weeks), it is true that the customers in both groups were "self-selected" and that we form the two groups retrospectively after the fact. So although the design seems similar to that of #1 above (an A/B test), it seems to be fundamentally different. Aug 12, 2022 at 8:48
• (Comment 3/3) Is there any literature to suggest the use of statistical tests in this scenario? Aug 12, 2022 at 8:48
• For a nuanced discussion related to point 1 see Testing Model Assumptions in R. Aug 13, 2022 at 10:58