-
-
15 Sep 2011 18:14:53 UTC
- Distribution: Math-Random-SkewNormal
- Module version: 0.01
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (2)
- Testers (20 / 437 / 1)
- Kwalitee
Bus factor: 0- 87.50% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (17.67KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- Jiri Vaclavik <my name dot my surname at gmail dot com>
- Dependencies
- unknown
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Math::Random::SkewNormal - Handy, easy-to-use Skew-Normal random number generator
SYNOPSIS
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)
DESCRIPTION
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.
ALGORITHM
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
FUNCTIONS
generate_sn
Returns realization of SN(0,1, a), where a is the only parameter. The meaning of a is "skewness" (see definition above).
generate_sn_multi
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]
.SEE ALSO
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.
AUTHOR
Jiri Vaclavik, <my name dot my last name at gmail dot com>
COPYRIGHT AND LICENSE
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.
Module Install Instructions
To install Math::Random::SkewNormal, copy and paste the appropriate command in to your terminal.
cpanm Math::Random::SkewNormal
perl -MCPAN -e shell install Math::Random::SkewNormal
For more information on module installation, please visit the detailed CPAN module installation guide.