P3 {nsRFA}R Documentation

Three parameters Pearson type III distribution and L-moments

Description

P3 provides the link between L-moments of a sample and the three parameter Pearson type III distribution.

Usage

f.gamma (x, xi, beta, alfa)
F.gamma (x, xi, beta, alfa)
invF.gamma (F, xi, beta, alfa)
Lmom.gamma (xi, beta, alfa)
par.gamma (lambda1, lambda2, tau3)
rand.gamma (numerosita, xi, beta, alfa)
mom2par.gamma (mu, sigma, gamm)
par2mom.gamma (alfa, beta, xi)

Arguments

x

vector of quantiles

mu

vector of gamma mean

sigma

vector of gamma standard deviation

gamm

vector of gamma third moment

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

alfa

vector of gamma shape parameters

beta

vector of gamma scale parameters

xi

vector of gamma location parameters

Details

See http://en.wikipedia.org/wiki/Pearson_distribution for an introduction to the Pearson distribution, and http://en.wikipedia.org/wiki/Gamma_distribution for an introduction to the Gamma distribution (the Pearson type III distribution is, essentially, a Gamma distribution with 3 parameters).

Definition

Parameters (3): ξ (location), β (scale), α (shape). Moments (3): μ (mean), σ (standard deviation), γ (skewness).

If γ \ne 0, let α=4/γ^2, β=\frac{1}{2}σ |γ|, and ξ= μ - 2 σ/γ. If γ > 0, then the range of x is ξ ≤ x < ∞ and

f(x) = \frac{(x - ξ)^{α - 1} e^{-(x-ξ)/β}}{β^{α} Γ(α)}

F(x) = G ≤ft(α, \frac{x-ξ}{β}\right)/ Γ(α)

If γ=0, then the distribution is Normal, the range of x is -∞ < x < ∞ and

f(x) = φ ≤ft(\frac{x-μ}{σ}\right)

F(x) = Φ ≤ft(\frac{x-μ}{σ}\right)

where φ(x)=(2π)^{-1/2}\exp(-x^2/2) and Φ(x)=\int_{-∞}^x φ(t)dt.

If γ < 0, then the range of x is -∞ < x ≤ ξ and

f(x) = \frac{(ξ - x)^{α - 1} e^{-(ξ-x)/β}}{β^{α} Γ(α)}

F(x) = G ≤ft(α, \frac{ξ-x}{β}\right)/ Γ(α)

In each case, x(F) has no explicit analytical form. Here Γ is the gamma function, defined as

Γ (x) = \int_0^{∞} t^{x-1} e^{-t} dt

and

G(α, x) = \int_0^x t^{α-1} e^{-t} dt

is the incomplete gamma function.

γ=2 is the exponential distribution; γ=0 is the Normal distribution; γ=-2 is the reverse exponential distribution.

The parameters μ, σ and γ are the conventional moments of the distribution.

L-moments

Assuming γ>0, L-moments are defined for 0<α<∞.

λ_1 = ξ + α β

λ_2 = π^{-1/2} β Γ(α + 1/2)/Γ(α)

τ_3 = 6 I_{1/3} (α, 2 α)-3

where I_x(p,q) is the incomplete beta function ratio

I_x(p,q) = \frac{Γ(p+q)}{Γ(p)Γ(q)} \int_0^x t^{p-1} (1-t)^{q-1} dt

There is no simple expression for τ_4. Here we use the rational-funcion approximation given by Hosking and Wallis (1997, pp. 201-202).

The corresponding results for γ <0 are obtained by changing the signs of λ_1, τ_3 and ξ wherever they occur above.

Parameters

alpha is obtained with an approximation. If 0<|τ_3|<1/3, let z=3 π τ_3^2 and use

α \approx \frac{1+0.2906 z}{z + 0.1882 z^2 + 0.0442 z^3}

if 1/3<|τ_3|<1, let z=1-|τ_3| and use

α \approx \frac{0.36067 z - 0.59567 z^2 + 0.25361 z^3}{1-2.78861 z + 2.56096 z^2 -0.77045 z^3}

Given α, then γ=2 α^{-1/2} sign(τ_3), σ=λ_2 π^{1/2} α^{1/2} Γ(α)/Γ(α+1/2), μ=λ_1.

Lmom.gamma and par.gamma accept input as vectors of equal length. In f.gamma, F.gamma, invF.gamma and rand.gamma parameters (mu, sigma, gamm) must be atomic.

Value

f.gamma gives the density f, F.gamma gives the distribution function F, invFgamma gives the quantile function x, Lmom.gamma gives the L-moments (λ_1, λ_2, τ_3, τ_4), par.gamma gives the parameters (mu, sigma, gamm), and rand.gamma generates random deviates.

mom2par.gamma returns the parameters α, β and ξ, given the parameters (moments) μ, σ, γ.

Note

For information on the package and the Author, and for all the references, see nsRFA.

See Also

rnorm, runif, EXP, GENLOGIS, GENPAR, GEV, GUMBEL, KAPPA, LOGNORM; 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.gamma(ll[1],ll[2],ll[4])
f.gamma(1800,parameters$xi,parameters$beta,parameters$alfa)
F.gamma(1800,parameters$xi,parameters$beta,parameters$alfa)
invF.gamma(0.7511627,parameters$xi,parameters$beta,parameters$alfa)
Lmom.gamma(parameters$xi,parameters$beta,parameters$alfa)
rand.gamma(100,parameters$xi,parameters$beta,parameters$alfa)

Rll <- regionalLmoments(x,fac); Rll
parameters <- par.gamma(Rll[1],Rll[2],Rll[4])
Lmom.gamma(parameters$xi,parameters$beta,parameters$alfa)

moments <- par2mom.gamma(parameters$alfa,parameters$beta,parameters$xi); moments
mom2par.gamma(moments$mu,moments$sigma,moments$gamm)

[Package nsRFA version 0.7-14 Index]