gppdf
statistics: y = gppdf (x, k, sigma, theta)
Generalized Pareto probability density function (PDF).
For each element of x, compute the probability density function (PDF) of the generalized Pareto distribution with shape parameter k, scale parameter sigma, and location parameter theta. The size of y is the common size of p, k, sigma, and theta. A scalar input functions as a constant matrix of the same size as the other inputs.
When k = 0 and theta = 0, the Generalized Pareto
is equivalent to the exponential distribution. When k > 0 and
theta = k / k the Generalized Pareto is equivalent
to the Pareto distribution. The mean of the Generalized Pareto is not finite
when k >= 1 and the variance is not finite when
k >= 1/2. When k >= 0, the Generalized Pareto
has positive density for x > theta, or, when
theta < 0, for
0 <= (x - theta) / sigma <= -1 / k.
Further information about the generalized Pareto distribution can be found at https://en.wikipedia.org/wiki/Generalized_Pareto_distribution
Input arguments must be double or single; integer, logical,
and character arrays are rejected. MATLAB accepts a character array and
evaluates it at the character codes, which Octave deliberately does not,
since a character array is an integer type and integers are refused too.
With a negative shape parameter the support is the closed interval
[theta, theta - sigma/k], and the density at
its upper endpoint follows the limit of the density there: 0 for
-1 < k < 0, 1/sigma at k = -1, and
unbounded for k < -1. MATLAB returns 0 at that endpoint
whatever the shape, which contradicts its own unifpdf: the
generalized Pareto with k = -1 is the uniform
distribution on [theta, theta + sigma], for which
MATLAB’s unifpdf returns 1/sigma at the same point. This
implementation returns the limit, and so agrees with unifpdf.
See also: gpcdf, gpinv, gprnd, gpfit, gplike, gpstat
Source Code: gppdf
Plot various PDFs from the generalized Pareto distribution
x = 0:0.001:5;
y1 = gppdf (x, 1, 1, 0);
y2 = gppdf (x, 5, 1, 0);
y3 = gppdf (x, 20, 1, 0);
y4 = gppdf (x, 1, 2, 0);
y5 = gppdf (x, 5, 2, 0);
y6 = gppdf (x, 20, 2, 0);
plot (x, y1, '-b', x, y2, '-g', x, y3, '-r', ...
x, y4, '-c', x, y5, '-m', x, y6, '-k')
grid on
xlim ([0, 5])
ylim ([0, 1])
legend ({'k = 1, σ = 1, θ = 0', 'k = 5, σ = 1, θ = 0', ...
'k = 20, σ = 1, θ = 0', 'k = 1, σ = 2, θ = 0', ...
'k = 5, σ = 2, θ = 0', 'k = 20, σ = 2, θ = 0'}, ...
'location', 'northeast')
title ('Generalized Pareto PDF')
xlabel ('values in x')
ylabel ('density')