Math::Random::SkewNormal - Handy, easy-to-use Skew-Normal random number generator


  use Math::Random::SkewNormal;
  $skewness = 1;
  $delta    = [0, 0];
  $omega    = [[1, 0], [0, 1]];

  # following functions generate realizations:
  generate_sn($skewness)            # SkewNormal(0,1,$skewness)
  generate_sn_multi($delta, $omega) # SkewNormal_n($delta, $omega)


This module transforms uniformly spaced random variable realizations into realizations that follow the Skew-Normal (SN) Probability Density Function (PDF).

We accept following definition of the Skew-Normal Distribution:

1-dimensional SN is determined by PDF: f(x,a) = 2 phi(x) Phi(a x), where phi is the PDF and Phi is the CDF of Normal distribution
Let X = (X_0, ..., X_k) follows distribution N_k+1 (0, Omega*), where Omega* is the matrix of the form:
       [   1   delta ]
       [ delta Omega ]

Omega is a matrix and delta is a vector. Then (X_1, ..., X_n)|(X_0 > 0) follows n-dimensional Skew Normal distribution.


We use following algorithms:

  • Box-Muller transformation; for generation Normal realizations

  • Choleski's decomposition; for inverting matrices

  • A lemma mentioned e. g. in article from A. Azalini: The skew-normal distribution and related multivariate families; for generating Skew-Normal realizations



Returns realization of SN(0,1, a), where a is the only parameter. The meaning of a is "skewness" (see definition above).


Returns realization of centralized n-dimensional Skew-Normal distribution.

1st parameter is correlation matrix of the form [[row_1], [row_2], ..., [row_n]], for example [[1, 0], [0, 1]] for 2-dimensional unit matrix.

2nd parameter is delta vector of the form [delta_1, ..., delta_n], e. g. [0, 1].


Math::Random, Math::Random::Cauchy,

The examples in examples/ subdirectory of this distribution contains example of generated data with histogram.

The scripts in bin/ directory of this distribution contains tools for generating realizations on command line.


Jiri Vaclavik, <my name dot my last name at gmail dot com>


Copyright (C) 2011 by Jiri Vaclavik

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8 or, at your option, any later version of Perl 5 you may have available.