Thanks to Glen_b pointing out, poweRlaw provides the implementation I wanted.
Min max optimizations for power law parameters in R
-
06-10-2022 - |
Question
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?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow