LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
Pareto.m
1classdef Pareto < ContinuousDistribution
2 % The Pareto statistical distribution
3 %
4 % Copyright (c) 2012-2026, Imperial College London
5 % All rights reserved.
6
7 methods
8 function self = Pareto(shape, scale)
9 % SELF = PARETO(SHAPE, SCALE)
10
11 % Constructs a Pareto distribution with given shape and scale
12 % parameters
13 self@ContinuousDistribution('Pareto',2,[0,Inf]);
14 if shape < 2
15 line_error(mfilename,'shape parameter must be >= 2.0');
16 end
17 setParam(self, 1, 'alpha', shape);
18 setParam(self, 2, 'k', scale);
19 end
20
21 function ex = getMean(self)
22 % EX = GETMEAN()
23
24 % Get distribution mean
25 shape = self.getParam(1).paramValue;
26 scale = self.getParam(2).paramValue;
27 ex = shape * scale / (shape - 1);
28 end
29
30 function SCV = getSCV(self)
31 % SCV = GETSCV()
32
33 % Get distribution squared coefficient of variation (SCV = variance / mean^2)
34 shape = self.getParam(1).paramValue;
35 scale = self.getParam(2).paramValue;
36 VAR = scale^2 * shape / (shape - 1)^2 / (shape - 2);
37 ex = shape * scale / (shape - 1);
38 SCV = VAR / ex^2;
39 end
40
41 function X = sample(self, n)
42 % X = SAMPLE(N)
43
44 % Get n samples from the distribution
45 if nargin<2 %~exist('n','var'),
46 n = 1;
47 end
48 shape = self.getParam(1).paramValue;
49 scale = self.getParam(2).paramValue;
50 k = 1/shape;
51 sigma = scale * k;
52 X = gprnd(k, sigma, sigma/k, n, 1);
53 end
54
55 function Ft = evalCDF(self,t)
56 % FT = EVALCDF(SELF,T)
57
58 % Evaluate the cumulative distribution function at t
59 % AT T
60
61 shape = self.getParam(1).paramValue;
62 scale = self.getParam(2).paramValue;
63 k = 1/shape;
64 sigma = scale * k;
65 Ft = gpcdf(t, k, sigma, sigma/k);
66 end
67
68 function L = evalLST(self, s)
69 % L = EVALST(S)
70 % Evaluate the Laplace-Stieltjes transform of the distribution function at s
71 % The LST of Pareto distribution doesn't have a simple closed form.
72 % We compute it numerically using the definition: E[e^(-sX)] = ∫_{k}^∞ e^(-sx) f(x) dx
73 % where f(x) is the Pareto PDF: α*k^α / x^(α+1) for x >= k
74
75 alpha = self.getParam(1).paramValue; % shape parameter
76 k = self.getParam(2).paramValue; % scale parameter
77
78 % Use numerical integration
79 % For practical purposes, we integrate up to a reasonable upper bound
80 upperBound = k * (1000)^(1/alpha); % covers most of the distribution
81 n = 1000;
82 dx = (upperBound - k) / n;
83 L = 0.0;
84
85 for i = 1:n
86 x = k + i * dx;
87 if x >= k
88 % Pareto PDF: α*k^α / x^(α+1)
89 pdf = alpha * k^alpha / x^(alpha + 1);
90 L = L + exp(-s * x) * pdf;
91 end
92 end
93
94 L = L * dx;
95
96 % OLD IMPLEMENTATION (using integral function):
97 % Saralees Nadarajah & Samuel Kotz.
98 % On the Laplace transform of the Pareto distribution
99 % Queueing Syst (2006) 54:243-244
100 % DOI 10.1007/s11134-006-0299-1
101 % L = [];
102 % for s=sl(:)'
103 % alpha = self.getParam(1).paramValue;
104 % k = self.getParam(2).paramValue;
105 % IL = integral(@(t)t.^(-alpha-1).*exp(-t),s*k,Inf);
106 % L(end+1) = alpha*k^alpha*IL*s^(1+alpha)/s;
107 % %a = shape; b = scale; L = integral(@(x) a*b^a*exp(-s*x)./(x).^(a+1),b,1e6);
108 % end
109 end
110
111 function proc = getProcess(self)
112 % PROC = GETPROCESS()
113
114 % Get process representation with actual distribution parameters
115 % Returns {shape (alpha), scale (k)} for Pareto distribution
116 proc = {self.getParam(1).paramValue, self.getParam(2).paramValue};
117 end
118 end
119
120 methods (Static)
121 function pa = fitMeanAndSCV(MEAN, SCV)
122 % PA = FITMEANANDSCV(MEAN, SCV)
123
124 % Fit distribution with given mean and squared coefficient of variation (SCV=variance/mean^2)
125 % For Pareto distribution with shape alpha and scale k:
126 % Mean = alpha*k / (alpha-1)
127 % SCV = 1 / (alpha*(alpha-2))
128 %
129 % Solving for alpha from SCV:
130 % alpha*(alpha-2) = 1/SCV
131 % alpha^2 - 2*alpha - 1/SCV = 0
132 % alpha = 1 + sqrt(1 + 1/SCV) (taking positive root, need alpha > 2)
133 %
134 % Then scale k from mean:
135 % k = MEAN * (alpha-1) / alpha
136
137 shape = 1 + sqrt(1 + 1/SCV);
138 scale = MEAN * (shape - 1) / shape;
139 pa = Pareto(shape, scale);
140 end
141 end
142
143end