STK++ 0.9.13
|
Normal distribution law. More...
#include <STK_Law_Normal.h>
Public Types | |
typedef IUnivLaw< Real > | Base |
Public Member Functions | |
Normal (Real const &mu=0., Real const &sigma=1.) | |
Constructor. | |
virtual | ~Normal () |
Destructor. | |
Real const & | mu () const |
Real const & | sigma () const |
void | setMu (Real const &mu) |
void | setSigma (Real const &sigma) |
Real | rand () const |
Generate a pseudo Normal random variate. | |
virtual Real | pdf (Real const &x) const |
virtual Real | lpdf (Real const &x) const |
virtual Real | cdf (Real const &t) const |
Compute the cumulative distribution function at t of the standard normal distribution. | |
virtual Real | icdf (Real const &p) const |
Compute the inverse cumulative distribution function at p of the standard normal distribution. | |
![]() | |
virtual | ~IUnivLaw () |
Virtual destructor. | |
virtual Real | lcdf (Real const &t) const |
compute the lower tail log-cumulative distribution function Give the log-probability that a random variate is less or equal to t. | |
virtual Real | cdfc (Real const &t) const |
calculate the complement of cumulative distribution function, called in statistics the survival function. | |
virtual Real | lcdfc (Real const &t) const |
calculate the log-complement of cumulative distribution function Give the log-probability that a random variate is greater than t. | |
![]() | |
String const & | name () const |
Static Public Member Functions | |
static Real | rand (Real const &mu, Real const &sigma) |
Generate a pseudo Normal random variate. | |
static Real | pdf (Real const &x, Real const &mu, Real const &sigma) |
static Real | lpdf (Real const &x, Real const &mu, Real const &sigma) |
static Real | cdf (Real const &t, Real const &mu, Real const &sigma) |
Compute the cumulative distribution function at t of the standard normal distribution. | |
static Real | icdf (Real const &p, Real const &mu, Real const &sigma) |
Compute the inverse cumulative distribution function at p of the standard normal distribution. | |
Protected Attributes | |
Real | mu_ |
The mu parameter. | |
Real | sigma_ |
The sigma parameter. | |
![]() | |
String | name_ |
Name of the Law. | |
Additional Inherited Members | |
![]() | |
IUnivLaw (String const &name) | |
Constructor. | |
IUnivLaw (IUnivLaw const &law) | |
copy Constructor. | |
![]() | |
ILawBase (String const &name) | |
Constructor. | |
~ILawBase () | |
destructor. | |
Normal distribution law.
In probability theory, the normal (or Gaussian) distribution is a very commonly occurring continuous probability distribution. Normal distributions are extremely important in statistics and are often used in the natural and social sciences for real-valued random variables whose distributions are not known.
The normal distribution is immensely useful because of the central limit theorem, which states that, under mild conditions, the mean of many random variables independently drawn from the same distribution is distributed approximately normally, irrespective of the form of the original distribution.
The probability density of normal distribution is:
where
Definition at line 71 of file STK_Law_Normal.h.
Definition at line 74 of file STK_Law_Normal.h.
Constructor.
Definition at line 79 of file STK_Law_Normal.h.
References mu(), Normal(), sigma(), and STKDOMAIN_ERROR_2ARG.
Referenced by Normal().
|
inlinevirtual |
Compute the cumulative distribution function at t of the standard normal distribution.
This is the erfc() routine only, adapted by the transform cdf(u)=erfc(-u/sqrt(2))/2
t | a real value |
Implements STK::Law::IUnivLaw< Real >.
Definition at line 115 of file STK_Law_Normal.cpp.
References cdf(), STK::Funct::erfc_raw(), mu_, sigma_, and STKDOMAIN_ERROR_1ARG.
Compute the cumulative distribution function at t of the standard normal distribution.
t | a real value |
mu,sigma | mean and standard deviation of the Normal distribution |
Definition at line 227 of file STK_Law_Normal.cpp.
References cdf(), STK::Funct::erfc_raw(), mu(), sigma(), and STKDOMAIN_ERROR_1ARG.
Compute the inverse cumulative distribution function at p of the standard normal distribution.
This function is based on the MATLAB code from the address above.
p | a probability number. |
Implements STK::Law::IUnivLaw< Real >.
Definition at line 127 of file STK_Law_Normal.cpp.
References a1, a2, a3, a4, a5, a6, b1, b2, b3, b4, b5, c1, c2, c3, c4, c5, c6, d1, d2, d3, d4, icdf(), mu_, sigma_, and STKDOMAIN_ERROR_1ARG.
Compute the inverse cumulative distribution function at p of the standard normal distribution.
p | a probability number. |
mu,sigma | mean and standard deviation of the Normal distribution |
Definition at line 239 of file STK_Law_Normal.cpp.
References a1, a2, a3, a4, a5, a6, b1, b2, b3, b4, b5, c1, c2, c3, c4, c5, c6, d1, d2, d3, d4, icdf(), mu(), sigma(), and STKDOMAIN_ERROR_1ARG.
x | a real value |
Reimplemented from STK::Law::IUnivLaw< Real >.
Definition at line 99 of file STK_Law_Normal.cpp.
References lpdf(), mu_, sigma_, and STKDOMAIN_ERROR_1ARG.
Referenced by STK::JointGaussianModel< Array, WColVector >::computeLnLikelihood(), STK::ModelDiagGaussian_muj_sj< Data_, WColVector_ >::computeLnLikelihood(), STK::DiagGaussianBase< Derived >::lnComponentProbability(), STK::HDGaussian_AjkBkQkD< Array >::lnComponentProbability(), lpdf(), lpdf(), and main().
x | a real value |
mu,sigma | mean and standard deviation of the Normal distribution |
Definition at line 206 of file STK_Law_Normal.cpp.
References lpdf(), mu(), rand(), sigma(), STKDOMAIN_ERROR_1ARG, and STKDOMAIN_ERROR_2ARG.
x | a real value |
x
Implements STK::Law::IUnivLaw< Real >.
Definition at line 84 of file STK_Law_Normal.cpp.
References mu_, pdf(), sigma_, and STKDOMAIN_ERROR_1ARG.
x | a real value |
mu,sigma | mean and standard deviation of the Normal distribution |
x
Definition at line 187 of file STK_Law_Normal.cpp.
References mu(), pdf(), rand(), sigma(), STKDOMAIN_ERROR_1ARG, and STKDOMAIN_ERROR_2ARG.
|
virtual |
Generate a pseudo Normal random variate.
Generate a pseudo Normal random variate with location parameter mu_
and standard deviation sigma_
.
Implements STK::Law::IUnivLaw< Real >.
Definition at line 78 of file STK_Law_Normal.cpp.
Referenced by lpdf(), main(), pdf(), STK::DiagGaussianBase< Derived >::rand(), STK::HDGaussianBase< Derived >::rand(), rand(), and STK::HDMatrixGaussianModel< IdRow_, IdCol_, Array_ >::randomInit().
Generate a pseudo Normal random variate.
Generate a pseudo Normal random variate with location mu
and standard deviation sigma
parameters.
mu,sigma | mean and standard deviation of the Normal distribution |
mu
and with standard deviation sigma
Definition at line 173 of file STK_Law_Normal.cpp.
References mu(), rand(), sigma(), and STKDOMAIN_ERROR_2ARG.
sigma | the standard deviation to set |
Definition at line 95 of file STK_Law_Normal.h.
References setSigma(), sigma(), sigma_, and STKDOMAIN_ERROR_1ARG.
Referenced by setSigma().
|
protected |
|
protected |
The sigma parameter.
Definition at line 187 of file STK_Law_Normal.h.
Referenced by cdf(), icdf(), lpdf(), pdf(), rand(), setSigma(), and sigma().