using MaximumLikelihoodPower
const MLE = MaximumLikelihoodPower; # make a short name
The power-law distribution is known as the Pareto distribution. We get $10^6$ samples from the Pareto distribution
seed = 12; α = 0.5;
data = MLE.Example.makeparetodata(α, seed);
We can recover the exponent $\alpha$ from the data by minimizing the Kolmogorov-Smirnov statistic. We compute the Kolmogorov-Smirnov statistic for $101$ equally-spaced values of $\alpha$.
scanKS
returns the value that minimizes the statistic and the two bracketing values. The error is $1/1000$, about as good as can be expected with $10^6$ data points.
scanKS(data, range(.495, length=101, stop=.505))
3-element Array{Float64,1}: 0.4991 0.4992 0.4993