gnorm: The generalized normal distribution

Description Usage Arguments Source Examples

Description

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

A generalized normal random variable x with parameters μ, α > 0 and β > 0 has density:

p(x) = β exp{-(|x - μ|/α)^β}/(2α Γ(1/β)).


The mean and variance of x are μ and α^2 Γ(3/β)/Γ(1/β), respectively.

Usage

1
2
3
4
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[X≤q x], otherwise 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# 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)

gnorm documentation built on Jan. 30, 2018, 5:01 p.m.