I have some data that I have fitted to a Weibull distribution and now I want to calculate the goodness of fit.

At first I tried using the Kolmogorov-Smirnov test but I have read that this doesn't give a valid result when the parameters that I consider for the distribution are obtained from the data. Then I considered calculation the $R^2$ coefficient but then I also read that this can't be used to asses the goodness of a nonlinear fit.

More or less those are the statistical tests that I know how to use and remember from my last course in statistics. Which test could I run in this case to assess the goodness of fit of the Weibull distribution to my data?

It would be even better if that test was already a well established Python function.


1 Answer 1


Does chi square work for you? You sum the quotient of the square difference of expected and observed counts per bin divided by the expected counts per bin, and can find a reduced chi square using the number of bins and number of optimizable parameters (related to degrees of freedom, for which the input 'ddof' is modified in scipy syntax). A reduced chi square close to one generally means good fit.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.