1 [section:skew_normal_dist Skew Normal Distribution]
3 ``#include <boost/math/distributions/skew_normal.hpp>``
5 namespace boost{ namespace math{
7 template <class RealType = double,
8 class ``__Policy`` = ``__policy_class`` >
9 class skew_normal_distribution;
11 typedef skew_normal_distribution<> normal;
13 template <class RealType, class ``__Policy``>
14 class skew_normal_distribution
17 typedef RealType value_type;
18 typedef Policy policy_type;
20 skew_normal_distribution(RealType location = 0, RealType scale = 1, RealType shape = 0);
22 RealType location()const; // mean if normal.
23 RealType scale()const; // width, standard deviation if normal.
24 RealType shape()const; // The distribution is right skewed if shape > 0 and is left skewed if shape < 0.
25 // The distribution is normal if shape is zero.
30 The skew normal distribution is a variant of the most well known
31 Gaussian statistical distribution.
33 The skew normal distribution with shape zero resembles the
34 [@http://en.wikipedia.org/wiki/Normal_distribution Normal Distribution],
35 hence the latter can be regarded as a special case of the more generic skew normal distribution.
37 If the standard (mean = 0, scale = 1) normal distribution probability density function is
39 [space][space][equation normal01_pdf]
41 and the cumulative distribution function
43 [space][space][equation normal01_cdf]
45 then the [@http://en.wikipedia.org/wiki/Probability_density_function PDF]
46 of the [@http://en.wikipedia.org/wiki/Skew_normal_distribution skew normal distribution]
47 with shape parameter [alpha], defined by O'Hagan and Leonhard (1976) is
49 [space][space][equation skew_normal_pdf0]
51 Given [@http://en.wikipedia.org/wiki/Location_parameter location] [xi],
52 [@http://en.wikipedia.org/wiki/Scale_parameter scale] [omega],
53 and [@http://en.wikipedia.org/wiki/Shape_parameter shape] [alpha],
55 [@http://en.wikipedia.org/wiki/Skew_normal_distribution transformed],
58 [space][space][equation skew_normal_pdf]
60 and [@http://en.wikipedia.org/wiki/Cumulative_distribution_function CDF]:
62 [space][space][equation skew_normal_cdf]
64 where ['T(h,a)] is Owen's T function, and ['[Phi](x)] is the normal distribution.
66 The variation the PDF and CDF with its parameters is illustrated
67 in the following graphs:
69 [graph skew_normal_pdf]
70 [graph skew_normal_cdf]
74 skew_normal_distribution(RealType location = 0, RealType scale = 1, RealType shape = 0);
76 Constructs a skew_normal distribution with location [xi],
77 scale [omega] and shape [alpha].
79 Requires scale > 0, otherwise __domain_error is called.
81 RealType location()const;
83 returns the location [xi] of this distribution,
85 RealType scale()const;
87 returns the scale [omega] of this distribution,
89 RealType shape()const;
91 returns the shape [alpha] of this distribution.
93 (Location and scale function match other similar distributions,
94 allowing the functions `find_location` and `find_scale` to be used generically).
96 [note While the shape parameter may be chosen arbitrarily (finite),
97 the resulting [*skewness] of the distribution is in fact limited to about (-1, 1);
98 strictly, the interval is (-0.9952717, 0.9952717).
100 A parameter [delta] is related to the shape [alpha] by
101 [delta] = [alpha] / (1 + [alpha][pow2]),
102 and used in the expression for skewness
103 [equation skew_normal_skewness]
108 * [@http://azzalini.stat.unipd.it/SN/ Skew-Normal Probability Distribution] for many links and bibliography.
109 * [@http://azzalini.stat.unipd.it/SN/Intro/intro.html A very brief introduction to the skew-normal distribution]
110 by Adelchi Azzalini (2005-11-2).
111 * See a [@http://www.tri.org.au/azzalini.html skew-normal function animation].
113 [h4 Non-member Accessors]
115 All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions]
116 that are generic to all distributions are supported: __usual_accessors.
118 The domain of the random variable is ['-[max_value], +[min_value]].
119 Infinite values are not supported.
121 There are no [@http://en.wikipedia.org/wiki/Closed-form_expression closed-form expression]
122 known for the mode and median, but these are computed for the
124 * mode - by finding the maximum of the PDF.
125 * median - by computing `quantile(1/2)`.
127 The maximum of the PDF is sought through searching the root of f'(x)=0.
129 Both involve iterative methods that will have lower accuracy than other estimates.
133 __R using library(sn) described at
134 [@http://azzalini.stat.unipd.it/SN/ Skew-Normal Probability Distribution],
135 and at [@http://cran.r-project.org/web/packages/sn/sn.pd R skew-normal(sn) package].
137 Package sn provides functions related to the skew-normal (SN)
138 and the skew-t (ST) probability distributions,
139 both for the univariate and for the the multivariate case,
140 including regression models.
142 __Mathematica was also used to generate some more accurate spot test data.
146 The skew_normal distribution with shape = zero is implemented as a special case,
147 equivalent to the normal distribution in terms of the
148 [link math_toolkit.sf_erf.error_function error function],
149 and therefore should have excellent accuracy.
151 The PDF and mean, variance, skewness and kurtosis are also accurately evaluated using
152 [@http://en.wikipedia.org/wiki/Analytical_expression analytical expressions].
153 The CDF requires [@http://en.wikipedia.org/wiki/Owen%27s_T_function Owen's T function]
154 that is evaluated using a Boost C++ __owens_t implementation of the algorithms of
155 M. Patefield and D. Tandy, Journal of Statistical Software, 5(5), 1-25 (2000);
156 the complicated accuracy of this function is discussed in detail at __owens_t.
158 The median and mode are calculated by iterative root finding, and both will be less accurate.
162 In the following table, [xi] is the location of the distribution,
163 and [omega] is its scale, and [alpha] is its shape.
166 [[Function][Implementation Notes]]
167 [[pdf][Using:[equation skew_normal_pdf] ]]
168 [[cdf][Using: [equation skew_normal_cdf][br]
169 where ['T(h,a)] is Owen's T function, and ['[Phi](x)] is the normal distribution. ]]
170 [[cdf complement][Using: complement of normal distribution + 2 * Owens_t]]
171 [[quantile][Maximum of the pdf is sought through searching the root of f'(x)=0]]
172 [[quantile from the complement][-quantile(SN(-location [xi], scale [omega], -shape[alpha]), p)]]
173 [[location][location [xi]]]
174 [[scale][scale [omega]]]
175 [[shape][shape [alpha]]]
176 [[median][quantile(1/2)]]
177 [[mean][[equation skew_normal_mean]]]
178 [[mode][Maximum of the pdf is sought through searching the root of f'(x)=0]]
179 [[variance][[equation skew_normal_variance] ]]
180 [[skewness][[equation skew_normal_skewness] ]]
181 [[kurtosis][kurtosis excess-3]]
182 [[kurtosis excess] [ [equation skew_normal_kurt_ex] ]]
185 [endsect] [/section:skew_normal_dist skew_Normal]
188 Copyright 2012 Bejamin Sobotta, John Maddock and Paul A. Bristow.
189 Distributed under the Boost Software License, Version 1.0.
190 (See accompanying file LICENSE_1_0.txt or copy at
191 http://www.boost.org/LICENSE_1_0.txt).