1

I am trying to generate power-law distributed numbers ranging from 0 to 1 from a uniform distribution. I found two approaches and I am not sure which one is right and which one is wrong.

1st Source: Wolfram:

enter image description here

2nd Source: Physical Review (Page 2):

enter image description here

Where: y = uniform variate, n = distribution power, x0 and x1 = range of the distribution, x = power-law distributed variate.

The second one only gives decent results for x0 = 0 and x1 = 1, when n is between 0 and 1.

MJQZ1347
  • 2,607
  • 7
  • 27
  • 49

1 Answers1

2

If y is a uniform random variable between 0 and 1, then 1-y also is. Thereby letting z = 1-y you can transform your formula (1) as :

x = [(x_1^{n+1}-(x_1^{n+1}-x_0^{n+1}) z]^{1/(n+1)}

which is then the same as your formula (2) except for the change n -> (-n).

So I suppose that the only difference between these two formula in the notation on how n relates to the power law decay (unfortunately the link you gave for the Wolfram alpha formula is invalid so I cannot check which notation they use).

vib
  • 2,254
  • 2
  • 18
  • 36
  • Thanks! I updated the link. So the only difference lays in n <-> -n. I just compared both sources again. 1st source declares the power law distribution as P(x)=x^n while 2nd declares it as P(x)=x^(-n). Guess it's solved now. I will do some experiments and compare the distributions for different values of n. – MJQZ1347 Apr 13 '15 at 12:38
  • OK, I just experimented a bit. When I use the 2nd approach and enter n=1.5 the generated values are outside the range of [0,1]. When I enter n=-1.5 it's within the range. How to explain this? – MJQZ1347 Apr 13 '15 at 13:45
  • You cannot generate random number in [0,1] distributed with function P(x) proportional to x^{-n} when n>=1. The reason for that is that when x gets close to zero P(x) diverges too rapidly and so you cannot normalize it (the integral of x^{-n} btw 0 and 1 does not exist when n >=1). If you want to take x_0 = 0, you will want n to be strictly less than 1 (with the notation P(x) prop. to x^{-n}). – vib Apr 13 '15 at 17:41
  • Let's assume n = 1.5 is from an empirical study with the notation P(x)~x^(-n). So it is not possible to generate a power-law distributed number with n = 1.5 between 0 and 1? – MJQZ1347 Apr 14 '15 at 09:30
  • No, it is not possible because such a distribution does not exist. – vib Apr 14 '15 at 09:45
  • What you can do is fix x_0 small but non zero, do your empirical study, and then divide x_0 by (say) 10 and re-do your empirical study. You should see that the numbers you get drift towards 0. If you keep dividing x_0 by 10 numbers will keep getting smaller and so you cannot take the limit x_0 ->0. – vib Apr 14 '15 at 09:53