No BSD License
-
AtkinsonIneq(w, epsilon)
The function computes the Atkinson Inequality Index for the wealth vector w associated to single individuals.
-
GiniCoeff(p, w)
The function computes the Gini Coefficient for populations p associated to wealth w.
-
GiniCoeff2(p, w)
The function computes a variant of the Gini Coefficient for populations p associated to wealth w.
-
TheilLIneq(w)
The function computes the Theil-L Inequality Index for the wealth vector w associated to single individuals.
-
TheilTIneq(w)
The function computes the Theil-T Inequality Index for the wealth vector w associated to single individuals.
-
plotLorenzCurve(p, w)
The function plots the Lorenz Curve, where populations from the poorer to the richer
-
View all files
from
Inequality Package
by Francesco Pozzi
Inequality Metrics: Gini Coefficient associated to the Lorenz Curve, Theil and Atkinson Indexes
|
| TheilTIneq(w)
|
function y = TheilTIneq(w)
% The function computes the Theil-T Inequality Index for the wealth vector w associated to single individuals.
% w must be non-negative (with at least one i such that w(i) > 0).
% The Theil Inequality Index is a measure of inequality, i.e. a measure of wealth concentration.
%
% http://en.wikipedia.org/wiki/Lorenz_curve
% http://en.wikipedia.org/wiki/Gini_coefficient
% http://en.wikipedia.org/wiki/Theil_index
% http://en.wikipedia.org/wiki/Atkinson_index
%
% -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
% -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
%
% % Example 1: Uniform U(0, 1)
% N = 1000; % Number of individuals
% w = rand(N, 1); % Wealth extracted from a Uniform U(0, 1)
% y = TheilTIneq(w)
% y =
%
% 0.1930
%
% -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
% -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
%
% % Example 2: Standard Normal z(0, 1)
% N = 1000; % Number of individuals
% mu = 4;
% w = mu + randn(N, 1); % Wealth extracted from a Normal N(mu, 1)
% w = abs(w); % Be careful: all values must be strictly positive!!!
% y = TheilTIneq(w)
% y =
%
% 0.0324
%
% -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
% -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
%
% % Example 3: LogNormal logN(0, 1)
% N = 1000; % Number of individuals
% w = exp(randn(N, 1)); % Wealth extracted from a LogNormal logN(0, 1)
% y = TheilTIneq(w)
% y =
%
% 0.4983
%
% -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
% -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
%
% % Example 4: Power Law PL(kappaPL, alphaPL)
% N = 1000; % Number of individuals
% kappaPL = 1;
% alphaPL = 2;
% w = kappaPL * (rand(N, 1) .^ (-1/alphaPL)); % Wealth extracted from a Power Law PL(kappaPL, alphaPL)
% y = TheilTIneq(w)
% y =
%
% 0.2965
%
% -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
% -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
%
% % Example 5: Mixture of LogNormal logN(0, 1) and Power Law PL(kappaPL, alphaPL)
% N = 1000; % Number of individuals
% alpha = floor(0.92 * N); % Number of individuals whose wealth is extracted from a LogNormal LogN(0, 1)
% w = exp(randn(alpha, 1)); % Wealth extracted from a LogNormal LogN(0, 1)
% kappaPL = 1;
% alphaPL = 2;
% w((alpha + 1):N) = kappaPL * (rand(N - alpha, 1) .^ (-1/alphaPL)); % Wealth extracted from a Power Law PL(kappaPL, alphaPL)
% y = TheilTIneq(w)
% y =
%
% 0.4805
%
% -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
% -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
%
% Written by
% Francesco Pozzi
% 19 May 2008
%
ctrl = isvector(w) & isnumeric(w) & isreal(w);
if ctrl
w = w(:);
w = w(~isnan(w) & ~isinf(w));
else
error('Wealth Values incorrect!')
end
ctrl = all(w >= 0) & any(w > 0);
if ~ctrl
error('Wealth Values incorrect!')
end
y = w / mean(w);
y = sum(y .* log(y))/ length(y);
|
|
Contact us at files@mathworks.com