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?

The general sentiment on Cross Validated is that formal goodness-of-fit testing is not helpful: either you have too few observations to reject, or you have so many that the tests become sensitive to deviations from normality that are not practically significant because your data are “close enough”. Graphical examination such as histograms, kernel density estimates, and normal quantile-quantile plots will be your friend.

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.

• Thank you for your answer. What would you recommend to do in order to prove the chi-squared distribution? It is important for me to use hypothesis test rhather than only visualising on QQ-plot. May 10, 2020 at 14:55
• 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, 2020 at 14:58
• Is there a way to prove that the samples come form chi-squared distribution at all? Additionally, I am interested in the impact of negative values on non-centrality. I can't find information about it. May 10, 2020 at 15:08
• 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, 2020 at 15:11
• Well, I suppose I have to just accept the ejection of the null hypothesis. However, could you provide an information or a link for further reading about negative values and noncentral distribution? May 10, 2020 at 15:32