16.4: Practice Goodness of Fit Pineapple on Pizza
 Page ID
 22174
\( \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}\)There is a very passionate and ongoing debate on whether or not pineapple should go on pizza. Being the objective, rational data analysts that we are, we will collect empirical data to see if we can settle this debate once and for all. We gather data from a group of adults asking for a simple Like/Dislike answer.
Step 1: State the Hypotheses
We start, as always, with our hypotheses. ChiSquare focuses on patterns of relationship, so that's what the hypotheses in words should talk about. Let's go through research hypothesis to see how this all works out.
What is the research hypothesis in words for this scenario? Make sure to list which group you think will have a higher frequency.
Solution
 Research hypothesis in words: There will be a pattern of difference such that there will be more people who dislike pineapple on their pizza than people who like pineapple on their pizza.
The hypotheses in symbols focus on probabilities, but because of how ChiSquare works, we can only say that the probabilities will not be equal.
 Reseach hypothesis in symbols: \(P_{Like}\neq 0.50, P_{Dislike} \neq 0.50, or P \neq (0.50, 0.05)\)
The probability of 0.50 (which means a 50% chance) was found by knowing that we only have two options: Like or Dislike. All probabilities add up to 100% chance, so with only two options, we find \(\dfrac{100}{2} = 50 \) which means that the P (probability) is 0.50.
If this research hypothesis in symbols doesn't make sense, it might be easier to start with a null hypothesis in words and symbols, then figure out how that works out for the research hypothesis.
What is the null hypothesis in words and symbols for this scenario?
Solution
 Null hypothesis in words: There is no pattern of difference based on liking pineapple on pizza.
 Null hypothesis in symbols: \(P_{Like}\neq 0.50, P_{Dislike} \neq 0.50, or P \neq (0.50, 0.05)\)
Let's move on to an easier step!
Step 2: Find the Critical Value
Per usual, we will leave \(α\) at its typical level of 0.05. You can find the Critical Values of ChiSquare Table earlier in this chapter, or look for the link in the Common Critical Values page at the end of this book.
What is the critical value for this scenario?
 Answer

We have two options in our data (Like or Dislike), which will give us two categories (k=2). The Degrees of Freedom is found through k1, so we will have 1 df (k1=21=1). From our \(\chi^{2}\) table of critical values, we find a critical value of 3.841 for our \(\alpha\) of p=0.05.
See, that was easy! How, the slightlylesseasybutnotthathard step of calculating the ChiSquare test statistic.
Step 3: Calculate the Test Statistic
The results of the data collection are presented in Table \(\PageIndex{1}\).
Like  Dislike  Total  

Observed  19  26  19+26=45 
First, let's find the Expected values, then we'll fill have what we need to complete the full calculation.
With two categories and 45 scores, what is the Expected frequency?
Solution
\[E = \dfrac{45}{2} = 22.50 \nonumber \]
We can use the Observed and the Expected frequencies to calculate our \(\chi^{2}\) statistic either through a table or individually in the equation:
\[\chi^{2}=\sum_{Each}\left(\dfrac{\left(EO\right)^{2}}{E} \right)\nonumber \]
The first example will use the table.
Complete the calculations labeled to fill in Table \(\PageIndex{2}\).
Like  Dislike  Total  

Observed  19  26  45.00 
Expected  22.50  22.50  22.50+22.50=45.00 
Difference Score (E Minus O)  
Difference Score Squared  
Diff^{2} divided by Expected 
Solution
Like  Dislike  Total  

Observed  19  26  45.00 
Expected  22.50  22.50  45.00 
Difference Score (O Minus E)  22.5019=3.50  22.5026=3.50  N/A 
Difference Score Squared  \(3.50^2 = 12.25 \)  \(3.50^2 = 12.25 \)  N/A 
Diff^{2} divided by Expected  \(\dfrac{12.25}{22.50} = 0.54 \)  \(\dfrac{12.25}{22.50} = 0.54 \)  0.54+0.54=1.08 
You might have noticed that there are still two empty cells. You can add up the Difference Scores (they equal zero in this example) and the squared Difference Scores (they equal 24.50), but we don't use them for the \(\chi^2\) formula, so you can save some time and not calculate them.
Also, if you used a spreadsheet, the final sum of \(\dfrac{Diff^2}{E} = 1.09\); those darn rounding differences!
What would this look like in the ChiSquare formula?
Use the \(\chi^2\) formula with the Observed frequencies and Expected frequencies to calculate the test statistic for \(\chi^2\):
\[\chi^{2}=\sum_{Each}\left(\dfrac{\left(EO\right)^{2}}{E} \right)\nonumber \]
Solution
\[\chi^{2}= \dfrac{(22.5019)^{2}}{22.50} + \dfrac{(22.5026)^{2}}{22.50} = 0.54 + 0.54 = 1.08 \nonumber \]
Using the table to calculate the \(\chi^2\) and using the formula resulted in the same result (because you are doing the same things mathematically). It's your choice which option that you prefer. It seems easier to use the formula when there are so few categories (k), but the table seems easier to use when there are more categories. The table is also easier to use if you're using a spreadsheet.
Now that we have the calculated \(\chi^2\), we can make the decision!
Step 4: Make the Decision
Our observed test statistic had a value of 1.08 and our critical value was 3.84. What do we do if this is still true?
Slightly modified from earlier versions to fit the hypotheses, but the idea is the same:
(Critical \(<\) Calculated) \(=\) Reject null \(=\) There is a pattern of relationship. \(= p<.05\)
(Critical \(>\) Calculated) \(=\) Retain null \(=\) There is no pattern of relationship. \(= p>.05\)
Based on this note...
Do we retain or reject the null hypothesis?
Solution
Because our critical value is larger than our calculated value, we retain the null hypothesis.
The debate rages on.
What would our results look like in the statistical sentence?
 Answer

\(\chi^2\)(1)=1.08, p>.05
WriteUp
How might we write this up? We can't quite fulfill the four requirements for reporting results because there are no means to include. Instead, let's include the Observed frequencies.
Report the results in a concluding paragraph that includes the four requirements (but use Observed frequencies instead of descriptive statistics).
Solution
The research hypothesis was that there would be a pattern of difference such that more people would dislike pineapples on pizza than like pineapples on pizza. This research hypothesis was not supported (\(\chi^2\)(1)=1.08, p>.05). There does not seem to be a pattern of difference; of our 45 participants, 19 people like pineapple on pizza, and 26 people dislike pineapple on pizza.
That's it! If you want more practice, check out this blog post about the frequency of the different colors of M&Ms.
We now move on to the other kind of ChiSquare analysis, the Test of Independence.