ragn: Random Values from the Asymmetric Generalised Normal...

View source: R/Utilities.R

ragnR Documentation

Random Values from the Asymmetric Generalised Normal Distribution

Description

Draws random values from an asymmetric generalised normal distribution.

Usage

ragn(n, location = 0, scale = 1, alpha = 0.5, beta = 2)

Arguments

n

number of instances

location

central location of the distribution

scale

scale of the distribution. Must be strictly positive: scale > 0.0

alpha

value between 0.0 and 1.0 that determines the skewness of the distribution. alpha > 0.5 creates a distribution with a negative skew (left-skewed), i.e. the left tail of the distribution is elongated, and the bulk of the distribution is located to the right. alpha < 0.5 creates a distribution with a positive skew (right-skewed), i.e. the right tail of the distribution is elongated, and the bulk of the distribution is located to the left. For alpha = 0.0, the distribution does not have a skew.

beta

Strictly positive value (beta > 0.0) that determines the overall shape of the generalised normal distribution. For beta = 1, an asymmetric Laplace distribution is used. beta = 2 draws values according to an asymmetric normal distribution. For large beta the distribution will approximate the uniform distribution.

Details

Random values drawn according to an asymmetric generalised normal distribution. Here the asymmetric generalised normal distribution is a symmetric general normal distribution, that is made asymmetric using the procedure described by Gijbels et al. To generate random values we use the quantile function of the symmetric generalised normal distribution that was derived by M. Griffin.

The default parameter values produce values as if drawn from the standard normal distribution with \sigma = \sqrt{2}, that is, the standard deviation is not \sqrt{2} instead of 1.

Value

One or more numeric values drawn from the asymmetric generalised normal distribution.

References

  1. Gijbels I, Karim R, Verhasselt A. Quantile Estimation in a Generalized

  2. Griffin M (2018). gnorm: Generalized Normal/Exponential Power Distribution.

Examples

# Draw values from a standard normal distribution.
x <- power.transform::ragn(n = 10000, scale = 1/sqrt(2))
hist(x, 50)

# Draw values from a left-skewed normal distribution.
x <- power.transform::ragn(n = 10000, scale = 1/sqrt(2), alpha = 0.8)
hist(x, 50)

# Draw values from a right-skewed normal distribution.
x <- power.transform::ragn(n = 10000, scale = 1/sqrt(2), alpha = 0.2)
hist(x, 50)

# Draw values from a standard laplace distribution.
x <- power.transform::ragn(n = 10000, scale = 1/sqrt(2), beta = 1.0)
hist(x, 50)

power.transform documentation built on April 12, 2025, 5:08 p.m.