Report a bug
If you spot a problem with this page, click here to create a GitHub issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

mir.stat.distribution.generalized_pareto

This module contains algorithms for the Generalized Pareto Distribution.
License:
Authors:
John Michael Hall
pure nothrow @nogc @safe T generalizedParetoPDF(T)(const T x, const T mu, const T sigma, const T xi)
if (isFloatingPoint!T);
Computes the generalized pareto probability density function (PDF).
Parameters:
T x value to evaluate PDF
T mu location parameter
T sigma scale parameter
T xi shape parameter
Examples:
import mir.test: shouldApprox;

1.0.generalizedParetoPDF(1, 1, 0.5).shouldApprox == 1;
2.0.generalizedParetoPDF(1, 1, 0.5).shouldApprox == 0.2962963;
3.0.generalizedParetoPDF(2, 3, 0.25).shouldApprox == 0.2233923;
5.0.generalizedParetoPDF(2, 3, 0).shouldApprox == 0.3678794;
pure nothrow @nogc @safe T generalizedParetoCDF(T)(const T x, const T mu, const T sigma, const T xi)
if (isFloatingPoint!T);
Computes the generalized pareto cumulative distribution function (CDF).
Parameters:
T x value to evaluate CDF
T mu location parameter
T sigma scale parameter
T xi shape parameter
Examples:
import mir.test: shouldApprox;

1.0.generalizedParetoCDF(1, 1, 0.5).shouldApprox == 0;
2.0.generalizedParetoCDF(1, 1, 0.5).shouldApprox == 0.5555556;
3.0.generalizedParetoCDF(2, 3, 0.25).shouldApprox == 0.273975;
5.0.generalizedParetoCDF(2, 3, 0).shouldApprox == 0.6321206;
pure nothrow @nogc @safe T generalizedParetoCCDF(T)(const T x, const T mu, const T sigma, const T xi)
if (isFloatingPoint!T);
Computes the generalized pareto complementary cumulative distribution function (CCDF).
Parameters:
T x value to evaluate CCDF
T mu location parameter
T sigma scale parameter
T xi shape parameter
Examples:
import mir.test: shouldApprox;

1.0.generalizedParetoCCDF(1, 1, 0.5).shouldApprox == 1;
2.0.generalizedParetoCCDF(1, 1, 0.5).shouldApprox == 0.4444444;
3.0.generalizedParetoCCDF(2, 3, 0.25).shouldApprox == 0.726025;
5.0.generalizedParetoCCDF(2, 3, 0).shouldApprox == 0.3678794;
pure nothrow @nogc @safe T generalizedParetoInvCDF(T)(const T p, const T mu, const T sigma, const T xi)
if (isFloatingPoint!T);
Computes the generalized pareto inverse cumulative distribution function (InvCDF).
Parameters:
T p value to evaluate InvCDF
T mu location parameter
T sigma scale parameter
T xi shape parameter
Examples:
import mir.test: shouldApprox;

0.0.generalizedParetoInvCDF(1, 1, 0.5).shouldApprox == 1;
0.5555556.generalizedParetoInvCDF(1, 1, 0.5).shouldApprox == 2;
0.273975.generalizedParetoInvCDF(2, 3, 0.25).shouldApprox == 3;
0.6321206.generalizedParetoInvCDF(2, 3, 0).shouldApprox == 5;
pure nothrow @nogc @safe T generalizedParetoLPDF(T)(const T x, const T mu, const T sigma, const T xi)
if (isFloatingPoint!T);
Computes the generalized pareto log probability density function (LPDF).
Parameters:
T x value to evaluate LPDF
T mu location parameter
T sigma scale parameter
T xi shape parameter
Examples:
import mir.math.common: log;
import mir.test: shouldApprox;

1.0.generalizedParetoLPDF(1, 1, 0.5).shouldApprox == log(generalizedParetoPDF(1.0, 1, 1, 0.5));
2.0.generalizedParetoLPDF(1, 1, 0.5).shouldApprox == log(generalizedParetoPDF(2.0, 1, 1, 0.5));
3.0.generalizedParetoLPDF(2, 3, 0.25).shouldApprox == log(generalizedParetoPDF(3.0, 2, 3, 0.25));
5.0.generalizedParetoLPDF(2, 3, 0).shouldApprox == log(generalizedParetoPDF(5.0, 2, 3, 0));