# Kolmogorov-Smirnov interpretation in R for chi-square

With the sample size=500, I want to test whether the data follows chi-square distribution. For contiunous and one-dimensional distribution of the data, I use Kolmogorov-Smirnov test. Here I present quantile plot of data and chi-square distribution: However, my output for:

ks.test(expenses, "pchisq", df=4)


is:

One-sample Kolmogorov-Smirnov test

data:  expenses
D = 0.79133, p-value < 2.2e-16
alternative hypothesis: two-sided


for $$\ \alpha$$ =0.05 it seems as if the null hypothesis has to be rejected. How can I interpret this result?

I'm adding standard plot: It would help to give the plot of a $$\chi_4^2$$ density song with your density estimate, but your plot looks $$\chi_4^2$$-ish to me, so my interpretation is that you have a large sample size that exposes a small deviation from $$\chi_4^2$$ as really being there, not just an artifact of the sampling, but that it probably isn’t enough for you to care.
The concern I have is that you appear to have observations below zero. Even one such observation proves that your data do not come from $$\chi_4^2$$, so perhaps you have some kind of noncentral $$\chi^2$$ distribution.
• The hypothesis test all but proves that your data do not come from $\chi^2_4$. The values less than zero really do prove that the data do not come from $\chi_4^2$. So what is it that you want to do? – Dave May 10 at 14:58
• You proved that the data do not come from $\chi^2_4$; your p-value is basically zero. So what is it that you want to do? – Dave May 10 at 15:11