Does anyone know that why in the Kolmogorov-Smirnov Test, the empirical distribution function is compared with the cumulative distribution function and not the probability distribution function? Is there a reason behind this?
I think it's because comparing empirical pdf with theoretical pdf is not feasible (or hard to do).
Empirical pdf is just a finite sum of Diracs : it is not a function with computable values so how would you compare it with a nice continuous theoretical pdf?
You could try comparing a histogram with the theoretical pdf, but then comes the problem of choosing the width of the histogram bars. Same holds for any estimator density: if you were to use kernel estimation, you would need to chose a bandwidth, and probably make this bandwidth shrink with your sample size.
You would also need some asymptotic results on the distribution of the mismatch between the estimated and true pdf, which I'm not sure exist.
The Kolmogorov Smirnov test uses the cumulative distribution function, because that's what the Kolmogorov Smirnov test is.
There are other tests that use a comparison with the density function rather than the cumulative distribution function, and they have different names.
Those tests work best for distributions describing a categorical or discrete variable, but they can be applied to continuous distributions as well. With continuous distributions you first transform the data to discrete data by binning (this post provides a lot of information about this binning when it is done based on the data).
In a certain sense this binning (based on the data) is almost the same as the Kolmogorov Smirnov test where the binning is done in a cumulative way.