Jorge Quitério Search
Mathematics

Random variate generation for the γ-order generalized normal

Simulation studies require a generator for the distribution under study rather than a normal approximation. This article presents two exact methods for sampling the γ-order generalized normal: a gamma transform and an adapted Ziggurat algorithm.

Every simulation study of a heavy-tailed model starts with a practical question: how to generate the data. Drawing normal variates and assuming that the conclusions carry over is not adequate. If the purpose is to study what happens when errors are not normal, the generator must produce exactly the non-normal distribution under study.

An engineer testing the position controller of a warehouse robot is in this situation. The controller cannot be tried on the real robot thousands of times, so the sensor noise is simulated and the controller is run against it. If the simulated noise is normal while the real sensor occasionally produces large spikes, the controller passes every test and fails in service. The same applies to a bank that revalues its portfolio under millions of simulated market moves: the simulated moves must have the tails of the real ones.

For the γ-order generalized normal distribution (γGN), introduced in the γ-order generalized normal distribution, there is no closed-form inverse of the distribution function, so the textbook inversion method is not available. This article presents two exact alternatives, proves the first, and illustrates the second.

The relevant literature is as follows.

Devroye (1986) is the classic reference on generating non-uniform random variables: inversion, rejection, transformations and their combinations.

Marsaglia and Tsang (2000) introduced the Ziggurat algorithm, still one of the fastest ways to generate normal and exponential variables. The same authors' gamma generator, also from 2000, is the one behind most modern libraries.

Kitsos, Oliveira and Nyamsi (2025) adapted the Ziggurat to the γGN for γ>1\gamma > 1, with an exact tail and a multivariate extension, and published R code.

The standardised density

Write the standard γGN, with location 0 and scale 1, as

f(x)=λ exp⁡(−c ∣x∣β),c=γ−1γ,β=γγ−1, f(x) = \lambda\, \exp\left(-c\,|x|^{\beta}\right), \qquad c = \frac{\gamma-1}{\gamma}, \quad \beta = \frac{\gamma}{\gamma-1},

with λ\lambda the normalising constant. A general member is μ+σX\mu + \sigma X.

Method 1: the gamma transform

The density depends on xx only through ∣x∣β|x|^\beta, which suggests a change of variable. Let G=c ∣X∣βG = c\,|X|^\beta. Then GG follows a gamma distribution with shape 1/β1/\beta (proof below). Reversing the steps gives an exact sampler:

  1. Draw G∼Gamma(1/β, 1)G \sim \text{Gamma}(1/\beta,\ 1).
  2. Set ∣X∣=(G/c)1/β|X| = (G/c)^{1/\beta}.
  3. Attach a random sign.

In Python that is three lines of NumPy. Checked against the exact distribution function with a Kolmogorov-Smirnov test on 200,000 draws for γ=1.1\gamma = 1.1, 2, 4 and 50, none of the tests came close to rejecting, and the probabilities below −1 matched the published tables (0.0821, 0.1587, 0.1742 and 0.1833). Ten million draws took about 0.7 seconds, against 0.15 seconds for ten million normal draws. The method also covers the very heavy-tailed members with γ<0\gamma < 0, where β<1\beta < 1.

Method 2: an adapted Ziggurat

The Ziggurat covers the density with a stack of horizontal layers of equal area, typically 256. To draw a number, it picks a layer at random and a point inside it. In most cases the point lies under the curve and is accepted without evaluating the density at all. Only in the thin slivers at the layers' right edges, and in the tail beyond the last layer, is more work needed.

Kitsos, Oliveira and Nyamsi's adaptation rests on two ingredients:

  • The layers. Building them needs the inverse of the density, xx for a given height yy. For the γGN this has a closed form, x=(−ln⁡y/c)1/βx = \left(-\ln y / c\right)^{1/\beta}, so the table can be built for any γ\gamma.
  • The tail. Beyond the last layer the algorithm samples exactly, by inverting the upper incomplete gamma function. The tail, which is the main reason for using the γGN, is therefore handled without approximation.

The authors report a rejection rate below 2% for every γ>1\gamma > 1 with 256 layers. The choice between the methods depends mainly on the environment: the gamma transform is the simplest to write and verify; the Ziggurat is preferable in performance-critical compiled code, such as a risk engine that must draw hundreds of millions of values overnight.

