# Chi-Square goodness-of-fit test on sample space or quantiles?

I think there are two ways to perform the chi-Square goodness-of-fit test:

1. Divide the sample space into bins of equal size and see how many observed values fall in each bin. where the expected per bin depends on the fit.
2. Divide the cdf of the fit into B bins of equal size (e.g., five bins of size .2 each, or 8 bins of width .125 each) and see where each observed value would belong into. -> count observed values per bin of size > calculate the chi square statistic (where the expected nr per bin is n/B or observations/bins, since the quantiles are distributed uniformly)

Is 2. a valid approach? And is there anything noteworthy about the second approach?

• I think the number of bins will determine the value of $\chi_n$, where $n$ is the number of bins $-1$. I might be wrong Mar 10, 2013 at 7:12

According to $2-$, deriving some statistic over the cdf bins is not a useless idea. If the samples resamble the cdf of the true distribution then you are done. On the other hand, the deviations from the true frequecies will indicate you the goodness of fit. However a special care should be taken for about the number of bins/number of samples as well as distribution of the error.