I have tried to fit several distributions to my continuous data (Pareto, Log-normal, Exponential, Gamma). The distribution of data is given below. enter image description here

I used Kolmogorov-Smirnov test to compare my data to generated distributions using estimated parameters from fitdistr function using the following code:

gamma.generated = rgamma(length(mydata),fit[1],fit[2])
w = ks.test(mydata,gamma.generated)

Two-sample Kolmogorov-Smirnov test

D = 0.089, p-value < 2.2e-16
alternative hypothesis: two-sided

However, I always get p-value < 0.001 for all distributions and a warning message "p-value will be approximate in the presence of ties". Does this mean that my data are not from any of these distributions or the test is too sensitive to some values? What would be other options (i.e. tests) that I can try? Thanks.


1 Answer 1


In two-sample KS, the null hypothesis is that the samples are drawn from the same distribution. In this context, p-value <1e-3 means that given the null hypothesis is true, there is a less than one-in-a-thousand probability that the Kolmogorov-Smirnov statistic (D), which calculates the maximum absolute difference between the empirical cdf of distribution 1 and the empirical cdf of distribution 2, will be greater than or equal to the value the test returns.

So in this context, the smaller the p-value, the less likely that the null hypothesis is true.

Your tests are saying that the distributions you are trying do not provide good fits to the empirical distribution of your data-set.

As an alternative, similar to the normal QQ-plot you are generating, you can QQ-plot for the other distributions to visually aid you on whether that distribution may provide a good fit for your data. This thread may give some ideas.


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.