Comments (9)
Hi, I second that suggestion.
@mapfiable would you mind explaining how to compute it manually ? I've been stuck on that for a bit.
from powerlaw.
Hi @marinecourtin, how you compute the constant depends on your problem / what relation you are trying to fit. In case your data are drawn from a continuous powerlaw distribution, the constant is easy to calculate. See e.g. the table on page 4 in Clauset et al. I was also struggeling a lot with this, but eventually found the answers I needed. Check out my post here for more info.
from powerlaw.
Hi @mapfiable , I am stuggling learn how to use to powerlaw package right now. I have read your post on StackExchange and it is helpful. You mentioned that you manually calculated th powerlaw alpha using MLE method. Actually, when I manually calculated it at the very beginning, I took log on both left and right sides and ran a linear regression. The the intercept is log(C) and the coefficient is log(-alpha). Does this make sense?
from powerlaw.
However, when I use this method to double check the results which pawerlaw package gives to me, they are much different. Maybe powerlaw calculate the alpha in MLE method. Their difference really confuse me a few days now.
from powerlaw.
'where xi, i=1,...,n, are the observed values of x such that xi≤xmin'
I think there is a type here, xmin should be less or equal than xi, not reverse.
from powerlaw.
'where xi, i=1,...,n, are the observed values of x such that xi≤xmin'
I think there is a type here, xmin should be less or equal than xi, not reverse.
Hi, thanks! Nice catch. Yeah, that was a typo.
I'm not sure what you mean by you took the log on the left and right side. So you just calculated the log of the leftmost and rightmost bin of your data and then fit a line through that? Of course that will give you a different result for alpha. Using MLE is much more precise.
from powerlaw.
I see, using MLE is indeed a more precise way. I think that's the reason why powerlaw pick this methoe, lol.
What I mean is that, for p(x)=C*x**−α, after I take log on both sides, it becomes, log(p(x)) = log(C) + (−α)*log(x).
Like y = ax + b, we consider log(p(x)) as y, (−α)log(x). as ax and log(C) asb. Then, we may do the linear regression to get (-α) and C.
The only problem is, for a series of number, I do not know its pdf, p(x), especially for a continuous variable. I tried to split the data into 20 or 30 bins, and use the frequency in each bins to simulate p(x) for each x. I think it's okay but the results is different from I got using 'powerlaw'.
from powerlaw.
Ah, I see. I'm no mathematician, but as far as I can tell, MLE gives you the mathematically exact solution for alpha, while simulating p(x) is just an estimate, which I guess can be off for a number of reasons, so I would trust the MLE alpha value more.
from powerlaw.
Thanks for your reply. I think MLEis indeed a better to estimate alpha. Because we assume these numbers follow a power law distribution, then we try to solve its alpha. It is a more direct and scientific way.
from powerlaw.
Related Issues (20)
- `estimate_discrete` should be False by default or raise a warning for x_min < 6 HOT 1
- p_value not computed from normalizes R HOT 6
- Alpha exponent less than 1? HOT 4
- python 3.7 HOT 1
- Version label
- Added xmin computation does not work for distributions != power_law/truncated_power_law HOT 1
- power law plot showing fit and all data, not just data from xmin HOT 1
- New user: Why the curvature in power_law.plot_ccdf fit? HOT 14
- Defunct scipy import HOT 1
- threshold in powerlaw fit HOT 1
- Remove or make optional xmin fitting print
- Fitting a powerlaw with the xmax parameter HOT 17
- How to improve the efficiency of the fit.
- Get the estimates when i only have an probability distribution from empirical data
- Some issues in lognormal fit
- how to calculate the R value properly for discrete data
- Please remove print statement on line 341 of powerlaw.py
- parameter1 attribute not set for fit.powerlaw HOT 1
- Can not pass 'bins' keyword to `plot_pdf` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from powerlaw.