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 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. Azzalini: 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.
[[row_1], [row_2], ..., [row_n]]
[[1, 0], [0, 1]]
2nd parameter is delta vector of the form [delta_1, ..., delta_n], e. g. [0, 1].
[delta_1, ..., delta_n]
[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.
To install Math::Random::SkewNormal, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::Random::SkewNormal
CPAN shell
perl -MCPAN -e shell install Math::Random::SkewNormal
For more information on module installation, please visit the detailed CPAN module installation guide.