Package 'gnorm'

Title: Generalized Normal/Exponential Power Distribution
Description: Functions for obtaining generalized normal/exponential power distribution probabilities, quantiles, densities and random deviates. The generalized normal/exponential power distribution was introduced by Subbotin (1923) and rediscovered by Nadarajah (2005). The parametrization given by Nadarajah (2005) <doi:10.1080/02664760500079464> is used.
Authors: Maryclare Griffin
Maintainer: Maryclare Griffin <[email protected]>
License: GPL (>=2)
Version: 1.0.2
Built: 2024-11-04 05:34:29 UTC
Source: https://github.com/maryclare/gnorm

Help Index


The generalized normal distribution

Description

Density, distribution function and random generation for the generalized normal/exponential power distribution.

A generalized normal random variable xx with parameters μ\mu, α>0\alpha > 0 and β>0\beta > 0 has density:

p(x)=βexp(xμ/α)β/(2αΓ(1/β)).p(x) = \beta exp{-(|x - \mu|/\alpha)^\beta}/(2\alpha \Gamma(1/\beta)).


The mean and variance of xx are μ\mu and α2Γ(3/β)/Γ(1/β)\alpha^2 \Gamma(3/\beta)/\Gamma(1/\beta), respectively.

Usage

dgnorm(x, mu = 0, alpha = 1, beta = 1, log = FALSE)
pgnorm(q, mu = 0, alpha = 1, beta = 1, lower.tail = TRUE, log.p = FALSE)
qgnorm(p, mu = 0, alpha = 1, beta = 1, lower.tail = TRUE, log.p = FALSE)
rgnorm(n, mu = 0, alpha = 1, beta = 1)

Arguments

x, q

vector of quantiles

mu

location parameter

alpha

scale parameter

beta

shape parameter

log, log.p

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

p

vector of probabilities

n

number of observations

lower.tail

logical; if TRUE (default), probabilities are P[Xx]P[X\leq x], otherwise P[X>x]P[X> x]

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).

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.

Examples

# Plot generalized normal/exponential power density
# that corresponds to the standard normal density
xs <- seq(-1, 1, length.out = 100)
plot(xs, dgnorm(xs, mu = 0, alpha = sqrt(2), beta = 2), type = "l",
     xlab = "x", ylab = expression(p(x)))

# Plot the generalized normal/exponential power CDF
# that corresponds to the standard normal CDF
s <- seq(-1, 1, length.out = 100)
plot(xs, pgnorm(xs, 0, sqrt(2), 2), type = "l", xlab = "q",
     ylab = expression(paste("Pr(", x<=q, ")", sep = "")))

# Plot the generalized normal/exponential power inverse CDF
# that corresponds to the standard normal inverse CDF
xs <- seq(0, 1, length.out = 100)
plot(xs, qgnorm(xs, 0, sqrt(2), 2), type = "l", xlab = "p",
     ylab = expression(paste("q: p = Pr(", x<=q, ")", sep = "")))

# Make a histogram of draws from the generalized normal/exponential
# power distribution that corresponds to a standard normal distribution
xs <- rgnorm(100, 0, sqrt(2), 2)