dgnorm {greybox} | R Documentation |
The generalized normal distribution
Description
Density, cumulative distribution, quantile functions and random number generation for the Generalised Normal distribution with the location mu, a scale and a shape parameters.
Usage
dgnorm(q, mu = 0, scale = 1, shape = 1, log = FALSE)
pgnorm(q, mu = 0, scale = 1, shape = 1, lower.tail = TRUE,
log.p = FALSE)
qgnorm(p, mu = 0, scale = 1, shape = 1, lower.tail = TRUE,
log.p = FALSE)
rgnorm(n, mu = 0, scale = 1, shape = 1)
Arguments
q |
vector of quantiles |
mu |
location parameter |
scale |
scale parameter |
shape |
shape parameter |
log , log.p |
logical; if TRUE, probabilities p are given as log(p) |
lower.tail |
logical; if TRUE (default), probabilities are |
p |
vector of probabilities |
n |
number of observations |
Details
A generalized normal random variable x
with parameters location \mu
,
scale s > 0
and shape \beta > 0
has density:
p(x) = \beta exp{-(|x - \mu|/s)^\beta}/(2s \Gamma(1/\beta)).
The mean and variance of x
are \mu
and
s^2 \Gamma(3/\beta)/\Gamma(1/\beta)
, respectively.
The function are based on the functions from gnorm package of Maryclare Griffin (package has been abandoned since 2018).
The quantile and cumulative functions use uniform approximation for cases
shape>100
. This is needed, because otherwise it is not possible to calculate
the values correctly due to scale^(shape)=Inf
in R.
Author(s)
Maryclare Griffin and Ivan Svetunkov
Source
dgnorm
, pgnorm
, qgnorm
andrgnorm
are all
parametrized as in Version 1 of the
Generalized
Normal Distribution Wikipedia page,
which uses the parametrization given by in Nadarajah (2005).
The same distribution was described much earlier by Subbotin (1923) and named
the exponential power distribution by Box and Tiao (1973).
References
Box, G. E. P. and G. C. Tiao. "Bayesian inference in Statistical Analysis." Addison-Wesley Pub. Co., Reading, Mass (1973).
Nadarajah, Saralees. "A generalized normal distribution." Journal of Applied Statistics 32.7 (2005): 685-694.
Subbotin, M. T. "On the Law of Frequency of Error." Matematicheskii Sbornik 31.2 (1923): 206-301.
See Also
Examples
# Density function values for standard normal distribution
x <- dgnorm(seq(-1, 1, length.out = 100), 0, sqrt(2), 2)
plot(x, type="l")
#CDF of standard Laplace
x <- pgnorm(c(-100:100), 0, 1, 1)
plot(x, type="l")
# Quantiles of S distribution
qgnorm(c(0.025,0.975), 0, 1, 0.5)
# Random numbers from a distribution with shape=10000 (approximately uniform)
x <- rgnorm(1000, 0, 1, 1000)
hist(x)