GithubHelp home page GithubHelp logo

Comments (9)

marinecourtin avatar marinecourtin commented on August 25, 2024

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.

mapfiable avatar mapfiable commented on August 25, 2024

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.

ZHAOYANZHOU avatar ZHAOYANZHOU commented on August 25, 2024

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.

ZHAOYANZHOU avatar ZHAOYANZHOU commented on August 25, 2024

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.

ZHAOYANZHOU avatar ZHAOYANZHOU commented on August 25, 2024

'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.

mapfiable avatar mapfiable commented on August 25, 2024

'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.

ZHAOYANZHOU avatar ZHAOYANZHOU commented on August 25, 2024

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.

mapfiable avatar mapfiable commented on August 25, 2024

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.

ZHAOYANZHOU avatar ZHAOYANZHOU commented on August 25, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.