Expected counts under independence

独立性假设下的期望频数

How do you compute expected counts under independence?

Multiply the row total by the column total and divide by the grand total.

SkillKP000990

Sign in to read the whole lesson, with 2 exercises

Sign in / Sign up

Mastery goals

  • Can compute expected counts in a two-way table assuming the variables are independent

8.3.2 The test of independence

So far we have used contingency tables to organise observed sample data on pairs of categorical variables, and used the stability of the frequency of random events to infer whether two categorical variables are associated. For a random sample, relative frequencies are random and differ from the probabilities, so our inference may be wrong; and when the sample size is small, the chance of being wrong is larger. So we need a more reasonable method of inference, and we would also like to have some control over, or estimate of, the probability of making a wrong inference.

Consider the classical probability model with sample space . Let and be a pair of categorical variables defined on taking values in . We want to decide whether the events and are associated. Note that and , and and , are complementary events. As in the discussion before, we need to decide whether the assumed relation

holds. is usually called the null hypothesis. Here is the probability that a sample point chosen at random from belongs to , and is the probability that a sample point chosen at random from belongs to .

By the definition of conditional probability, the null hypothesis is equivalent to

or

Since and are complementary events, . Also, by the properties of probability,

From these, ① is equivalent to

So the null hypothesis is equivalent to and being independent.

From what we have learnt about probability, the following four properties are equivalent to each other:

and are independent; and are independent;

and are independent; and are independent.

If these properties hold, we say that the categorical variables and are independent. This amounts to the following four equalities holding:

P(X=0)P(X=1)P(Y=0)P(Y=1)
One way to picture the four equalities in ② when and are independent: split a rectangle whose area is taken as across into a left and a right part by and , and up and down into a lower and an upper part by and ; the shaded small rectangle has area , and the other three have areas equal to the other three products in ②.

So, in the language of probability, the null hypothesis can be restated as

Suppose that by simple random sampling we have obtained a contingency table of sample data on and , as in Table 8.3-3.

Table 8.3-3

Total
Total

Table 8.3-3 is a contingency table of sample data on the categorical variables and : the first two numbers in the last row are the frequencies of the events and ; the first two numbers in the last column are the frequencies of the events and ; the four middle numbers , , , are the frequencies of the events ; the number in the bottom right cell is the sample size.

For a random sample, the frequencies , , , in Table 8.3-3 are all random variables, and the corresponding numbers in Table 8.3-2 are one observed outcome of these random variables.

If the null hypothesis holds, then by the principle that frequency settles down to probability and the first equality in ②, the probability can be estimated by the product of the relative frequencies corresponding to and ,

and

is regarded as the expected value of the frequency of the event . So the observed value of this frequency and its expected value should be fairly close.

Putting the four equalities in ② together: if the null hypothesis holds, none of the following four quantities should be too large:

Conversely, when these quantities are large, we can infer that does not hold.

Related points

All points in this topic

Cite this page: Expected counts under independence · KnowledgeTree (知识树), https://www.knowledgetree.world/en/kp/KP000990