NCL Home > Documentation > Functions > Statistics, Extreme values

# extval_gev

Calculates the probability (PDF) and cumulative (CDF) distribution functions of the Generalized Extreme Value (GEV) distribution given the shape, scale and location parameters.

Available in version 6.4.0 and later.

## Prototype

```	function extval_gev (
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 Generalized Extreme Value (GEV) distribution to derive the PDF and CDF.

## Examples

Example 1

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

```   N      =  200
xMin   = -4.0
xMax   =  6.0
x      = fspan(xMin,xMax,N)

shape  = (/-0.5, 0.0, 0.5 /)
scale  = (/ 1.0, 1.0, 1.0 /)      ; sigma
center = (/ 0.0, 0.0, 0.0 /)      ; location, shift

; Generate PDF and GDF distribution

pdfcdf = extval_gev(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) output is:
```
Variable: pdf
Type: float
Total Size: 2400 bytes
600 values
Number of Dimensions: 2
Dimensions and sizes:      [3] x [200]
Coordinates:
Number Of Attributes: 4
_FillValue :     9.96921e+36
long_name :      PDF: Generalized Extreme Value
shape :       ( -0.5,  0, 0.5 )
scale :       (  1,  1,  1 )
center :      (  0,  0,  0 )
(0)
(0)        PDF: Generalized Extreme Value: min=-0   max=0.428846
(0)        ---

Variable: cdf
Type: float
Total Size: 2400 bytes
600 values
Number of Dimensions: 2
Dimensions and sizes:      [3] x [200]
Coordinates:
Number Of Attributes: 2
_FillValue :     9.96921e+36
long_name :      CDF: Generalized Extreme Value
shape :       ( -0.5,  0, 0.5 )
scale :       (  1,  1,  1 )
center :      (  0,  0,  0 )
(0)
(0)        CDF: Generalized Extreme Value: min=0   max=0.999899
```