Calculator
Example Data Table
| Category | Observed Count | Expected Count |
|---|---|---|
| A | 18 | 20 |
| B | 22 | 20 |
| C | 20 | 20 |
| D | 25 | 20 |
| E | 15 | 20 |
Formula Used
The calculator uses the chi square goodness of fit statistic.
χ² = Σ ((O - E)² / E)
df = k - 1 - m
p value = P(Χ²df ≥ χ²)
O is observed count. E is expected count. k is category count. m is the number of estimated parameters.
How to Use This Calculator
Enter observed counts in the first box. Choose an expected method. Enter expected counts or probabilities when needed. Add labels if you want named rows. Set alpha and estimated parameters. Press calculate. Review the p value, decision, residuals, and contribution table.
Goodness of Fit P Value Guide
A goodness of fit p value measures how well observed counts match an expected pattern. It is useful for surveys, quality checks, marketing tests, genetics examples, and many category based studies. The calculator uses the chi square goodness of fit method. It compares each observed count with its expected count. Large gaps increase the test statistic.
Why This Test Matters
The test helps you decide whether differences are small random variation or evidence against the expected model. A high p value means the observed data is reasonably consistent with the model. A low p value means the data would be unusual if the model were true. The result does not prove a cause. It only measures evidence against the stated expectation.
Inputs You Can Control
This page accepts observed counts and several expected formats. You can use equal proportions, custom expected counts, or custom expected probabilities. The page can also scale expected counts to the observed total. That is helpful when your expected counts come from a larger plan or older sample. You can set the significance level and subtract estimated parameters from the degrees of freedom.
Reading the Result
The chi square statistic shows total mismatch. The degrees of freedom define the reference curve. The p value is the right tail probability from that curve. When p is less than alpha, the calculator marks the result as significant. When p is greater than or equal to alpha, it marks the result as not significant. Always review expected counts. Very small expected counts can weaken the method.
Practical Notes
Use raw counts, not percentages, for observed values. Keep category order the same in both input boxes. Do not include negative values. Avoid using the test when categories overlap. If expected counts are below five, combine sensible categories or use another method. Export the table when you need a record. The CSV file is useful for spreadsheets. The PDF file is useful for sharing a compact report. For best practice, define your expected model before seeing results. Record the data source, sample size, alpha value, and any parameter adjustments. This keeps the test transparent and easier to review later. It also reduces biased later interpretation.
FAQs
What is a goodness of fit p value?
It is the probability of seeing a chi square statistic at least as large as the calculated value, assuming the expected distribution is true.
What data should I enter?
Enter raw observed counts for each category. Do not enter percentages as observed values. Expected values can be counts or probabilities.
When should I reject the expected distribution?
Reject it when the p value is less than your chosen alpha level. A common alpha value is 0.05.
What are degrees of freedom?
Degrees of freedom usually equal categories minus one. Subtract estimated parameters when the expected model was fitted from the same data.
Why are expected counts below five important?
Small expected counts can make the chi square approximation less reliable. Combine sensible categories or use another suitable method.
Can I use probabilities instead of expected counts?
Yes. Enter probabilities in matching order. The calculator scales them to the observed total before running the test.
What does a high p value mean?
A high p value means the observed counts are not unusual under the expected model. It does not prove the model is true.
What does the contribution column show?
It shows how much each category adds to the total chi square statistic. Larger values identify categories causing more mismatch.