# Q-Q plot and KS test

I have a question regarding the QQ plot and KS test. I have a sample which is some positions on genome, and I calculated the distance between these positions. And I generated the null distribution by randomly draw positions from genome and calculated the distance between them in the same way. (1000 times) I want to test if the distribution of the distance of my sample are the same with the distribution of distance of randomly selected positions.

First I used the QQ plot to test it, and I get the QQ plot looks like this: The QQ plot is skewed, then I want to use KS test to see if they are from the same distribution. However, I could not get a significant P-value from using ks.test() function in R. The P-value is around 0.09...

To be clear, this is the histogram of null distribution I generated by simulation: Does anyone have idea why I couldn't get significant result from KS-test? Or if there is any alternative method I could use to test the difference between this two distributions? Thanks so much!

• Your data are not just skew, there is also an outlier and there might be two modes. Jun 17 '14 at 21:16
• Thanks so the comment. Yes there is an outlier in my data. However the KS test doesn't make any difference after excluding the outlier. Jun 18 '14 at 14:34

Got too long for a comment.

It looks to me like you might (perhaps) be confusing together two different things and that might where your problem comes from - but it's not clear enough what you did to be sure.

If you want to do a KS test of the distribution in your initial Q-Q plot, the data there should be the thing passed to the KS test. What are the theoretical values in that plot? How were they obtained?

If the histogram is the simulated distribution of some statistic (as the title suggests), you wouldn't need a KS test - you just look to see where your sample value lies in that distribution.

What exactly is being displayed in the histogram? What was the sample value you're comparing with it? What are the arguments to the KS test? Is it a two-sample test or is it being compared with some theoretical distribution.

Can you please explain what you're doing at each stage and what numbers you're doing it to? (That is, if we had your original sample, how could we reproduce what you did?)

• Thank you so much for your suggestion. The sample I have is some positions in human genome, and I calculated the distance between them. And the histogram is the distribution I simulated by randomly draw positions from human genome and calculated the distance. I am comparing the distance of my sample with the distance I simulated in KS test, so it's a two sample KS test. Thanks so much! Jun 18 '14 at 14:30
• And to be clear, what I want to test is that the sample I have (the positions and distance between them) is not random position in genome, they are more clustered compared to random positions in genome. So the theoretical values in QQ plot is the distance I got by randomly draw positions from whole genome. Jun 18 '14 at 14:40