Simulation of random number {RFA}R Documentation

Generate random number and fit the 4 parameter Kappa distribution with L-moments.

Description

Generate random number of the 4 parameter Kappa distribution. This distribution encompass the Generalized Extreme Value, Generalized Pareto and Generalized Logistic distributions.

Usage

rkappa(n, loc, scale, shape1, shape2)
rgpd(n, loc = 0, scale = 1, shape = 0)
rgev(n, loc = 0, scale = 1, shape = 0)
qgpd(p, loc = 0, scale = 1, shape = 0, lower.tail = TRUE)
kappalmom(lmom)

Arguments

n Numeric. The number of pseudo-random number to be generated.
p Numeric. The probability for which the quantile has to be computed.
loc, scale, shape, shape1, shape2 Numerics. The location, scale and shape parameters.
lower.tail Logical. If TRUE the default, the quantile associated to probability p of non exceedance is computed. Otherwise, this is related to the probability of exceedance.
lmom Numeric vector of length 4. The first 4 sample L-moments, that is the sample mean, L-CV, L-Skewness and L-Kurtosis.

Details

The 4-parameter Kappa distribution has cumulative distribution function

F(x) = [1 - shape2{1 + shape1(x - loc) / scale }^(-1/shape1)]^(1/shape2)

For shape2 = -1, this is the Generalized Logistic distribution, for shape2 = 0, the Generalized Extreme Value distribution and for shape2 = 1, the Generalized Pareto distribution.

Function kappalmom uses sample L-moments to fit the Kappa distribution. Newtow-Raphson iteration is used to solve the equations that express tau_3 and tau_4 as functions of shape1 et shape2. loc and scale are calculated as functions of lambda_1, tau, shape1 and shape2. To ensure a 1-1 relationship between parameters and L-moments, the parameter space is restricted. See reference for more details.

Value

The program return either a numeric vector containing estimates of the location, scale and shape parameter of the Kappa distribution either a fail flag informing a problem in the optimization algorithm.
'1' L-moments invalid
'2' (tau_3, tau_4) lies above the generalized-logistic line (suggests that l-moments are not consistent with any kappa distribution with shape2 > -1)
'3' iteration failed to converge
'4' unable to make progress from current point in iteration
'5' iteration encountered numerical difficulties - overflow would have been likely to occur
'6' iteration for the shape parameters converged, but overflow would have occurred when calculating location and scale parameters.

Author(s)

Ribatet Mathieu and Hosking J. R. M. for the fortran code.

References

Hosking, J. R. M. (1994) The four-parameter kappa distribution. IBM Journal of Research and Development, 38, 251-258


[Package RFA version 0.0-8 Index]