Generating integer random numbers from power-law distribution

2 vues (au cours des 30 derniers jours)
Sunstar
Sunstar le 13 Déc 2013
Is there a code to generate integer random numbers through power-law distribution of the form p(x)=x^-(alpha+1)?
thanks in advance

Réponse acceptée

Image Analyst
Image Analyst le 13 Déc 2013
Try this: RANDRAW

Plus de réponses (3)

Miguel Ángel
Miguel Ángel le 13 Déc 2013
Modifié(e) : Miguel Ángel le 13 Déc 2013
I don't know if round,ceil or floor is correct, but in case this may be a way
n=1000;
p=rand(1,n);
alpha=0.1;
%inverse of distribution
%properties of logs %LOGa(n) = LOGb(N) / LOGb(a)
%~round/ceil/floor
x=round(log(p)/log(alpha+1));
  1 commentaire
Sunstar
Sunstar le 13 Déc 2013
Thank you for your reply. Unfortunately, I cannot simply round or floor or ceil. I need to generate real integers.

Connectez-vous pour commenter.


Roger Stafford
Roger Stafford le 13 Déc 2013
The distribution you mention is equivalent to the zeta distribution with alpha+1 replaced by s. See the website
http://en.wikipedia.org/wiki/Zeta_distribution
As Image Analyst has mentioned, there is a File Exchange contribution called 'randraw' which is located at:
http://www.mathworks.com/matlabcentral/fileexchange/7309-randraw
which claims to generate random numbers in accordance with fifty various distributions including the zeta distribution. It might be what you need.
  1 commentaire
Sunstar
Sunstar le 13 Déc 2013
Thank you! I am also considering Zipf generators.

Connectez-vous pour commenter.


Weijia Chen
Weijia Chen le 18 Sep 2019
I also meet the same problem. The minimum integer that zeta distribution can generate seems to be 1, but I hope 0 can be generated. Is there any other distributin can do this? Thank you

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by