Chi-Square Distribution and the Goodness-of-Fit Test
Foundations of Categorical Data Analysis Beyond Two Proportions
Transition from Single/Two-Proportion Analysis to Multi-Category Distributions:
Traditional inferential statistics focuses on problems involving either one proportion or two proportions.
When evaluating one or two proportions, inferential procedures rely on the normal distribution model and the standard normal test statistic (-statistic):
When categorical variables involve more than two categories (three or more proportions, such as eye color classified as brown, black, blue, or yellow), the normal distribution model is no longer mathematically appropriate or valid.
A different probability distribution is required to evaluate multinomial categorical distributions: the chi-square distribution ( distribution).
Nomenclature and Notation:
The symbol is written as a Greek letter chi with an exponent of two: .
Pronunciation is strictly "kai-square" (not "chee" or "chai").
When written with its defining parameter, it is expressed with the degrees of freedom in parentheses: .
Primary Analytical Methods Using the Chi-Square Distribution:
Goodness-of-Fit Test: Evaluates whether an observed sample distribution across multiple categories matches a specified or hypothesized population distribution.
Test of Independence: Evaluates whether two categorical variables are statistically independent or associated.
Mathematical and Theoretical Properties of the Chi-Square Distribution
Asymmetry and Curve Geometry:
Unlike the normal distribution, which is symmetric and bell-shaped, the chi-square distribution is not bell-shaped.
The chi-square distribution is strictly skewed to the right (positively skewed).
The distribution features a long tail extending infinitely to the right; the probability density decreases gradually as values increase along the positive horizontal axis.
Domain and Range Restrictions:
Chi-square values are strictly non-negative: .
A chi-square test statistic can never take on a negative value because it represents a sum of squared differences divided by strictly positive expected values.
Parameters and Distributional Moments:
While the normal distribution is defined by two parameters—mean () and standard deviation ()—the chi-square distribution is completely governed by a single parameter: degrees of freedom ().
Mean: The mean of a chi-square distribution equals its degrees of freedom:
Variance: The variance of a chi-square distribution equals twice its degrees of freedom:
Standard Deviation: The standard deviation is the square root of the variance:
Numerical Example: For a chi-square distribution with :
P-Value Directionality:
In two-sided or one-sided normal tests, areas under the curve can be left-tailed, right-tailed, or split between two tails.
In a chi-square distribution, the area corresponding to the -value is always an area in the right tail (). Left-tail areas are never used to compute the -value for goodness-of-fit or independence tests.
Technology Implementation: Computing Cumulative Probabilities with TI-84
Calculator Navigation Path:
Press
[2nd]followed by[VARS]to access the[DISTR](Distributions) menu.Scroll down and select
.
Input Syntax and Arguments:
Syntax:
.To capture the entire right-tail area extending to positive infinity, use an arbitrarily large number such as for the upper bound.
Crucial Distinction: CDF vs. PDF:
computes the cumulative distribution function (the total probability area over a continuous interval).computes the probability density function (the height of the density curve at a single discrete point) and must never be used to calculate a -value.Multiple-choice examinations frequently include distractors calculated using
to penalize incorrect cursor selections.
Exam Preparation Note on Visualizing Curves:
While students are not required to sketch chi-square curves on the examination, exam questions involving normal models explicitly require drawing the normal curve and accurately shading the target probability region. Preparation must begin well in advance rather than within of the test.
Worked Numerical Examples:
Example 1: Find the area under a chi-square distribution with for values greater than :
Example 2: Find the area under a chi-square distribution with for values greater than :
Chi-Square Goodness-of-Fit Test Methodology
Purpose:
To determine whether an observed frequency distribution of counts across categories differs significantly from a hypothesized or theoretical distribution.
Hypothesis Formulation:
Null Hypothesis (): The distribution of categorical counts in the population is the same as the hypothesized distribution. Any discrepancies between observed and expected counts are minor and attributable entirely to sampling variation ("due to chance").
Alternative Hypothesis (): The distribution of categorical counts in the population is not the same as the hypothesized distribution (it is different).
Metaphor for Sampling Variation ("Due to Chance"): If an individual is asked to draw three identical circles, the resulting shapes will never be mathematically identical despite attempting to draw them identically. Minor discrepancies are inherent to natural processes and sampling variation. Discrepancies are considered due to chance when they fall within standard statistical tolerance.
Conditions for Inference:
Independence Condition: Data must be collected using a random sample or an independent sampling mechanism.
Expected Count Condition: The expected frequency count for every single category must be at least five:
If any expected cell count is less than , the chi-square goodness-of-fit test cannot be validly performed.
Step-by-Step Computational Procedure for the Goodness-of-Fit Test
Step 1: Determine the Degrees of Freedom ():
In a goodness-of-fit test, degrees of freedom depend on the number of categories (), not the total individual sample size ():
Example: If studying eye color across categories (black, brown, blue, yellow), .
Step 2: Calculate the Expected Counts ():
For each category , multiply the total sample size () by the hypothesized baseline proportion ():
Critical Warning: The total sample size () must be used in this calculation. Observed counts () must never be multiplied by the baseline proportions to obtain expected values.
Step 3: Calculate Category Contributions and the Test Statistic:
For each category, compute its squared difference from the expected value divided by the expected value (termed the category's contribution to chi-square):
Sum the contributions across all categories to obtain the overall chi-square test statistic:
Step 4: Compute the P-Value:
Use the cumulative chi-square distribution with the computed test statistic as the lower bound:
Step 5: Statistical Decision and Conclusion:
If the -value is large (e.g., ), there is insufficient evidence to reject the null hypothesis. Conclude that the observed distribution is consistent with the hypothesized distribution.
If the -value is small (), reject the null hypothesis in favor of the alternative.
Comprehensive Case Study: Student Perceptions of ChatGPT Utility
Study Context and Definitions:
ChatGPT is defined as an open-access online chatbot that allows users to ask questions and request content.
The study examines whether the distribution of student opinions regarding the usefulness of ChatGPT in an introductory statistics course (STT 200) changed between 2023 and a later semester (lecture section 2).
Baseline Claimed Distribution (Fall 2023):
Extremely Useful:
Very Useful:
Somewhat Useful, Not Useful, Not at All Useful: remaining categorical baseline percentages totaling .
Sample Data and Observed Counts ():
Total sample size analyzed: students.
Total categories evaluated: .
Degrees of freedom: .
Observed counts ():
Extremely Useful:
Very Useful:
Somewhat Useful:
Not Useful & Not at All Useful: remaining observed counts from the cohort.
Expected Counts Calculation ():
Extremely Useful:
Very Useful:
Somewhat Useful:
All expected counts exceed (), satisfying the condition for chi-square inference.
Contribution Calculations:
Category 1 (Extremely Useful):
Category 2 (Very Useful):
Category contributions are calculated analogously for all five levels and summed to produce the overall test statistic.
Hypothesis Statements:
: The distribution of opinions about ChatGPT among STT 200 students is the same as the 2023 distribution.
: The distribution of opinions about ChatGPT among STT 200 students is not the same as the 2023 distribution.
Inference Results and Practical Interpretation:
The test yields a -value greater than ().
Because the -value is greater than , there is very little evidence against the null hypothesis.
Conclusion: Fail to reject . The evidence indicates that student opinions regarding the usefulness of ChatGPT have remained stable and are the same as the distribution observed in 2023.
Questions & Classroom Discussion
Top Hat Problem: Area Calculation on a Chi-Square Distribution:
Question: What is the area under the chi-square distribution with degrees of freedom that is greater than ?
Setup and Input:
.Result: .
Student Dialogue and Troubleshooting: Several students initially obtained an incorrect result or had their submissions flagged as wrong before entering the verified calculation of .
Live Class Polling vs. Archival Cohort Data:
A live poll asked students: "How useful do you consider ChatGPT to be?"
Live Poll Results: Extremely useful = , Very useful = , Somewhat useful = , Not useful = , Not at all useful = .
Discrepancy and Resolution: Although the classroom attendance was approximately students, the raw vote totals exceeded this figure, indicating irregular polling submissions. To ensure analytical precision and avoid skewed calculations during class demonstration, the historical data set of students from the prior semester's Lecture 2 was utilized instead for the complete Goodness-of-Fit computation.