InsightFab
Knowledge Base/Chi-square Test in Quality Analysis: Independence and Goodness-of-Fit
Statistical Analysis6 min read

Chi-square Test in Quality Analysis: Independence and Goodness-of-Fit

This article introduces the Chi-square test as a robust method for quality analysis, moving beyond intuitive guesswork. It provides a data-driven approach to determine the relationships between variables, helping to identify the true root causes of manufacturing issues.

The day the CPK report came out, the whole room fell silent for three seconds. Do you know why?

I remember years ago, we changed a batch of new consumables for our machine. The factory manager excitedly said, "This time, we should be able to push Cpk to 1.33!" Two weeks later, the yield report came out, and the Cpk was only 1.08. The meeting room was silent, only the factory manager's deep sigh could be heard. Everyone looked at each other; someone said, "Could it be that the new consumables don't match the machine parameters?" Others guessed, "Perhaps different batches of wafers react differently to the consumables?" At that moment, I thought, how great it would be if there was a method to help us determine if these "guesses" were actually related.

Where's the Problem? Don't Just Tell Stories from Charts

To put it simply, many times when we encounter problems, our intuition leads us to connect "Is A causing B?" For example, you changed raw materials from a new supplier (A), and consequently, the yield (B) dropped. You might immediately conclude, "There's a problem with this new supplier's raw material!" However, such a judgment is based on experience, not on data.

What we most often encounter in factories is wanting to know "whether there's a relationship between two variables." Is there a relationship between new consumables and machine parameters? Is there a relationship between different wafer batches and yield? This kind of "is there a relationship" question is precisely what the Chi-square test excels at handling. It can help you determine if two categorical variables are "independent." If the result is "not independent," then congratulations, it means they are indeed related, and you can further investigate the cause.

So, the key point is that the Chi-square test helps you determine "whether two variables are truly related," preventing you from making judgments based solely on intuition.

How to Do It in Practice? Let Data Speak

The Chi-square test typically has two main uses, and in factories, we most commonly use:

  1. Test of Independence: This is the most common use, as I mentioned above, to determine if there is an association between "two categorical variables."
* Scenario: You want to know if there's a relationship between "wafer supplier" and "yield level (good/bad)."

* How to do it:

1. Collect data, compiling yield levels for wafers from different suppliers separately.

2. Create a Contingency Table, for example:

| Supplier | Number of Good Units | Number of Defective Units | Total |

| :----- | :----- | :----- | :--- |

| A | 950 | 50 | 1000 |

| B | 900 | 100 | 1000 |

| C | 930 | 70 | 1000 |

3. Input the data into Excel or statistical software (Minitab, R, Python all work) and run the Chi-square test.

4. Examine the P-value: If the P-value < 0.05 (a commonly used industry standard), it indicates that "supplier" and "yield level" are not independent, meaning there is a significant association between them. At this point, you can reasonably suspect that the supplier indeed affects the yield. If the P-value > 0.05, it suggests independence, and the current data cannot prove a relationship.

  1. Goodness-of-Fit Test: This is primarily used to determine if "your observed data distribution" matches "your expected distribution."
* Scenario: You expect the number of machine downtimes across different shifts to be uniformly distributed (e.g., morning, afternoon, and night shifts each account for 33.3%), but the actual collected data is not like that. You want to know if there's a significant difference between the actual data and your expectation.

* How to do it:

1. Establish your expected distribution (e.g., 30 downtimes for the morning shift, 30 for the afternoon shift, 30 for the night shift).

2. Collect actual observed data (e.g., 45 downtimes for the morning shift, 25 for the afternoon shift, 20 for the night shift).

3. Similarly, input the data into software and run the Chi-square Goodness-of-Fit test.

4. Examine the P-value: If the P-value < 0.05, it indicates a significant difference between the "actual distribution" and the "expected distribution." At this point, you should investigate why there are so many downtimes during the morning shift. Is it an issue with human resource allocation or machine maintenance?

So, in other words, the Chi-square test helps you uncover potential associations or differences from a pile of numbers, preventing you from making blind guesses.

The Most Common Pitfall: Crude Data Grouping Leads to Useless Results

The most common mistake I've seen is arbitrary data grouping. For example, mixing machines from different process stages for analysis, or forcing continuous data (like temperature, pressure) into "high temperature/low temperature" groups without a scientific basis for the "high/low" threshold.

Once, a production line engineer wanted to analyze if there was a relationship between "operator experience" and "product defect rate." He simply divided operators into two groups: "experienced" and "novice." The Chi-square test yielded a P-value of 0.8, indicating no relationship. But he strongly felt there was a connection! Later, it was discovered that he had categorized anyone working from one to five years as "experienced" and those from six months to one year as "novice." Frankly, there's a huge difference between one year and five years of experience, isn't there? We later re-grouped the operators more finely (<6 months, 6 months-1 year, 1-3 years, >3 years), and the P-value dropped to 0.01, proving a genuine relationship.

So, the key is that data grouping must be reasonable and meaningful; otherwise, even the most beautiful statistical results are useless. Garbage in, garbage out, you know.

One Thing You Can Do Today

Open your yield report, and try using the Chi-square test to see if there's a relationship between "machine" and "defect type."

Want to try it yourself?

Every tool mentioned in this article is available on InsightFab — just upload a CSV to analyze.

Go to Tools