Categories &

Functions List

Class Definition: paretotails

statistics: paretotails

Piecewise distribution with generalized Pareto tails.

A paretotails object is a piecewise probability distribution fit to sample data. A generalized Pareto distribution (GPD) is fit to each tail of the data, below a lower quantile and above an upper quantile, while the middle of the distribution is described by the empirical cumulative distribution function of the data. This gives a smooth model for the tails, useful for extreme value analysis, together with a nonparametric description of the central region.

Create a paretotails object with the constructor pt = paretotails (x, pl, pu), where x is the sample data and pl and pu are the cumulative probabilities at the lower and upper tail boundaries. Data at or below the pl quantile form the lower tail, data at or above the pu quantile form the upper tail, and the rest form the middle segment.

Query the fitted object with the methods cdf, pdf, icdf, random, boundary, nsegments, segment, lowerparams, and upperparams.

Note: the kernel-smoothed middle option of MATLAB (paretotails (x, pl, pu, "kernel")) is not yet supported; only the default empirical ("ecdf") middle is available.

See also: gpfit, gpcdf, gppdf, gpinv, ecdf, fitdist, GeneralizedParetoDistribution

Source Code: paretotails

The paretotails class contains the following properties:

Fit Pareto tails to a normal sample and compare the tail cdf to the data

 x = norminv (((1:100) - 0.5) / 100);
 pt = paretotails (x, 0.1, 0.9);
 lowerparams (pt)
ans =

  -0.3813   0.6523
 [p, q] = boundary (pt)
p =

   0.1000
   0.9000

q =

  -1.2821
   1.2821
 cdf (pt, [-2.5, 0, 2.5])
ans =

   3.8240e-03   5.0000e-01   9.9618e-01

Fit Pareto tails to a normal sample and compare the tail cdf to the data

 x = norminv (((1:100) - 0.5) / 100);
 pt = paretotails (x, 0.1, 0.9);
 lowerparams (pt)
ans =

  -0.3813   0.6523
 [p, q] = boundary (pt)
p =

   0.1000
   0.9000

q =

  -1.2821
   1.2821
 cdf (pt, [-2.5, 0, 2.5])
ans =

   3.8240e-03   5.0000e-01   9.9618e-01

The paretotails class offers the following public methods:

paretotails: pt = paretotails (x, pl, pu)
paretotails: pt = paretotails (x, pl, pu, cdffun)

pl and pu are the cumulative probabilities of the lower and upper tail boundaries, with 0 <= pl < pu <= 1. A generalized Pareto distribution is fit by maximum likelihood to the exceedances in each tail; the middle segment uses the empirical cumulative distribution of x.

cdffun selects the middle segment and defaults to "ecdf"; the "kernel" option of MATLAB is not yet supported.

Fit Pareto tails to a normal sample and compare the tail cdf to the data

 x = norminv (((1:100) - 0.5) / 100);
 pt = paretotails (x, 0.1, 0.9);
 lowerparams (pt)
ans =

  -0.3813   0.6523
 [p, q] = boundary (pt)
p =

   0.1000
   0.9000

q =

  -1.2821
   1.2821
 cdf (pt, [-2.5, 0, 2.5])
ans =

   3.8240e-03   5.0000e-01   9.9618e-01
paretotails: p = cdf (pt, x)

Fit Pareto tails to a normal sample and compare the tail cdf to the data

 x = norminv (((1:100) - 0.5) / 100);
 pt = paretotails (x, 0.1, 0.9);
 lowerparams (pt)
ans =

  -0.3813   0.6523
 [p, q] = boundary (pt)
p =

   0.1000
   0.9000

q =

  -1.2821
   1.2821
 cdf (pt, [-2.5, 0, 2.5])
ans =

   3.8240e-03   5.0000e-01   9.9618e-01
paretotails: y = pdf (pt, x)

Fit Pareto tails to a normal sample and compare the tail cdf to the data

 x = norminv (((1:100) - 0.5) / 100);
 pt = paretotails (x, 0.1, 0.9);
 lowerparams (pt)
ans =

  -0.3813   0.6523
 [p, q] = boundary (pt)
p =

   0.1000
   0.9000

q =

  -1.2821
   1.2821
 cdf (pt, [-2.5, 0, 2.5])
ans =

   3.8240e-03   5.0000e-01   9.9618e-01
paretotails: x = icdf (pt, p)

Fit Pareto tails to a normal sample and compare the tail cdf to the data

 x = norminv (((1:100) - 0.5) / 100);
 pt = paretotails (x, 0.1, 0.9);
 lowerparams (pt)
