Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

estimate_discrete should be False by default or raise a warning for x_min < 6 #104

Open
henrymartin1 opened this issue Jan 13, 2023 · 1 comment

Comments

@henrymartin1
Copy link
Contributor

The approximate estimation of the shape parameter for the discrete power law has a very high error of up to 50% for small x_min (see graph below) and at the moment it is easy to overlook this option. I would suggest to either change the default to not use the approximation or to raise a warning if it is used with x_min < 6.

I was using the powerlaw package to find a good fit for node degree distributions of small graphs (~50 - 500 nodes). Node degrees are of course discrete and so I was using the discrete option after reading the relevant parts of (Clauset et al. 2009) but without going too much into the details of the implementation. I only noticed that there is a problem because I often found power laws with alpha significantly lower than 2 (alpha = 2 is the theoretical minimum for graphs that follow a power law when the main node is connected to all other nodes). Only because of this strange behavior I was taking a look at the implementation again and found out about the high approximation error for low values of x_min. In my case x_min was often below 3 and alpha around 2.5 which lead to errors of +/- 1.

In the documentation it says:

Whether to estimate the fit of a discrete power law using fast analytical methods, instead of calculating the fit exactly with slow numerical methods. Very accurate with xmin>6

This statement is technically correct but I think it is not prominent enough given the high error it can cause. Here is the figure from the original paper that shows the error (from Clauset et al. 2009, appendix B2)

image

@keflavich
Copy link
Collaborator

Agreed, it would be helpful to issue a warning if xmin <= 6. A pull request implementing this would be welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants