Chi-Square Goodness of Fit Calculator
Mathematically verify the distribution fit for hydrological frequency analysis.
Step 1: Frequency Data
| Bin / Class | Observed ($O_i$) | Expected ($E_i$) | Action |
|---|---|---|---|
Step 2: Graphical Analysis
Hydrological Note: For high-quality flood analysis, ensure your data bins have at least 5 expected occurrences. Small expected values can inflate the $\chi^2$ statistic.
Theoretical Background
The Chi-Square Goodness-of-Fit Test is a statistical hypothesis test used to determine whether a sample follows a specific theoretical probability distribution. In Engineering Hydrology, it is commonly used to see if rainfall or streamflow data fits the Gumbel, Normal, or Log-Pearson Type III distributions.
The Core Formula
$$\chi^2_{calc} = \sum_{i=1}^{k} \frac{(O_i - E_i)^2}{E_i}$$
- $O_i$: Observed frequency in the $i$-th bin.
- $E_i$: Expected frequency according to the theoretical distribution.
- $k$: Total number of bins or class intervals.
Worked Example for PPT
Suppose we have 50 years of flood data categorized into 3 intervals:
| Interval | $O_i$ | $E_i$ | $(O-E)^2/E$ |
|---|---|---|---|
| Low Flow | 10 | 15 | 1.667 |
| Med Flow | 30 | 25 | 1.000 |
| High Flow | 10 | 10 | 0.000 |
| Total | 50 | 50 | $\chi^2 = 2.667$ |
Conclusion: If the table-tabulated $\chi^2$ value for $df=2$ and $\alpha=0.05$ is **5.99**, since our **2.667 < 5.99**, we **accept** the distribution fit.
FAQs
What are the degrees of freedom ($df$)?
In hydrology, $df = k - 1 - m$, where $k$ is the number of bins and $m$ is the number of parameters estimated from the data (e.g., $m=2$ for Mean and Std Dev in a Normal Distribution).
When should I use K-S test instead of Chi-Square?
Use Chi-Square for larger datasets where data can be easily binned. Use the Kolmogorov-Smirnov (K-S) test for smaller datasets, as it doesn't require binning.