2

I have made a powerlaw fit to my data with python package powerlaw with a simple: powerlaw.Fit(Weights, xmin= min(Weights)) where Weights is my data. I have used distribution_compare and obtained that lognormal is the best fit. But now I would like to know how good is this fit, not in comparison to other distributions but by itself. Is there any method in the package that can tell me such thing? How is it implemented with the data? Thanks in advance.

RM-
  • 986
  • 1
  • 13
  • 30
  • 1
    I don't know about powerlaw package but what you're looking for is chi-squared test. Read more about goodness of fit [here](http://en.wikipedia.org/wiki/Goodness_of_fit). There's a scipy implementation of `chisquare` that requires observed values, and optionally you can send expected values (which would be your fit). – ljetibo Feb 25 '15 at 15:09

1 Answers1

2

The package powerlaw does not have any method to directly compute the p-value of the fit. (As is the case for the MatLab functions used by a. Clauset et al. 2009)

There is another Python implementation of Clauset et al. 2009, which has a function that can be used to compute the p-value. It can be found on github. The function is plpva.

However, the function plpva is very slow and can give misleading results. See an issue with it.

Read more about the methods used in powerlaw in Clauset et al. 2009.

AcCap
  • 165
  • 1
  • 10