P3 function

Three parameters Pearson type III distribution and L-moments

Three parameters Pearson type III distribution and L-moments

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

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 https://en.wikipedia.org/wiki/Pearson_distribution for an introduction to the Pearson distribution, and https://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): ξ\xi (location), β\beta (scale), α\alpha (shape). Moments (3): μ\mu (mean), σ\sigma (standard deviation), γ\gamma (skewness).

If γ0\gamma \ne 0, let α=4/γ2\alpha=4/\gamma^2, β=12σγ\beta=\frac{1}{2}\sigma |\gamma|, and ξ=μ2σ/γ\xi= \mu - 2 \sigma/\gamma. If γ>0\gamma > 0, then the range of xx is ξx<\xi \le x < \infty and

f(x)=(xξ)α1e(xξ)/ββαΓ(α) f(x) = \frac{(x - \xi)^{\alpha - 1} e^{-(x-\xi)/\beta}}{\beta^{\alpha} \Gamma(\alpha)} F(x)=G(α,xξβ)/Γ(α) F(x) = G \left(\alpha, \frac{x-\xi}{\beta}\right)/ \Gamma(\alpha)

If γ=0\gamma=0, then the distribution is Normal, the range of xx is <x<-\infty < x < \infty and

f(x)=ϕ(xμσ) f(x) = \phi \left(\frac{x-\mu}{\sigma}\right) F(x)=Φ(xμσ) F(x) = \Phi \left(\frac{x-\mu}{\sigma}\right)

where ϕ(x)=(2π)1/2exp(x2/2)\phi(x)=(2\pi)^{-1/2}\exp(-x^2/2) and Φ(x)=xϕ(t)dt\Phi(x)=\int_{-\infty}^x \phi(t)dt.

If γ<0\gamma < 0, then the range of xx is <xξ-\infty < x \le \xi and

f(x)=(ξx)α1e(ξx)/ββαΓ(α) f(x) = \frac{(\xi - x)^{\alpha - 1} e^{-(\xi-x)/\beta}}{\beta^{\alpha} \Gamma(\alpha)} F(x)=G(α,ξxβ)/Γ(α) F(x) = G \left(\alpha, \frac{\xi-x}{\beta}\right)/ \Gamma(\alpha)

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

Γ(x)=0tx1etdt \Gamma (x) = \int_0^{\infty} t^{x-1} e^{-t} dt

and

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

is the incomplete gamma function.

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

The parameters μ\mu, σ\sigma and γ\gamma are the conventional moments of the distribution.

L-moments

Assuming γ>0\gamma>0, L-moments are defined for 0<α<0<\alpha<\infty.

λ1=ξ+αβ \lambda_1 = \xi + \alpha \beta λ2=π1/2βΓ(α+1/2)/Γ(α) \lambda_2 = \pi^{-1/2} \beta \Gamma(\alpha + 1/2)/\Gamma(\alpha) τ3=6I1/3(α,2α)3 \tau_3 = 6 I_{1/3} (\alpha, 2 \alpha)-3

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

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

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

The corresponding results for γ<0\gamma <0 are obtained by changing the signs of λ1\lambda_1, τ3\tau_3 and ξ\xi wherever they occur above.

Parameters

alphaalpha is obtained with an approximation. If 0<τ3<1/30<|\tau_3|<1/3, let z=3πτ32z=3 \pi \tau_3^2 and use

α1+0.2906zz+0.1882z2+0.0442z3 \alpha \approx \frac{1+0.2906 z}{z + 0.1882 z^2 + 0.0442 z^3}

if 1/3<τ3<11/3<|\tau_3|<1, let z=1τ3z=1-|\tau_3| and use

α0.36067z0.59567z2+0.25361z312.78861z+2.56096z20.77045z3 \alpha \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 α\alpha, then γ=2α1/2sign(τ3)\gamma=2 \alpha^{-1/2} sign(\tau_3), σ=λ2π1/2α1/2Γ(α)/Γ(α+1/2)\sigma=\lambda_2 \pi^{1/2} \alpha^{1/2} \Gamma(\alpha)/\Gamma(\alpha+1/2), μ=λ1\mu=\lambda_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.

Returns

f.gamma gives the density ff, F.gamma gives the distribution function FF, invFgamma gives the quantile function xx, Lmom.gamma gives the L-moments (λ1\lambda_1, λ2\lambda_2, τ3\tau_3, τ4\tau_4), par.gamma gives the parameters (mu, sigma, gamm), and rand.gamma generates random deviates.

mom2par.gamma returns the parameters α\alpha, β\beta and ξ\xi, given the parameters (moments) μ\mu, σ\sigma, γ\gamma.

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)
  • Maintainer: Alberto Viglione
  • License: GPL (>= 2)
  • Last published: 2024-05-14

Useful links