Skip to main content
Statistics LibreTexts

16.6.1: Practice- Fast Food Meals

  • Page ID
  • \( \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}}\)

    This example again uses data from fast food restaurants from We will be looking at all of the non-chicken meals this time, and frequencies of sandwich type with the two categories being hamburgers (hamburgers, cheeseburgers, and sliders) or sandwich (sandwiches, wraps, or rolls) by whether they are considered a kids/juniors meal or for adults Table \(\PageIndex{1}\) shows a contingency table with the Observed frequencies:

    Table \(\PageIndex{1}\): Table of Frequencies of Sandwich Type and Meal Type
    Number of Meals Adult Meal Kids Meal Total
    Hamburger 74 6 \(\sum_{Row} = \)80
    Sandwich 98 5 \(\sum_{Row} = \)103
    Total \(\sum_{Column} = \)172 \(\sum_{Column} = \)11

    \(\sum_{Row} = \)183

    \(\sum_{Column} = \)183

    We’re cutting it close to violating the assumptions of this type of analysis with only five meals for kids that are sandwiches, but we have the minimum that is required.

    Step 1: State the Hypotheses

    We’ll start with the research hypothesis. Look at Table \(\PageIndex{1}\). In general, what kind of meal is more common (Adult or Kids) for which sandwich type (hamburger or sandwich)? Use that to determine the research hypothesis.

    Example \(\PageIndex{1}\)

    What is the research hypothesis in words for this scenario? Make sure to describe a general pattern.


    • Research hypothesis in words: There will be a pattern of difference such that there will be more kids meals with hamburgers than with sandwiches.

    The research hypothesis in symbols is that the probabilities will not be equal to each other. To determine that, let's figure out what the probability would be if all of the cells were equal. To find that out, we would divide a probability of 100% by the number of cells. There are four cells (Sandwich Type = 2; Meal Type = 2; \(2 \times 2 = 4\)).

    \[\dfrac{100}{4} = 25.00 \nonumber \]

    So the probability that any random participant will fall into a specific cell is = 0.25 for each cell. This works out to be:

    • Research hypothesis in symbols: \(P_{EachCell} \neq 0.25\).

    Sometimes it’s easier to start with a null hypothesis in words and symbols, then figure out how that works out for the research hypothesis.

    Exercise \(\PageIndex{1}\)

    What is the null hypothesis in words and symbols for this scenario?

    • Null hypothesis in words: There is no pattern of difference by type of meals and type of sandwich.
    • Null hypothesis in symbols: (P_{EachCell} = 0.25\)

    Step 2: Find the Critical Value

    Let’s find the critical value, the easiest step in our process!

    Exercise \(\PageIndex{2}\)

    Using the Critical Value of Chi-Square Table page (or found in the Common Critical Value Tables page at the back of this book), determine the critical value for this scenario from the p = 0.05 column.


    To determine the critical value, we much first find the correct Degrees of Freedom. The formula (found on the bottom of the page for the Critical Values of Chi-Square Table)

    Degrees of Freedom (df) for \(\chi^2\) Test of Independence: \((R-1)\times(C-1) \)

    Since each group has two levels, that’s: \(d f=(2-1)\times(2-1)=1 \times 1 = 1 \)

    With our df=1, the critical value is 3.841.

    Step 3: Calculate the Test Statistic

    We will again calculate the \(\chi^2\) statistics through the use of multiple tables, and then again by filling in the formula for each category:

    \[\chi^{2}=\sum_{Each}\left(\dfrac{\left(E-O\right)^{2}}{E} \right)\nonumber \]

    If you prefer one way to calculate over the other, feel free to skip the one that you don’t like!

    Calculating with Tables

    We will start with the method using tables. To complete the \(\chi^2\) formula:

    \[\chi^{2}=\sum_{Each}\left(\dfrac{\left(E-O\right)^{2}}{E} \right)\nonumber \]

    We first need to find the difference between the Expected frequency and the Observed frequency. In case you forgot, that’s calculated by multiplying the row total by the column total, then dividing by the total N for each cell:

    \[E_{EachCell}=\dfrac{RT*CT}{N} \nonumber \]

    Example \(\PageIndex{2}\)

    Find the Expected frequencies for the Observed frequencies in Table \(\PageIndex{1}\).


    Table \(\PageIndex{2}\): Table of Expected Frequencies of Sandwich Type and Meal Type
    Number of Meals Adult Meal Kids Meal Total
    Hamburger \(E=\dfrac{80*172}{183} = 75.19 \) \(E=\dfrac{80*11}{183} = 4.81 \) \(\sum_{Row} = \)80
    Sandwich \(E=\dfrac{103*172}{183} = 96.81 \) \(E=\dfrac{103*11}{183} = 6.19 \) \(\sum_{Row} = \)103
    Total \(\sum_{Column} = \)172 \(\sum_{Column} = \)11

    \(\sum_{Row} = \)183

    \(\sum_{Column} = \)183

    Make sure to compute the row and column totals. They should be the same as the Totals in Table \(\PageIndex{1}\). If they are not, then you made a computation mistake. It’s easier to fix it now than after the whole process when you figure out that your final answer isn’t the same as everyone else’s.

    Based on the formula, what would we do next?

    \[\chi^{2}=\sum_{Each}\left(\dfrac{\left(E-O\right)^{2}}{E} \right)\nonumber \]

    Right, E-O, which means to subtract the Observed frequency from each cell from the Expected frequency from that same cell. If you’re doing this all on your calculator, it might be easier to do the following step at the same time. Based on the formula, what would we do after subtracting the Observed from the Expected frequencies?

    So in the following table, you can do the subtraction and squaring in the same table.

    Example \(\PageIndex{3}\)

    Find the difference scores by subtracting the Observed frequencies from the Expected frequencies for each cell, then square each of those difference scores.


    Table \(\PageIndex{3}\): Table of Differences Squared
    Number of Meals Adult Meal Kids Meal
    Hamburger \( 75.19 – 74 = 1.19^2 = 1.42\) \( 4.81 – 6 = -1.19^2 = 1.42\)
    Sandwich \( 96.81 – 98 = -1.19^2 = 1.42\) \( 6.19 – 5 = 1.19^2 = 1.42\)

    How come all of the differences scores are the same?! Maybe that happens when one group has so few frequencies? Maybe that happens when there’s so little difference between at least two of the cells? It’ll be interesting to see what that means for the final calculation!

    If you complete two separate tables, one for the subtraction and one for the squaring, the row and column Totals for the differences (subtraction) would be zero. Dr. MO did separate tables on her own, and that’s what she found!

    Looking at the formula, we’ve now completed all of the calculations for the numerator. Can you see what the next step is?

    \[\chi^{2}=\sum_{Each}\left(\dfrac{\left(E-O\right)^{2}}{E} \right)\nonumber \]

    Example \(\PageIndex{4}\)

    Complete the formula by dividing each cell by its own Expected frequency, then, add up all of the Total rows and columns to get the calculated \(\chi^2\).


    Table \(\PageIndex{4}\): Final Table Calculating Chi-Square
    Number of Meals Adult Meal Kids Meal Total
    Hamburger \(E=\dfrac{80*172}{183} = 75.19 \) \(E=\dfrac{80*11}{183} = 4.81 \) \(\sum_{Row} = \)80
    Sandwich \(E=\dfrac{103*172}{183} = 96.81 \) \(E=\dfrac{103*11}{183} = 6.19 \) \(\sum_{Row} = \)103
    Total \(\sum_{Column} = \)172 \(\sum_{Column} = \)11

    \(\sum_{Row} = \)183

    \(\sum_{Column} = \)183

    The Total for summing the Totals for the columns is the same as the sum of the Totals for the rows, so we did it correctly!

    Ooh, that looks small. Let’s see if we use the formula for the calculations gets the same answer.

    Calculating with the Formula

    Example \(\PageIndex{5}\)

    Use the Chi-Square formula to calculate the \(\chi^2\) statistic.


    Using the information in Table \(\PageIndex{1}\) and Table \(\PageIndex{2}\), we find:

    \[\begin{aligned} \chi^{2} &=\dfrac{(75.19-74)^{2}}{75.19}+\dfrac{(4.81-6)^{2}}{4.81}+\dfrac{(96.81-98)^{2}}{96.81}+ \dfrac{(6.19-5)^{2}}{6.19} \end{aligned} \nonumber \]

    \[\begin{aligned} \chi_{Diff}^{2} &=\dfrac{(1.19)^{2}}{75.19}+\dfrac{(-1.19)^{2}}{4.81}+\dfrac{(-1.19)^{2}}{96.81}+ \dfrac{(1.19)^{2}}{6.19} \end{aligned} \nonumber \]

    \[\begin{aligned} \chi_{Squared}^{2} &=\dfrac{1.42}{75.19}+\dfrac{1.42}{4.81}+\dfrac{1.42}{96.81}+ \dfrac{1.42}{6.19} \end{aligned} \nonumber \]

    \[\chi_{Division}^{2} = 0.02 + 0.30 + 0.01 + 0.23 = 0.56 \nonumber \]

    \[ \chi^{2} = 0.56 \nonumber \]

    The good news is that both methods of calculation got us the same answer! Now, we're ready to make a decision about the null hypothesis.

    What do you think when this is still true:

    (Critical \(<\) Calculated) \(=\) Reject null \(=\) There is a pattern of relationship. \(= p<.05\)

    (Critical \(>\) Calculated) \(=\) Retain null \(=\) There is no pattern of relationship. \(= p>.05\)

    Exercise \(\PageIndex{3}\)

    Should the null hypothesis be retained or rejected? What should the statistical sentence look like?


    Our calculated \(\chi^2\)=0.56 is much smaller than the critical \(\chi^2\) of 3.841, so we would retain the null hypothesis. This leads to the statistical sentence of \(\chi^2\)(1)=0.56, p>.05.

    We have all we need to write-up a conclusion now.

    The Write-Up

    Example \(\PageIndex{6}\)

    Report the results in a concluding paragraph with the four requirements for reporting results but refer to Table \(\PageIndex{1}\): for the Observed frequencies since we don’t have descriptive statistics.


    The research hypothesis was that there will be a pattern of difference such that there will be more kids meals with hamburgers than with sandwiches. This was not supported; there is no statistically significant pattern of difference (\(\chi^2\)(1)=0.56, p>.05). As can be seen in Table \(\PageIndex{1}\), although there were more kids meals with hamburgers than sandwiches, there was about the same amount of kids meals with hamburgers as there were with sandwiches.

    And that’s it! That’s Pearson’s Chi-Square Test of Independence! Not so scary, right? One last type of Chi-Square, and then we’ll talk about choosing the appropriate statistical test again.

    Contributors and Attributions

    • Foster et al. (University of Missouri-St. Louis, Rice University, & University of Houston, Downtown Campus)

    This page titled 16.6.1: Practice- Fast Food Meals is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Michelle Oja.