Generate random numbers with truncated Pareto distribution
9 ビュー (過去 30 日間)
古いコメントを表示
I am wanting to generate a series of random numbers from a truncated Pareto distribution. I can see there is a function in matlab for a generalized pareto, but is there a way to do a truncated Pareto?
1 件のコメント
Torsten
2022 年 11 月 9 日
Could you include the cumulative distribution function of the truncated Pareto distribution you are talking about ?
Is it
F(x) = (1-(a/x)^c) / (1-(a/b)^c)
for a <= x <= b ?
回答 (2 件)
David Hill
2022 年 11 月 9 日
Just write a simple function
function x = ranPareto_trunc(H,L,alpha,n)%H=upper, L=lower, alpha>0, n=number of random numbers desired
u=rand(1,n);
x=(-(u*H^alpha-u*L^alpha-H^alpha)/H^alpha/L^alpha).^(-1/alpha);
end
0 件のコメント
Bruno Luong
2022 年 11 月 9 日
編集済み: Bruno Luong
2022 年 11 月 9 日
According the https://en.wikipedia.org/wiki/Pareto_distribution
the pareto has bounded on the lower side by what they called xm.
So I introduce the upper bound
% up > xm
For the shape parameter alpha, r is N realization of conditiona pareto probability distribution such that r < up (bounded or truncated pareto) can be obtained as following
alpha = 2; % % distribution tail index parameter
xm = 1; % lower bound
up = 3; % upper bound
N = 1e6;
% Generate by method of inverse of cdf
a = 1-(xm/up)^alpha;
r = (1-a*rand(1,N)).^(-1/alpha)*xm;
% Graphic check
histogram(r, 'Normalization', 'pdf')
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!