More than one variable

The multivariate γGN is elliptical, so it can be built from a direction and a radius:

X=μ+Σ1/2 R U∥U∥, \mathbf{X} = \boldsymbol\mu + \Sigma^{1/2}\, R\, \frac{\mathbf{U}}{\lVert \mathbf{U} \rVert} ,

with U\mathbf{U} a vector of independent standard normals (used only for its direction) and RR a radius with density proportional to rp−1exp⁡(−c rβ)r^{p-1} \exp(-c\, r^\beta) in pp dimensions. The same transformation applies: c Rβc\,R^\beta is gamma with shape p/βp/\beta. Generating each coordinate independently instead would produce a different distribution; a later note shows how different. In the elliptical form the coordinates share one radius, so a large value in one coordinate makes large values in the others more likely, even when the coordinates are uncorrelated. For the daily returns of several shares, this corresponds to the familiar observation that large moves tend to arrive together on days of market stress; independent coordinates remove that effect.

Both methods are implemented below and illustrate two properties: the gamma transform reproduces the γGN exactly, including its tails, and a Ziggurat accepts almost every candidate point without evaluating the density, with a rejection rate that falls as the layers multiply.

  1. Extreme observations. With γ = 4 and 2,000 draws, the share beyond three standard deviations varies around the theoretical 0.90%, against 0.27% for the normal. Raise the sample to 20,000 and it stabilises.
  2. Logarithmic scale. With the log scale on, increase γ towards 20: the histogram follows the nearly linear tails of the γGN, far above the normal's parabola.
  1. Ziggurat sampling. With 8 layers, most candidate points fall in the green zone and are accepted immediately. The blue and orange points fall in the slivers where the density had to be computed.
  2. More layers. Switch to 32 and then 256 layers. The rejection rate falls towards the reported "below 2%", matching the theoretical value shown next to it.
  3. Other shapes. Move γ from 4 to 1.2 (light tails) and to 50 (nearly Laplace). The ziggurat is rebuilt for each shape, and its efficiency barely changes, which makes the method suitable for the whole family.

Why Method 1 is exact. For x>0x > 0 the density of ∣X∣|X| is 2λe−cxβ2\lambda e^{-c x^\beta}. Substitute g=cxβg = c x^\beta, so x=(g/c)1/βx = (g/c)^{1/\beta} and dx=1β c−1/β g1/β−1 dgdx = \frac{1}{\beta}\, c^{-1/\beta}\, g^{1/\beta - 1}\, dg. The density of GG is

2λ e−g⋅1β c−1/β g1/β−1  ∝  g1/β−1e−g, 2\lambda\, e^{-g} \cdot \frac{1}{\beta}\, c^{-1/\beta}\, g^{1/\beta - 1} \;\propto\; g^{1/\beta - 1} e^{-g},

which is the Gamma(1/β,1)(1/\beta, 1) density. Normalisation fixes the constant, which also gives λ=βc1/β/(2 Γ(1/β))\lambda = \beta c^{1/\beta} / (2\,\Gamma(1/\beta)). For the Ziggurat, if the NN layers each have area vv and the area under the half-density is AA, the probability that a candidate point is rejected is exactly 1−A/(Nv)1 - A/(Nv), the share of the layers lying above the curve. As NN grows the layers follow the curve more closely and that share decreases.

Summary:

  • Simulate the distribution under study, not a normal approximation.
  • For the γGN the gamma transform is exact, short and easy to verify, and is the natural first choice.
  • Use the Ziggurat when speed matters: almost every draw requires one table lookup and one comparison.
  • In several dimensions, sample the radius and the direction, not independent coordinates.

References

  1. L. Devroye, Non-Uniform Random Variate Generation, Springer, 1986.
  2. G. Marsaglia and W. W. Tsang, "The Ziggurat method for generating random variables", Journal of Statistical Software, 5(8), 1-7, 2000.
  3. G. Marsaglia and W. W. Tsang, "A simple method for generating gamma variables", ACM Transactions on Mathematical Software, 26(3), 363-372, 2000.
  4. C. P. Kitsos, A. Oliveira and U. E. Nyamsi, "Tail-adaptive generation of random numbers from a gamma-order normal distribution using the Ziggurat algorithm with a multivariate extension", Chilean Journal of Statistics, 16(1), 79-97, 2025.