ans =

  -0.3813   0.6523
 [p, q] = boundary (pt)
p =

   0.1000
   0.9000

q =

  -1.2821
   1.2821
 cdf (pt, [-2.5, 0, 2.5])
ans =

   3.8240e-03   5.0000e-01   9.9618e-01
paretotails: r = random (pt)
paretotails: r = random (pt, sz)
paretotails: r = random (pt, m, n, …)

Fit Pareto tails to a normal sample and compare the tail cdf to the data

 x = norminv (((1:100) - 0.5) / 100);
 pt = paretotails (x, 0.1, 0.9);
 lowerparams (pt)
ans =

  -0.3813   0.6523
 [p, q] = boundary (pt)
p =

   0.1000
   0.9000

q =

  -1.2821
   1.2821
 cdf (pt, [-2.5, 0, 2.5])
ans =

   3.8240e-03   5.0000e-01   9.9618e-01
paretotails: [p, q] = boundary (pt)

Fit Pareto tails to a normal sample and compare the tail cdf to the data

 x = norminv (((1:100) - 0.5) / 100);
 pt = paretotails (x, 0.1, 0.9);
 lowerparams (pt)
ans =

  -0.3813   0.6523
 [p, q] = boundary (pt)
p =

   0.1000
   0.9000

q =

  -1.2821
   1.2821
 cdf (pt, [-2.5, 0, 2.5])
ans =

   3.8240e-03   5.0000e-01   9.9618e-01
paretotails: n = nsegments (pt)

Fit Pareto tails to a normal sample and compare the tail cdf to the data

 x = norminv (((1:100) - 0.5) / 100);
 pt = paretotails (x, 0.1, 0.9);
 lowerparams (pt)
ans =

  -0.3813   0.6523
 [p, q] = boundary (pt)
p =

   0.1000
   0.9000

q =

  -1.2821
   1.2821
 cdf (pt, [-2.5, 0, 2.5])
ans =

   3.8240e-03   5.0000e-01   9.9618e-01
paretotails: params = lowerparams (pt)

Fit Pareto tails to a normal sample and compare the tail cdf to the data

 x = norminv (((1:100) - 0.5) / 100);
 pt = paretotails (x, 0.1, 0.9);
 lowerparams (pt)
ans =

  -0.3813   0.6523
 [p, q] = boundary (pt)
p =

   0.1000
   0.9000

q =

  -1.2821
   1.2821
 cdf (pt, [-2.5, 0, 2.5])
ans =

   3.8240e-03   5.0000e-01   9.9618e-01
paretotails: params = upperparams (pt)

Fit Pareto tails to a normal sample and compare the tail cdf to the data

 x = norminv (((1:100) - 0.5) / 100);
 pt = paretotails (x, 0.1, 0.9);
 lowerparams (pt)
ans =

  -0.3813   0.6523
 [p, q] = boundary (pt)
p =

   0.1000
   0.9000

q =

  -1.2821
   1.2821
 cdf (pt, [-2.5, 0, 2.5])
ans =

   3.8240e-03   5.0000e-01   9.9618e-01
paretotails: s = segment (pt, x, p)

Fit Pareto tails to a normal sample and compare the tail cdf to the data

 x = norminv (((1:100) - 0.5) / 100);
 pt = paretotails (x, 0.1, 0.9);
 lowerparams (pt)
ans =

  -0.3813   0.6523
 [p, q] = boundary (pt)
p =

   0.1000
   0.9000

q =

  -1.2821
   1.2821
 cdf (pt, [-2.5, 0, 2.5])
ans =

   3.8240e-03   5.0000e-01   9.9618e-01
paretotails: disp (pt)

Fit Pareto tails to a normal sample and compare the tail cdf to the data

 x = norminv (((1:100) - 0.5) / 100);
 pt = paretotails (x, 0.1, 0.9);
 lowerparams (pt)
ans =

  -0.3813   0.6523
 [p, q] = boundary (pt)
p =

   0.1000
   0.9000

q =

  -1.2821
   1.2821
 cdf (pt, [-2.5, 0, 2.5])
ans =

   3.8240e-03   5.0000e-01   9.9618e-01

Examples

 x = norminv (((1:100) - 0.5) / 100);
 pt = paretotails (x, 0.1, 0.9);
 lowerparams (pt)
ans =

  -0.3813   0.6523
 [p, q] = boundary (pt)
p =

   0.1000
   0.9000

q =

  -1.2821
   1.2821
 cdf (pt, [-2.5, 0, 2.5])
ans =

   3.8240e-03   5.0000e-01   9.9618e-01