Skip to main content
Social Sci LibreTexts

13.5: Test for Homogeneity

  • Page ID
    19122
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    The goodness–of–fit test can be used to decide whether a population fits a given distribution, but it will not suffice to decide whether two populations follow the same unknown distribution. A different test, called the test for homogeneity, can be used to draw a conclusion about whether two populations have the same distribution. To calculate the test statistic for a test for homogeneity, follow the same procedure as with the test of independence.

    The expected value for each cell needs to be at least five in order for you to use this test.

    Hypotheses

    • \(H_{0}\): The distributions of the two populations are the same.
    • \(H_{a}\): The distributions of the two populations are not the same.

    Test Statistic

    • Use a \(\chi^{2}\) test statistic. It is computed in the same way as the test for independence.

    Degrees of Freedom (\(df\))

    • \(df = \text{number of columns} - 1\)

    Requirements

    • All values in the table must be greater than or equal to five.

    Common Uses

    Comparing two populations. For example: men vs. women, before vs. after, east vs. west. The variable is categorical with more than two possible response values.

    Example \(\PageIndex{1}\)

    Do male and female college students have the same distribution of living arrangements? Use a level of significance of 0.05. Suppose that 250 randomly selected male college students and 300 randomly selected female college students were asked about their living arrangements: dormitory, apartment, with parents, other. The results are shown in Table \(\PageIndex{1}\). Do male and female college students have the same distribution of living arrangements?

    Table \(\PageIndex{1}\): Distribution of Living Arragements for College Males and College Females
    Dormitory Apartment With Parents Other
    Males 72 84 49 45
    Females 91 86 88 35

    Answer

    • \(H_{0}\): The distribution of living arrangements for male college students is the same as the distribution of living arrangements for female college students.
    • \(H_{a}\): The distribution of living arrangements for male college students is not the same as the distribution of living arrangements for female college students.

    Degrees of Freedom (\(df\)):

    \(df = \text{number of columns} - 1 = 4 - 1 = 3\)

    Distribution for the test: \(\chi^{2}_{3}\)

    Calculate the test statistic: \(\chi^{2} = 10.1287\) (calculator or computer)

    Probability statement: \(p\text{-value} = P(\chi^{2} > 10.1287) = 0.0175\)

    Press the

    MATRX

    key and arrow over to

    EDIT

    . Press

    1:[A]

    . Press

    2 ENTER 4 ENTER

    . Enter the table values by row. Press

    ENTER

    after each. Press

    2nd QUIT

    . Press

    STAT

    and arrow over to

    TESTS

    . Arrow down to

    C:χ2-TEST

    . Press

    ENTER

    . You should see

    Observed:[A] and Expected:[B]

    . Arrow down to

    Calculate

    . Press

    ENTER

    . The test statistic is 10.1287 and the \(p\text{-value} = 0.0175\). Do the procedure a second time but arrow down to

    Draw

    instead of

    calculate

    .

    Compare α and the p-value: Since no \(\alpha\) is given, assume \(\alpha = 0.05\). \(p\text{-value} = 0.0175\). \(\alpha > p\text{-value}\).

    Make a decision: Since \(\alpha > p\text{-value}\), reject \(H_{0}\). This means that the distributions are not the same.

    Conclusion: At a 5% level of significance, from the data, there is sufficient evidence to conclude that the distributions of living arrangements for male and female college students are not the same.

    Notice that the conclusion is only that the distributions are not the same. We cannot use the test for homogeneity to draw any conclusions about how they differ.

    Exercise 11.5.1

    Do families and singles have the same distribution of cars? Use a level of significance of 0.05. Suppose that 100 randomly selected families and 200 randomly selected singles were asked what type of car they drove: sport, sedan, hatchback, truck, van/SUV. The results are shown in Table \(\PageIndex{2}\). Do families and singles have the same distribution of cars? Test at a level of significance of 0.05.

    Table \(\PageIndex{1}\)
    Sport Sedan Hatchback Truck Van/SUV
    Family 5 15 35 17 28
    Single 45 65 37 46 7

    Answer

    With a \(p\text{-value}\) of almost zero, we reject the null hypothesis. The data show that the distribution of cars is not the same for families and singles.

    Example 11.5.2

    Both before and after a recent earthquake, surveys were conducted asking voters which of the three candidates they planned on voting for in the upcoming city council election. Has there been a change since the earthquake? Use a level of significance of 0.05. Table shows the results of the survey. Has there been a change in the distribution of voter preferences since the earthquake?

    Perez Chung Stevens
    Before 167 128 135
    After 214 197 225

    Answer

    \(H_{0}\): The distribution of voter preferences was the same before and after the earthquake.

    \(H_{a}\): The distribution of voter preferences was not the same before and after the earthquake.

    Degrees of Freedom (df):

    \(df = \text{number of columns} - 1 = 3 - 1 = 2\)

    Distribution for the test: \(\chi^{2}_{2}\)

    Calculate the test statistic: \(\chi^{2} = 3.2603\) (calculator or computer)

    Probability statement: \(p\text{-value} = P(\chi^{2} > 3.2603) = 0.1959\)

    Press the MATRX key and arrow over to EDIT. Press 1:[A]. Press 2 ENTER 3 ENTER. Enter the table values by row. Press ENTER after each. Press 2nd QUIT. Press STAT and arrow over to TESTS. Arrow down to C:χ2-TEST. Press ENTER. You should see Observed:[A] and Expected:[B]. Arrow down to Calculate. Press ENTER. The test statistic is 3.2603 and the p-value = 0.1959. Do the procedure a second time but arrow down to Draw instead of calculate.

    Compare \(\alpha\) and the \(p\text{-value}\): \(\alpha = 0.05\) and the \(p\text{-value} = 0.1959\). \(\alpha < p\text{-value}\).

    Make a decision: Since \(\alpha < p\text{-value}\), do not reject \(H_{0}\).

    Conclusion: At a 5% level of significance, from the data, there is insufficient evidence to conclude that the distribution of voter preferences was not the same before and after the earthquake.

    Exercise 11.5.2

    Ivy League schools receive many applications, but only some can be accepted. At the schools listed in Table, two types of applications are accepted: regular and early decision.

    Application Type Accepted Brown Columbia Cornell Dartmouth Penn Yale
    Regular 2,115 1,792 5,306 1,734 2,685 1,245
    Early Decision 577 627 1,228 444 1,195 761

    We want to know if the number of regular applications accepted follows the same distribution as the number of early applications accepted. State the null and alternative hypotheses, the degrees of freedom and the test statistic, sketch the graph of the p-value, and draw a conclusion about the test of homogeneity.

    Answer

    \(H_{0}\): The distribution of regular applications accepted is the same as the distribution of early applications accepted.

    \(H_{a}\): The distribution of regular applications accepted is not the same as the distribution of early applications accepted.

    \(df = 5\)

    \(\chi^{2} \text{test statistic} = 430.06\)

    This is a nonsymmetric chi-square curve with df = 5. The values 0, 5, and 430.06 are labeled on the horizontal axis. The value 5 coincides with the peak of the curve. A vertical upward line extends from 430.06 to the curve, and the region to the right of this line is shaded. The shaded area is equal to the p-value.

    Figure 11.5.1.

    Press the MATRX key and arrow over to EDIT. Press 1:[A]. Press 3 ENTER 3 ENTER. Enter the table values by row. Press ENTER after each. Press 2nd QUIT. Press STAT and arrow over to TESTS. Arrow down toC:χ2-TEST. Press ENTER. You should see Observed:[A] and Expected:[B]. Arrow down to Calculate. Press ENTER. The test statistic is 430.06 and the \(p\text{-value} = 9.80E-91\). Do the procedure a second time but arrow down to Draw instead of calculate.

    References

    1. Data from the Insurance Institute for Highway Safety, 2013. Available online at www.iihs.org/iihs/ratings (accessed May 24, 2013).
    2. “Energy use (kg of oil equivalent per capita).” The World Bank, 2013. Available online at http://data.worldbank.org/indicator/...G.OE/countries (accessed May 24, 2013).
    3. “Parent and Family Involvement Survey of 2007 National Household Education Survey Program (NHES),” U.S. Department of Education, National Center for Education Statistics. Available online at http://nces.ed.gov/pubsearch/pubsinf...?pubid=2009030 (accessed May 24, 2013).
    4. “Parent and Family Involvement Survey of 2007 National Household Education Survey Program (NHES),” U.S. Department of Education, National Center for Education Statistics. Available online at http://nces.ed.gov/pubs2009/2009030_sup.pdf (accessed May 24, 2013).

    Chapter Review

    To assess whether two data sets are derived from the same distribution—which need not be known, you can apply the test for homogeneity that uses the chi-square distribution. The null hypothesis for this test states that the populations of the two data sets come from the same distribution. The test compares the observed values against the expected values if the two populations followed the same distribution. The test is right-tailed. Each observation or cell category must have an expected value of at least five.

    Formula Review

    \(\sum_{i \cdot j} \frac{(O-E)^{2}}{E}\) Homogeneity test statistic where: \(O =\) observed values

    \(E =\) expected values

    \(i =\) number of rows in data contingency table

    \(j =\) number of columns in data contingency table

    \(df = (i −1)(j −1)\) Degrees of freedom

    Exercise 11.5.3

    A math teacher wants to see if two of her classes have the same distribution of test scores. What test should she use?

    Answer

    test for homogeneity

    Exercise 11.5.4

    What are the null and alternative hypotheses for Exercise?

    Exercise 11.5.5

    A market researcher wants to see if two different stores have the same distribution of sales throughout the year. What type of test should he use?

    Answer

    test for homogeneity

    Exercise 11.5.6

    A meteorologist wants to know if East and West Australia have the same distribution of storms. What type of test should she use?

    Exercise 11.5.7

    What condition must be met to use the test for homogeneity?

    Answer

    All values in the table must be greater than or equal to five.

    Use the following information to answer the next five exercises: Do private practice doctors and hospital doctors have the same distribution of working hours? Suppose that a sample of 100 private practice doctors and 150 hospital doctors are selected at random and asked about the number of hours a week they work. The results are shown in Table.

    20–30 30–40 40–50 50–60
    Private Practice 16 40 38 6
    Hospital 8 44 59 39

    Exercise 11.5.8

    State the null and alternative hypotheses.

    Exercise 11.5.9

    \(df =\) _______

    Answer

    3

    Exercise 11.5.10

    What is the test statistic?

    Exercise 11.5.11

    What is the \(p\text{-value}\)?

    Answer

    0.00005

    Exercise 11.5.12

    What can you conclude at the 5% significance level?


    This page titled 13.5: Test for Homogeneity is shared under a CC BY license and was authored, remixed, and/or curated by OpenStax.