Accelerating the pace of engineering and science

# paretotails

Class: paretotails

Construct Pareto tails object

## Syntax

obj = paretotails(x,pl,pu)
obj = paretotails(x,pl,pu,cdffun)

## Description

obj = paretotails(x,pl,pu) creates an object obj defining a distribution consisting of the empirical distribution of x in the center and Pareto distributions in the tails. x is a real-valued vector of data values whose extreme observations are fit to generalized Pareto distributions (GPDs). pl and pu identify the lower- and upper-tail cumulative probabilities such that 100*pl and 100*(1-pu) percent of the observations in x are, respectively, fit to a GPD by maximum likelihood. If pl is 0, or if there are not at least two distinct observations in the lower tail, then no lower Pareto tail is fit. If pu is 1, or if there are not at least two distinct observations in the upper tail, then no upper Pareto tail is fit.

obj = paretotails(x,pl,pu,cdffun) uses cdffun to estimate the cdf of x between the lower and upper tail probabilities. cdffun may be any of the following:

• 'ecdf' — Uses an interpolated empirical cdf, with data values as the midpoints in the vertical steps in the empirical cdf, and computed by linear interpolation between data values. This is the default.

• 'kernel' — Uses a kernel-smoothing estimate of the cdf.

• @fun — Uses a handle to a function of the form [p,xi] = fun(x) that accepts the input data vector x and returns a vector p of cdf values and a vector xi of evaluation points. Values in xi must be sorted and distinct but need not equal the values in x.

cdffun is used to compute the quantiles corresponding to pl and pu by inverse interpolation, and to define the fitted distribution between these quantiles.

The output object obj is a Pareto tails object with methods to evaluate the cdf, inverse cdf, and other functions of the fitted distribution. These methods are well-suited to copula and other Monte Carlo simulations. The pdf method in the tails is the GPD density, but in the center it is computed as the slope of the interpolated cdf.

The paretotails class is a subclass of the piecewisedistribution class, and many of its methods are derived from that class.

## Examples

expand all

### Fit Pareto Tails to a Probability Distribution

Generate sample data containing 100 random numbers from a t distribution with 3 degrees of freedom.

```rng default;  % For reproducibility
t = trnd(3,100,1);
```

Fit pareto tails to the distribution at cumulative probabilities 0.1 and 0.9.

```obj = paretotails(t,0.1,0.9);
[p,q] = boundary(obj);
```

Plot the cdf of the Pareto tails and the cdf of the fitted t distribution on the same figure.

```x = linspace(-5,5);
plot(x,cdf(obj,x),'b-','LineWidth',2)
hold on;
plot(x,tcdf(x,3),'r:','LineWidth',2)
plot(q,p,'bo','LineWidth',2,'MarkerSize',5)
legend('Pareto Tails Object','t Distribution',...
'Location','NW')
hold off;
```