[R] Checking Goodness of Fit With Kolmogorov-Smirnov

Alex Gutteridge alexg at kuicr.kyoto-u.ac.jp
Fri Apr 28 11:39:01 CEST 2006


Hi,

I'm using the power.law.fit function from the igraph package to fit a  
power law distribution to some data. This function returns the power  
law exponent as it's only result. I would like to have some sort of  
goodness-of-fit and/or error estimate of the exponent returned. This  
paper:

http://www.edpsciences.org/articles/epjb/pdf/2004/18/b04111.pdf

suggests using the Kolmogorov-Smirnov test to measure the goodness-of- 
fit, however after reading the ks.test help page I'm not sure how to  
proceed. The ks.test help page (and other stats texts) seem to say  
that for the test to be valid, the parameters of the distribution  
(the power law exponent in this case) cannot be estimated from the  
data. If that's the case how do I test how good the fit is? Do I need  
to use something else instead of KS? I've seen other mentions of  
using KS to measure the goodness-of-fit to power laws though so  
perhaps I've misunderstood something basic here (I'm a biologist not  
a statistician).

If KS is the right tool to use, how would I go about specifying the  
continuous distribution function for a power law? The help page only  
shows how to use it with the built in 'pgamma' function is there an  
analogous function for power law distributions - I couldn't find one.

Thanks for any help in steering me in the right direction.

Dr Alex Gutteridge
Post-Doctoral Researcher

Bioinformatics Center
Institute for Chemical Research
Kyoto University
Gokasho, Uji, Kyoto 611-0011
Japan




More information about the R-help mailing list