2

Assuming a data set is drawn from a power law distribution when the value is greater than $x_{min}$. I want to estimate the $\alpha$ and $x_{min}$ for the power law distribution in R.

According to http://arxiv.org/abs/0706.1062:

$\hat\alpha=1+n[\sum\limits_{i=1}^n\ln\frac{x_i}{x_{min}}]^{-1}$ (Eq. 16)

And $\hat x_{min}$ is the value of $x_{min}$ minimizing

$D=\max\limits_{x\geq x_{min}}|S(x) - P(x)|$ (Eq. 24)

in which $P(x) = (\frac{x}{x_{min}})^{-\alpha+1}$, and $S(x)$ is the ccdf of the data, which can be obtain in R using 1-ecdf(data)(x)

How do I do such optimization and get $\alpha$ and $x_{min}$ in R?

Zebra Propulsion Lab
  • 1,736
  • 1
  • 17
  • 28
  • Sorry for not being explicit. The question is more about implementation/programming issue. Should I move this to the stackoverflow site instead? – Zebra Propulsion Lab Feb 02 '14 at 17:34
  • It looks like stackoverflow doesn't support LaTeX math environment, making all equations ugly. People could check my original post here http://stats.stackexchange.com/posts/84136/revisions for better equations if don't want to checkout the paper I referenced – Zebra Propulsion Lab Feb 02 '14 at 19:23
  • It looks to me like [csgillespie](http://stackoverflow.com/users/203420/csgillespie) has already implemented the methodology of Clauset, Shalizi and Newman in the R package `poweRlaw` ([link](http://cran.r-project.org/web/packages/poweRlaw/)). If you need to produce code for it, you could always see how Colin implemented it, I guess; he's likely to have done it in a sensible way (though I haven't looked, he may not have done it all in R code). If you just need working routines, I'd try his. – Glen_b Feb 02 '14 at 21:48
  • A better link to your post on stats.SE (in that it goes to the actual post rather than the edit history) might be [this one](http://stats.stackexchange.com/questions/84136/min-max-optimizations-for-power-law-parameters-in-r?noredirect=1#comment165071_84136) – Glen_b Feb 02 '14 at 21:54

1 Answers1

1

Thanks to Glen_b pointing out, poweRlaw provides the implementation I wanted.

Zebra Propulsion Lab
  • 1,736
  • 1
  • 17
  • 28