# R: goodness-of-fit test using Kolmogorov-Smirnov [closed]

Hey guys!

I have a problem when I run the Komogorov-Smirnov test.

I have to samples of daily prices distributions estimated with density(). Now I would like to compare these two distributions with each other.

data.1:

Date price 01.01.2010 1.2 02.01.2010 1.5 etc.

data.2:

Date price 01.01.2009 0.1 02.01.2009 0.05 etc.

For the probability density, I calculated

Now I wanted to run the KS-test:

ks <- ks.test(density.1$x, density.2$x)

and got the results that p=1, hence the two distributions are the same. However, it is already observable from eye that they differ quite heavily from each other.

Where is my mistake?

Thank you, Dani