Generate random numbers with truncated Pareto distribution

10 views (last 30 days)
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 Comment
Torsten
Torsten on 9 Nov 2022
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 ?

Sign in to comment.

Answers (2)

David Hill
David Hill on 9 Nov 2022
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

Bruno Luong
Bruno Luong on 9 Nov 2022
Edited: Bruno Luong on 9 Nov 2022
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')

Community Treasure Hunt

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

Start Hunting!