power law distribution, How could I generate random variables from the truncated power -law distribution and its PDf?
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Show older comments
How could I generate random variables from the truncated power -law distribution and its PDf?
Accepted Answer
Image Analyst
on 6 Oct 2014
You need to use inverse transform sampling. I attached a demo where I use it to get random numbers from a Rayleigh distribution.
11 Comments
unable to find CDF and PDF for Power law distribution ?
I mean in terms of normal distribution all we need is sgm and mu but in this case how could I find aplha?
Thanks
Huh? I think you've forgotten to supply some information, such as your equation. I don't know what alpha is. Maybe you'd like to just use RANDRAW: http://www.mathworks.com/matlabcentral/fileexchange/7309-randraw
If I following inverse transform sampling I need to define my probability function for power law distribution and for that I need value of aplha [can be any value] but I' wondering if this parameter is same as let say normal distribuion needs mu and sgma. Is there any formulation to find out alpha?
Thanks
If you have the formula, you can use it. Otherwise generate a distribution with the PDF formula and numerically integrate to get the CDF with cumsum(). You can use the cumsum() output as a lookup table if you don't have the exact formula for the CDF.
what if my PDF is f(x) = (aplpha-1/xmin)(x/xmin)^-alpha
i followed your code but at the end if I plot histogram of resultant distribution im not getting exactly power law dist instead Im getting double exponential.
What is the range of x you're putting in. And what are some typical values for xmin and alpha that you're using?
amberly hadden
on 6 Oct 2014
Edited: Image Analyst
on 7 Oct 2014
I'm using following :
n=1000;
x=rand(1,n);
for i = 1:1000
a = 2.5;
P(i) = ((a - 1)/min(y))*(y(i)/min(y)^(-a))% this PDF
end
jay, that's not right. You didn't follow the recipe. See my attached demo (below the plots) for a full illustration.

Hi Thanks,
It turns out if I have to use your inverse transformation then I need to integrate PDF to get CDF and then I can consider CDF as uniform number apply your technique. Thanks for this code it solved my problem.
Regards Jay
You're welcome. Since I solved your problem, could you go ahead and mark the Answer as "Accepted" so I get credit for it? Thanks in advance.
More Answers (0)
Categories
Find more on Mathematics in Help Center and File Exchange
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)