Section 2.3 Lecture: Chi-Square Tests
Overview
Brad Hall explains three applications of chi-square methods: goodness-of-fit tests for categorical frequencies, independence tests using contingency tables, and tests of normality. He works through Excel examples with the chi-square right-tail distribution, including a 500-part production sample, job and crash tables, a binned normality test, and the Jarque-Bera statistic based on skewness and kurtosis.
Key takeaways
- For a goodness-of-fit test with fixed category proportions, calculate each expected count as the hypothesized proportion times the sample size, then sum (observed − expected)²/expected across categories.
- For a chi-square independence test, calculate each expected cell as row total times column total divided by the grand total; degrees of freedom are (rows − 1)(columns − 1).
- A significant chi-square test for independence provides evidence of association between categorical variables, but it does not establish that one variable causes the other.
- A binned chi-square normality test can be sensitive to the chosen bin boundaries; in the lecture's 201-observation example, the statistic is 7.217 and p is about 0.007.
- The Jarque-Bera test avoids bin selection by using sample size, skewness, and kurtosis, with a chi-square reference distribution fixed at 2 degrees of freedom.
- A large p-value means the test fails to reject the null hypothesis, not that normality has been proven; the 136-point football example has p = 0.918.
Chapters
- Brad Hall introduces chi-square tests as a way to compare observed frequencies with expected frequencies, such as actual sales versus projections.
- A goodness-of-fit test uses the statistic Σ((O − E)²/E), where O is observed frequency and E is expected frequency.
- For a goodness-of-fit test with categorical outcomes, degrees of freedom equal the number of categories minus one.
- An electronics company historically classifies parts as 92% pass, 6% fail but repairable, and 2% fail and scrap.
- A random sample of 500 parts contains 475 passes, 18 repairable failures, and 7 scrapped parts.
- The goodness-of-fit question is whether any observed category proportion differs from its historical rate.
- Expected counts are each historical proportion multiplied by 500: 460 passes, 30 repairable failures, and 10 scrapped parts.
- Excel's SUMPRODUCT can calculate Σ((O − E)²/E) across the three categories; the resulting chi-square statistic is 6.189.
- The statistic can also be calculated category by category, then summed, with each squared observed-minus-expected difference divided by its expected count.
- For three outcome categories, degrees of freedom are 3 − 1 = 2; the chi-square right-tail p-value is about 0.045.
- At α = 0.05, the p-value is below the significance level, so the historical proportions are rejected.
- The conclusion is that at least one category rate changed; the sample shows more passes than expected, which may be favorable but could still warrant checking production conditions.
- An independence test asks whether two categorical variables are associated, rather than whether one set of frequencies matches fixed proportions.
- The null hypothesis assumes independence; the alternative says the variables are dependent.
- The example relates job category to whether an employee sleeps on the job, with two categories for each variable forming a 2-by-2 table.
- The observed job-category table contains counts 155, 256, 145, and 144, for a total sample of 700.
- For each cell, expected frequency equals its row total multiplied by its column total, divided by the grand total.
- With two rows and two columns, degrees of freedom are (2 − 1)(2 − 1) = 1.
- A pivot table groups crash records by light condition in rows and crash type in columns.
- The resulting observed counts are 166, 3,258, 108, and 1,326, with row totals of 3,424 and 1,434 and column totals of 274 and 4,584.
- The table tests whether light condition and head-on versus non-head-on crash type are independent.
- Expected crash-table counts use the same row-total times column-total divided by grand-total calculation, with a sample size of 4,858.
- The chi-square statistic is 13.673; a 2-by-2 table has 1 degree of freedom and a p-value of about 0.00002.
- At α = 0.01, the null hypothesis of independence is rejected, indicating an association between crash type and light condition.
- A goodness-of-fit test can assess normality by comparing observed frequencies in numerical bins with frequencies expected under a normal distribution.
- The example uses four bins: below 10, 10 to 20, 20 to 30, and 30 or above, with observed counts 29, 95, 60, and 17.
- The null hypothesis states that the data follow a normal distribution with mean 17.5 and standard deviation 7.4; the alternative states they do not.
- Excel's cumulative normal distribution gives the probability below a cutoff; the probability between two cutoffs is the larger cumulative probability minus the smaller one.
- The probability for values at least 30 is calculated as 1 minus the cumulative probability below 30.
- Multiplying the four bin probabilities by the total of 201 observations gives expected counts of approximately 31.24, 95.85, 64.75, and 9.16.
- Comparing the observed counts with the expected counts produces a chi-square statistic of 7.217.
- With four bins, the degrees of freedom are bins minus three, or 1; the p-value is about 0.007.
- At α = 0.05, the normality assumption is rejected, but the result can depend on how the analyst chooses the bins.
- Brad Hall introduces the Jarque-Bera test as an alternative that uses sample size, skewness, and kurtosis instead of binned frequencies.
- The test statistic is n/6 multiplied by skewness squared plus kurtosis squared divided by 4; its chi-square reference distribution always has 2 degrees of freedom.
- The null hypothesis represents normality, with skewness and kurtosis both equal to zero; the alternative represents non-normality.
- A provided example uses sample size 50, skewness 2.3190, and kurtosis 6.7322.
- Substitution into the Jarque-Bera formula gives a test statistic of about 139.24 and a p-value of approximately 5.8 × 10⁻³¹.
- Because the p-value is extremely small, the normality null hypothesis is rejected at conventional significance levels.
- For a football dataset with 136 observations, Excel's SKEW and KURT functions calculate the sample skewness and kurtosis of points per game.
- The resulting Jarque-Bera statistic is about 0.171, with a p-value of 0.918 using 2 degrees of freedom.
- At α = 0.05, the test fails to reject normality; the result supports treating points per game as compatible with a normal distribution, rather than proving normality.
- The same Excel calculations can be applied to total yards per game, which also appears compatible with a normal distribution in the example.
- The lecture closes the Section 2.3 material for the first exam and previews an exam review and practice test.
Transcript excerpt
0:01 Hey everyone, this is section 2.3 on kaiquare test. This is the last section for the second module of the first unit and this will be the final subject matter that will go into the unit one test. Here we will discuss kaiquare tests which serve a multitude of purposes. On one hand, kaiquare tests help us compare observed outputs with expected outputs. This is very important for business practices. If you want to see if a certain uh collection of sales match the expected number of sales that you have projected for a particular month. We'll move on to goodness of fit tests for
0:48 independence as well as tests for normality which are both very important indicators to understand about variables. But nonetheless, let's go ahead and start off with a goodness of fit test which again is going back to the idea of seeing how well observed data is compared to expected data. So this is the first kind of idea into the most simplistic form of predictive modeling where we have some sort of relative output rel um in relation to the number of samples that we have and this is gathered over some amount of time for a business practice. For the
1:39 time being, we still have test statistics as we've had in previous sections. And the test statistic here, it's not a t statistic or zstistic. It's called a ki squared stat test statistic. So this behaves a little bit differently in terms of how it looks but ultimately the ki squared test statistic for a goodness of fit test is this summation. So the uh Greek symbol that you see that's called sigma. It means you add a bunch of stuff together. And these O's and E's, they represent expected values or expected frequencies.
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Brad Hall.