lgamma {ordinal} | R Documentation |
The log-gamma distribution
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, \lambda
. For \lambda = 0
the
distribution equals the normal or Gaussian distribution, and for
\lambda
equal to 1 and -1, the Gumbel minimum and maximum
distributions are obtained.
Usage
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 |
log |
logical; if |
Details
If \lambda < 0
the distribution is right skew, if
\lambda = 0
the distribution is symmetric (and equals the normal
distribution), and if \lambda > 0
the distribution is left
skew.
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
## 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)