# Chi-Squared Test of Homogeneity

Consider the table below that gives the proportions of a sample from each of two populations that fall into one of three categories (table edited after @whuber comment).

                            1   2   3   **4**
First Population Sampled  13% 19% 28% **40%**
Second Population Sampled 7%  11% 22% **60%**


Test the hypothesis that the population proportions are equal with a column (category) by calculating the p-value of the $$\chi^2$$ test statistic. Test assuming the size of the sample selected from each population that gave the above proportions was 100 people at level 0.10.

Answer: I have established the following hypotheses:

By the statement of the problem, I am assuming that this is a test for homogeneity. So the hypotheses would be:

1. $$H_0:$$ The populations are homogeneous with respect to the three categories. That is, $$p_{1j} = p_{2j}$$ for $$j = 1, 2, 3$$.

2. $$H_a:$$ The populations are not homogeneous with respect to the three categories.

However, I then realized that the row totals do not sum to 1, which has me concerned.

Is the homogeneity approach correct? I thought it may be a test of independence, but there are two populations.

Based on the comment below, the observed counts are:

                            1   2   3   4
First Population Sampled   13  19  28  40
Second Population Sampled   7  11  22  60


So we can proceed with the homogeneity test with $$n = 200$$.

• Hint: there's an invisible fourth column that you can (easily) recreate from the information given you.
– whuber
Feb 18, 2021 at 14:23
• Since each row must sum to 1 = 100%, I should created the fourth column as in my Edit to my post, and then am able to proceed with a test of homogeneity? Feb 18, 2021 at 14:51
• You are given that each sample was 100 people, so just use that to recreate a table of counts! Feb 18, 2021 at 14:56
• Understood. So this now matches a homogeneity test with $n = 200$. Feb 18, 2021 at 15:06
• You can now answer your Q yourself! Please do so, so the Q do not linger on as unresolved! Feb 18, 2021 at 15:07

"Anti-lingering" Comment:

Your stated contingency table is TBL as below:

TBL = rbind(c(13,19,28,40), c(7,11,22,60))
TBL
[,1] [,2] [,3] [,4]
[1,]   13   19   28   40
[2,]    7   11   22   60


Verifying that both rows sum to $$100,$$ as stated:

rowSums(TBL)
[1] 100 100


A chi-squared test in R, shows significant departure from homogeneity at 5% level with P-value $$0.034 < 0.05 = 5\%.$$

chisq.test(TBL)

Pearson's Chi-squared test

data:  TBL
X-squared = 8.6533, df = 3, p-value = 0.03427


The Pearson residuals reveal explicitly that the 2nd sample showed lower counts for categories 1 and 2 than the first sample, while the first sample showed a lower count for category 4. [Taken together, contributions to the chi-squared statistic from these six cells accounted for almost all of the total chi-squared statistic of about 8.6.]

chisq.test(TBL)\$res
[,1]      [,2] [,3]      [,4]
[1,]  0.9486833  1.032796  0.6 -1.414214
[2,] -0.9486833 -1.032796 -0.6  1.414214


The squares of the Pearson residuals sum to the significantly large chi-squared statistic.

chisq.test(TBL)$$res^2 [,1] [,2] [,3] [,4] [1,] 0.9 1.066667 0.36 2 [2,] 0.9 1.066667 0.36 2 sum(chisq.test(TBL)$$res^2)
[1] 8.653333