lgamma: The log-gamma distribution

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Density, distribution function and gradient of density for the log-gamma distribution. These are implemented in C for speed and care is taken that the correct results are provided for values of NA, NaN, Inf, -Inf or just extremely small or large values.

The log-gamma is a flexible location-scale distribution on the real line with an extra parameter, λ. For λ = 0 the distribution equals the normal or Gaussian distribution, and for λ equal to 1 and -1, the Gumbel minimum and maximum distributions are obtained.

Usage

1
2
3
4
5
plgamma(q, lambda, lower.tail = TRUE)

dlgamma(x, lambda, log = FALSE)

glgamma(x, lambda)

Arguments

x,q

numeric vector of quantiles.

lambda

numerical scalar

lower.tail

logical; if TRUE (default), probabilities are P[X <= x] otherwise, P[X > x].

log

logical; if TRUE, probabilities p are given as log(p).

Details

If λ < 0 the distribution is right skew, if λ = 0 the distribution is symmetric (and equals the normal distribution), and if λ > 0 the distribution is left skew.

The log-gamma distribution function is defined as ... pending.

The density and gradient of the density are defined as... pending.

These distribution functions, densities and gradients are used in the Newton-Raphson algorithms in fitting cumulative link models with clm2 and cumulative link mixed models with clmm2 using the log-gamma link.

Value

plgamma gives the distribution function, dlgamma gives the density and glgamma gives the gradient of the density.

Author(s)

Rune Haubo B Christensen

References

Genter, F. C. and Farewell, V. T. (1985) Goodness-of-link testing in ordinal regression models. The Canadian Journal of Statistics, 13(1), 37-44.

See Also

Gradients of densities are also implemented for the normal, logistic, cauchy, cf. gfun and the Gumbel distribution, cf. gumbel.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Illustrating the link to other distribution functions: 
x <- -5:5
plgamma(x, lambda = 0) == pnorm(x)
all.equal(plgamma(x, lambda = -1), pgumbel(x)) ## TRUE, but:
plgamma(x, lambda = -1) == pgumbel(x)
plgamma(x, lambda = 1) == pgumbel(x, max = FALSE)

dlgamma(x, lambda = 0) == dnorm(x)
dlgamma(x, lambda = -1) == dgumbel(x)
dlgamma(x, lambda = 1) == dgumbel(x, max = FALSE)

glgamma(x, lambda = 0) == gnorm(x)
all.equal(glgamma(x, lambda = -1), ggumbel(x)) ## TRUE, but:
glgamma(x, lambda = -1) == ggumbel(x)
all.equal(glgamma(x, lambda = 1), ggumbel(x, max = FALSE)) ## TRUE, but:
glgamma(x, lambda = 1) == ggumbel(x, max = FALSE)
## There is a loss of accuracy, but the difference is very small: 
glgamma(x, lambda = 1) - ggumbel(x, max = FALSE)

## More examples:
x <- -5:5
plgamma(x, lambda = .5)
dlgamma(x, lambda = .5)
glgamma(x, lambda = .5)

ordinal documentation built on May 2, 2019, 5:47 p.m.