NCL Home > Documentation > Functions > Statistics, Extreme values

# extval_frechet

Calculates the probability (PDF) and cumulative (CDF) distribution functions of the Frechet Type II distribution given the shape, scale and location parameters.

Available in version 6.4.0 and later.

## Prototype

```	function extval_frechet (
x          : numeric,
shape  [*] : numeric,
scale  [*] : numeric,
center [*] : numeric,
opt    [1] : integer
)

return_val [ variable of type list containing 2 variables [/ PDF, CDF /]
```

## Arguments

x

A numeric array.

shape

One dimensional array containing the shape parameter(s).

scale

One dimensional array containing the scale parameter(s). Must be the same size as shape.

center

One dimensional array containing the center (aka, location) parameter(s). Must be the same size as shape.

opt

Currently, not used. Set to zero.

## Return value

A variable of type 'list.' The list contains two variables: the PDF and the CDF. See Example(s).

## Description

Use the equations associated with the Frechet distribution to derive the associated PDFs and CDFs.

## Examples

Example 1

See plots at Example 3 of the Extreme Value Applications page.

```
N      = 1000
xMin   = 0.05
xMax   = 5.5
x      = fspan(xMin,xMax,N)

shape  = (/0.5, 1.0, 2.0, 3.0, 1.0, 2.0, 3.0/)
scale  = (/1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0/)
center = (/0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0/)

; Generate PDF and GDF distribution

pdfcdf = extval_frechet(x, shape, scale, center, 0)  ; return a variable of type 'list'
pdf    = pdfcdf[0]                      ; explicitly extract the 2 returned variables (for convenience only).
cdf    = pdfcdf[1]
delete(pdfcdf)       ; not necessary

printVarSummary(pdf)
printVarSummary(cdf)

```
The (edited) ourput is:
```
Variable: pdf
Type: float
Total Size: 28000 bytes
7000 values
Number of Dimensions: 2
Dimensions and sizes:      [7] x [1000]
Coordinates:
Number Of Attributes: 4
_FillValue :     9.96921e+36
long_name :      PDF Frechet: Extreme Value Type II: Maxima
shape :       ( 0.5,  1,  2,  3,  1,  2,  3 )
scale :  (  1,  1,  1,  1,  2,  2,  2 )
(0)        ---

Variable: cdf
Type: float
Total Size: 28000 bytes
7000 values
Number of Dimensions: 2
Dimensions and sizes:      [7] x [1000]
Coordinates:
Number Of Attributes: 4
_FillValue :     9.96921e+36
long_name :      CDF: Frechet: Extreme Value Type II: Maxima
shape :       ( 0.5,  1,  2,  3,  1,  2,  3 )
scale :  (  1,  1,  1,  1,  2,  2,  2 )
```