A chi-square statistic is a test that measures how a model compares to actual observed data.

Chi-square tests enable us to compare observed and expected frequencies objectively, since it is not always possible to tell just by looking at them.

**Formula to calculate chi square.**

O is the observed or actual value.

E is the expected value.

**Example:**

Suppose you expected to get 10 red balls but you got 6 red balls and 4 green balls, calculate the chi square of the red balls.

Therefore, the Chi Square is 1.6.