Data2Semantics / powerlaws

Java library for the analysis of power law distributed data. Scroll down for README.
http://peterbloem.nl
MIT License
21 stars 9 forks source link

Off-by-one error in Continuous.p? #3

Open jhauffa opened 5 years ago

jhauffa commented 5 years ago

According to the paper of Clauset et al. (both the 2007 and the 2009 version), the PDF of a continuous power-law distribution is defined as (alpha-1)/x_min (x/x_min)^(-alpha). The current implementation (line 43 of Continuous.java) does not match that definition: `return (exponent() / xMin()) Math.pow(x / xMin(), -exponent()); Should it be changed to: return ((exponent() - 1.0) / xMin()) * Math.pow(x / xMin(), -exponent());` ?

pbloem commented 5 years ago

Thanks for the pointer. I haven't looked at this code in years, so I can't say for sure. If nothing depends on p() then it's likely just a mistake in a quick implementation of a utility function that's there for completeness. I'll see if I can find some time to dig in soon.