# Trouble understanding sample spaces in Bayes Theorem

I wanted to check my understanding of what's going on in the problem below, which employs Bayes' Theorem.

I would like to understand what's going on with respect to the sample space $$\Omega$$. It seems like we can only apply rules like Bayes' Theorem when $$H$$ and $$D$$ are events "from" the same sample space $$\Omega$$. But aren't $$H$$ and $$D$$ fundamentally different things here, i.e. don't they belong to different sample spaces?

Couldn't one say that we have two sample spaces $$\Omega_1$$ and $$\Omega_2$$ where $$\Omega_1 = \{D, \bar{D}\}$$, i.e. the set containing outcomes test positive and test negative (denoted $$\bar{D}$$) and $$\Omega_2 = \{H, \bar{H}\}$$, i.e. the set containing outcomes disease and no disease?

Thus, how are events $$H$$ and $$D$$ from the same sample space?

Apologies if this question is overly rudimentary. I'm just so used to applying Bayes' Thereom without fully understanding it. Thanks for taking the time to read my question!

• The thrust of your question is a little obscure. Because this exercise concerns the results of tests of people, one would presume that any sample space used to model them would somehow describe these test outcomes. Wouldn't any full description have to include both the person's status (whether they have the disease or not) and the test outcome (positive or negative)? Where, then, lies the difficulty? Perhaps the thread on random variables at stats.stackexchange.com/questions/50 might help clear things up for you. – whuber May 2 '19 at 14:20
• @whuber, the difficulty lies in understanding what the sample space $\Omega$ is in this problem since $H$ and $D$ have to belong to the same $\Omega$. Thus, is the sample space = {no disease and negative, no disease and positive, disease and negative, disease and positive}? – Noah Stebbins May 2 '19 at 14:27
• This is the sort of thing that is extensively explained in our threads on "random variables" and "sample spaces." You can find many good explanations and examples by searching our site for those two phrases. Although one has a large array of modeling choices in a problem like this, the most straightforward and natural one (IMHO) is to let the sample space be the (hypothetical) set of all possible test results for all people in the population. This clearly distinguishes the space from the events and probabilities used in the question. – whuber May 2 '19 at 14:31
• @whuber can you visually show me how you would represent $\Omega$ in this problem? I appreciate the help so far, but it seems like in the problem above, population in my mind seems to be an i.i.d. collection of random variables (each one corresponding to a person). Thus, "rate of the disease in the population" is represented in my mind to be P(person has disease) for one such i.i.d. random variable. – Noah Stebbins May 2 '19 at 17:44
• @whuber I understand applying Bayes' Theorem to a probability like P(die >= 3 | die is "even") because $\Omega = \{1, 2, 3, 4, 5, 6\}$ and $>= 3$ and "even" are clearly subsets of $\Omega$. But I don't understand applying Bayes' Theorem to the example above because I don't know what $\Omega$ is and therefore I don't know how $H$ and $D$ are subsets of $\Omega$. – Noah Stebbins May 2 '19 at 18:20

The whole purpose of the sample space is that it must encompass all possible outcomes in the problem, so that every "event" in the problem is some subset of the sample space. If the sample space does not do this, then it fails to meet the basic requirements of what it is supposed to do in the context of the problem.

Now, under your approach you posit that you could have two "sample spaces" that each describe a different aspect of the problem. The proposed sets $$\{ D, \bar{D} \}$$ and $$\{ H, \bar{H} \}$$ are not actually sets of outcomes - they are classes of events. If you want your problem to involve all these events then they would need to be subsets of outcomes on the same set (i.e., you would require $$\Omega = D \cap \bar{D} = H \cap \bar{H}$$). You would then define the sigma-field of events induced by the set $$\{ D, H \}$$, and this would include all combinations of the two events of interest in your problem.

With word problems like this, there are always literally infinitely many ways to formalize the written problem into a precise mathematical statement in terms of a sample space $$\Omega$$, a set of events, and a probability measure $$P$$. The method you ultimately choose to translate a word problem into a mathematical model depends on what you're trying to do. Here's one possible way, but it is by no means the only way or necessarily the best way.

Let the sample space $$\Omega$$ be the set of all people who have taken the test. This is a natural choice because the word problem is considering people who have taken the test. Each of these people either has the disease or doesn't, and each of this people either has a positive test or not. With this definition, we have $$H = \{\text{person} \in \Omega : \text{person has the disease}\}$$ and $$D = \{\text{person} \in \Omega : \text{person's test is positive}\}.$$ Then you could proceed as in the example, knowing that $$P(H) = 0.002$$ (the proportion of the population with the disease), $$P(D \mid H^c) = 0.01$$ (the false positive rate), and $$P(D^c \mid H) = 0.01$$ (the false negative rate).

Another possibility is letting $$\Omega$$ be the set of all people, regardless of whether or not they have taken the test. This sample space is a superset of the previous sample space. With this formulation, the event $$H$$ would be stated identically, but $$D$$ would have to change to something like $$D = \{\text{person} \in \Omega : \text{person's test would be positive if they were to take the test}\}.$$ This wording is necessary because probably not every person in $$\Omega$$ has taken the test.

Regardless of the formalization, you would still always end up with $$H$$ and $$D$$ being events in a common sample space $$\Omega$$, and you would always have $$P(H) = 0.002$$, $$P(D \mid H^c) = 0.01$$, and $$P(D^c \mid H) = 0.01$$ because of the specification of the problem.

As you get more familiar with probability, you will see that to approach word problems like this is it not always necessary to construct an explicit sample space. You will be comfortable knowing that you could do it if you really needed to do it, but for the purpose of solving a problem like in the question, you don't need to know the full specification of the sample space.

• Thanks Artem for the response. Quick follow-up question: if a sample space $\Omega$ is the set of all possible outcomes then how can it be the set of all people who have taken the test? Does a person constitute an outcome? Or does a "person who has the disease and tested negative" constitute an outcome? – Noah Stebbins May 2 '19 at 22:03
• @NoahStebbins in the case when $\Omega$ is the set of people who have taken the test, yes, each individual person in $\Omega$ is interpreted as an outcome – Artem Mavrin May 3 '19 at 15:37