Chi-Square distribution examples

Chi Square distribution examples an overview, In the test hypothesis, it is usually assumed sample drawn from a known distribution like binomial, Poisson, normal, etc…It is an assumption but good to check our assumption holds true or not. 

How to check the assumption hold true or not?. It is based on outcomes or observations. Based on the chi-square test is used for identifying the discrepancy between the observed frequencies and theoretical frequencies.

If the discrepancy is not large, it’s considered that our assumption is true otherwise false. This also called the goodness of fit test.

Null Hypothesis

Ho=data comes from the assumed distribution

H1=data does not come from the assumed distribution

In chi-square distribution has n-1 degrees of freedom

The decision criteria are based on the chi-square statistic, If chi-square > tabled value reject the null hypothesis and accept the alternate hypothesis.

When we need the goodness of fit test?

If the calculated value of chi-square is less than or equal to the degrees of freedom of chi-square then the goodness of test is not required.

What is a contingency table and what kind of role has chi-square distribution in contingency table analysis?

A contingency table is two-way table in which the columns are classified into one attribute and rows are classified into other attributes. 

Each cell contains 0ij items, i indicate ith number of row and j indicate a jth number of columns. Each row or column total is known as the marginal total.

Why we need a contingency table?

The contingency table will help us to identify the independence of two attributes. Most of the cases used to explain the variation in one variable through the variation of other variables.

If the cell contains zero cell values then its called an incomplete contingency table.

In a contingency table, all rows contain zero values than its called structural zeros because the probability of having an observation in the cell is zero.

Does the contingency table mean only 2 by 2 tables?

Contingency table can have 2, 3, 4 or more dimensional tables. The Chi-square tests help us to test the independence of two attributes.

As usual chi-square value greater than the tabled value reject the null hypothesis and accept alternate hypothesis.

When we use the Fischer Exact test?

If the any of the cell count is less than 5 Fischer exact tests are more ideal compared to the chi-square test. 

When sample size is large and cell frequencies are more than 5 chi square test is appropriate.

Chi Square distribution examples in R


ans<-compareGroups(Groups~.,data=data, max.ylev=30, max.x.lev=20)

Method 3 indicates Fischer or Chi Square test.

The script automatically executes based on cell counts Fischer or Chi-Square test to be applied.


Based on compare group analysis in R easily can execute Fischer Exact or Chi-Square test and if the p-value is less than 0.05 reject the null hypothesis and accept the alternate hypothesis.

Sensory Discrimination in R

Proportion test in R

About the author

Data Specialist

Leave a Reply

Your email address will not be published.

seventeen + six =