GEV {nsRFA} | R Documentation |
Three parameter generalized extreme value distribution and L-moments
Description
GEV
provides the link between L-moments of a sample and the three parameter
generalized extreme value distribution.
Usage
f.GEV (x, xi, alfa, k)
F.GEV (x, xi, alfa, k)
invF.GEV (F, xi, alfa, k)
Lmom.GEV (xi, alfa, k)
par.GEV (lambda1, lambda2, tau3)
rand.GEV (numerosita, xi, alfa, k)
Arguments
x |
vector of quantiles |
xi |
vector of GEV location parameters |
alfa |
vector of GEV scale parameters |
k |
vector of GEV shape parameters |
F |
vector of probabilities |
lambda1 |
vector of sample means |
lambda2 |
vector of L-variances |
tau3 |
vector of L-CA (or L-skewness) |
numerosita |
numeric value indicating the length of the vector to be generated |
Details
See https://en.wikipedia.org/wiki/Generalized_extreme_value_distribution for an introduction to the GEV distribution.
Definition
Parameters (3): \xi
(location), \alpha
(scale), k
(shape).
Range of x
: -\infty < x \le \xi + \alpha / k
if k>0
;
-\infty < x < \infty
if k=0
;
\xi + \alpha / k \le x < \infty
if k<0
.
Probability density function:
f(x) = \alpha^{-1} e^{-(1-k)y - e^{-y}}
where y = -k^{-1}\log\{1 - k(x - \xi)/\alpha\}
if k \ne 0
,
y = (x-\xi)/\alpha
if k=0
.
Cumulative distribution function:
F(x) = e^{-e^{-y}}
Quantile function:
x(F) = \xi + \alpha[1-(-\log F)^k]/k
if k \ne 0
,
x(F) = \xi - \alpha \log(-\log F)
if k=0
.
k=0
is the Gumbel distribution; k=1
is the reverse exponential distribution.
L-moments
L-moments are defined for k>-1
.
\lambda_1 = \xi + \alpha[1 - \Gamma (1+k)]/k
\lambda_2 = \alpha (1-2^{-k}) \Gamma (1+k)]/k
\tau_3 = 2(1-3^{-k})/(1-2^{-k})-3
\tau_4 = [5(1-4^{-k})-10(1-3^{-k})+6(1-2^{-k})]/(1-2^{-k})
Here \Gamma
denote the gamma function
\Gamma (x) = \int_0^{\infty} t^{x-1} e^{-t} dt
Parameters
To estimate k
, no explicit solution is possible, but the following approximation has accurancy better than 9 \times 10^{-4}
for -0.5 \le \tau_3 \le 0.5
:
k \approx 7.8590 c + 2.9554 c^2
where
c = \frac{2}{3+\tau_3} - \frac{\log 2}{\log 3}
The other parameters are then given by
\alpha = \frac{\lambda_2 k}{(1-2^{-k})\Gamma(1+k)}
\xi = \lambda_1 - \alpha[1 - \Gamma(1+k)]/k
Lmom.GEV
and par.GEV
accept input as vectors of equal length. In f.GEV
, F.GEV
, invF.GEV
and rand.GEV
parameters (xi
, alfa
, k
) must be atomic.
Value
f.GEV
gives the density f
, F.GEV
gives the distribution function F
, invF.GEV
gives
the quantile function x
, Lmom.GEV
gives the L-moments (\lambda_1
, \lambda_2
, \tau_3
, \tau_4
), par.GEV
gives the parameters (xi
, alfa
, k
), and rand.GEV
generates random deviates.
Note
For information on the package and the Author, and for all the references, see nsRFA
.
See Also
rnorm
, runif
, EXP
, GENLOGIS
, GENPAR
, GUMBEL
, KAPPA
, LOGNORM
, P3
; DISTPLOTS
, GOFmontecarlo
, Lmoments
.
Examples
data(hydroSIMN)
annualflows
summary(annualflows)
x <- annualflows["dato"][,]
fac <- factor(annualflows["cod"][,])
split(x,fac)
camp <- split(x,fac)$"45"
ll <- Lmoments(camp)
parameters <- par.GEV(ll[1],ll[2],ll[4])
f.GEV(1800,parameters$xi,parameters$alfa,parameters$k)
F.GEV(1800,parameters$xi,parameters$alfa,parameters$k)
invF.GEV(0.7518357,parameters$xi,parameters$alfa,parameters$k)
Lmom.GEV(parameters$xi,parameters$alfa,parameters$k)
rand.GEV(100,parameters$xi,parameters$alfa,parameters$k)
Rll <- regionalLmoments(x,fac); Rll
parameters <- par.GEV(Rll[1],Rll[2],Rll[4])
Lmom.GEV(parameters$xi,parameters$alfa,parameters$k)