STK++ 0.9.13

LogNormal distribution law. More...

#include <STK_Law_LogNormal.h>

Inheritance diagram for STK::Law::LogNormal:
Inheritance graph

Public Types

typedef IUnivLaw< RealBase
 

Public Member Functions

 LogNormal (Real const &mu=0., Real const &sigma=1.)
 Constructor.
 
virtual ~LogNormal ()
 Destructor.
 
Real constmu () const
 
Real constsigma () const
 
void setMu (Real const &mu)
 
void setSigma (Real const &sigma)
 
Real rand () const
 Generate a pseudo log-normalized LogNormal 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 log-normal distribution.
 
virtual Real icdf (Real const &p) const
 Compute the inverse cumulative distribution function at p of the standard log-normal distribution.
 
- Public Member Functions inherited from STK::Law::IUnivLaw< Real >
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.
 
- Public Member Functions inherited from STK::Law::ILawBase
String constname () const
 

Static Public Member Functions

static Real rand (Real const &mu, Real const &sigma)
 Generate a pseudo LogNormal 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 log-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 log-normal distribution.
 

Protected Attributes

Real mu_
 The location parameter.
 
Real sigma_
 The scale parameter.
 
- Protected Attributes inherited from STK::Law::ILawBase
String name_
 Name of the Law.
 

Additional Inherited Members

- Protected Member Functions inherited from STK::Law::IUnivLaw< Real >
 IUnivLaw (String const &name)
 Constructor.
 
 IUnivLaw (IUnivLaw const &law)
 copy Constructor.
 
- Protected Member Functions inherited from STK::Law::ILawBase
 ILawBase (String const &name)
 Constructor.
 
 ~ILawBase ()
 destructor.
 

Detailed Description

LogNormal distribution law.

In probability theory, a log-normal (or loglog-normal) distribution is a continuous probability distribution of a random variable whose logarithm is log-normally distributed. Thus, if the random variable X is log-normally distributed, then Y = log(X) has a log-normal distribution. Likewise, if Y has a log-normal distribution, then X = exp(Y) has a log-normal distribution. A random variable which is log-normally distributed takes only positive real values.

A variable might be modeled as log-normal if it can be thought of as the multiplicative product of many independent random variables, each of which is positive.

The probability density function of a log-normal distribution is:

\[
  f_X(x;\mu,\sigma) = \frac{1}{ x\sigma \sqrt{2 \pi}}\,
  e^{-\frac{(\ln x - \mu)^2}{2\sigma^2}},\ \ x>0
\]

where $ \mu  \mbox{ and } \sigma$ are the location and the scale parameters.

Definition at line 70 of file STK_Law_LogNormal.h.

Member Typedef Documentation

◆ Base

Constructor & Destructor Documentation

◆ LogNormal()

STK::Law::LogNormal::LogNormal ( Real const mu = 0.,
Real const sigma = 1. 
)
inline

Constructor.

Parameters
mulocation of the LogNormal distribution
sigmascale of the LogNormal distribution

Definition at line 78 of file STK_Law_LogNormal.h.

79 : Base(_T("LogNormal")), mu_(mu), sigma_(sigma) {}
#define _T(x)
Let x unmodified.
Real const & mu() const
Real const & sigma() const
IUnivLaw< Real > Base
Real mu_
The location parameter.
Real sigma_
The scale parameter.

◆ ~LogNormal()

virtual STK::Law::LogNormal::~LogNormal ( )
inlinevirtual

Destructor.

Definition at line 82 of file STK_Law_LogNormal.h.

82{}

Member Function Documentation

◆ cdf() [1/2]

Real STK::Law::LogNormal::cdf ( Real const t) const
virtual

Compute the cumulative distribution function at t of the standard log-normal distribution.

Parameters
ta real value
Returns
the cumulative distribution function value at t

Implements STK::Law::IUnivLaw< Real >.

Definition at line 77 of file STK_Law_LogNormal.cpp.

78{
79 return 0;
80}

◆ cdf() [2/2]

Real STK::Law::LogNormal::cdf ( Real const t,
Real const mu,
Real const sigma 
)
static

Compute the cumulative distribution function at t of the standard log-normal distribution.

Parameters
ta real value
mu,sigmalocation and scale of the log-normal law
Returns
the cumulative distribution function value at t

Definition at line 129 of file STK_Law_LogNormal.cpp.

130{
131 return 0;
132}

◆ icdf() [1/2]

Real STK::Law::LogNormal::icdf ( Real const p) const
virtual

Compute the inverse cumulative distribution function at p of the standard log-normal distribution.

Parameters
pa probability number.
Returns
the inverse cumulative distribution function value at p.

Implements STK::Law::IUnivLaw< Real >.

Definition at line 87 of file STK_Law_LogNormal.cpp.

88{
89 return 0;
90}

◆ icdf() [2/2]

Real STK::Law::LogNormal::icdf ( Real const p,
Real const mu,
Real const sigma 
)
static

Compute the inverse cumulative distribution function at p of the standard log-normal distribution.

Parameters
pa probability number.
mu,sigmalocation and scale of the log-normal law
Returns
the inverse cumulative distribution function value at p.

Definition at line 140 of file STK_Law_LogNormal.cpp.

141{
142 return 0;
143}

◆ lpdf() [1/2]

Real STK::Law::LogNormal::lpdf ( Real const x) const
virtual
Returns
Give the value of the log-pdf at x.
Parameters
xa real value

Reimplemented from STK::Law::IUnivLaw< Real >.

Definition at line 68 of file STK_Law_LogNormal.cpp.

69{
70 return 0;
71}

◆ lpdf() [2/2]

Real STK::Law::LogNormal::lpdf ( Real const x,
Real const mu,
Real const sigma 
)
static
Returns
Give the value of the log-pdf at x.
Parameters
xa real value
mu,sigmalocation and scale of the log-normal law

Definition at line 119 of file STK_Law_LogNormal.cpp.

120{
121 return 0;
122}

◆ mu()

Real const & STK::Law::LogNormal::mu ( ) const
inline
Returns
mu

Definition at line 84 of file STK_Law_LogNormal.h.

84{ return mu_;}

References mu_.

Referenced by setMu().

◆ pdf() [1/2]

Real STK::Law::LogNormal::pdf ( Real const x) const
virtual
Parameters
xa real value
Returns
the value of the log-normal pdf at x

Implements STK::Law::IUnivLaw< Real >.

Definition at line 61 of file STK_Law_LogNormal.cpp.

62{
63 return 0;
64}

◆ pdf() [2/2]

Real STK::Law::LogNormal::pdf ( Real const x,
Real const mu,
Real const sigma 
)
static
Parameters
xa real value
mu,sigmalocation and scale of the log-normal law
Returns
the value of the log-normal pdf at x

Definition at line 110 of file STK_Law_LogNormal.cpp.

111{
112 return 0;
113}

◆ rand() [1/2]

Real STK::Law::LogNormal::rand ( ) const
virtual

Generate a pseudo log-normalized LogNormal random variate.

Generate a pseudo log-normalized LogNormal random variate with location parameter mu_ and scale sigma_.

Returns
a pseudo log-normal random variate

Implements STK::Law::IUnivLaw< Real >.

Definition at line 54 of file STK_Law_LogNormal.cpp.

55{
56 return 0;
57}

◆ rand() [2/2]

Real STK::Law::LogNormal::rand ( Real const mu,
Real const sigma 
)
static

Generate a pseudo LogNormal random variate.

Generate a pseudo LogNormal random variate with location mu and scale sigma parameters.

Parameters
mu,sigmalocation and scale of the log-normal law
Returns
a pseudo log-normal random variate, centered in mu and with scale sigma

Definition at line 101 of file STK_Law_LogNormal.cpp.

102{
103 return 0;
104}

◆ setMu()

void STK::Law::LogNormal::setMu ( Real const mu)
inline
Parameters
muthe value to set to mu

Definition at line 88 of file STK_Law_LogNormal.h.

88{ mu_ = mu;}

References mu(), and mu_.

◆ setSigma()

void STK::Law::LogNormal::setSigma ( Real const sigma)
inline
Parameters
sigmathe value to set to sigma

Definition at line 90 of file STK_Law_LogNormal.h.

91 {
93 sigma_ = sigma;
94 }
#define STKDOMAIN_ERROR_1ARG(Where, Arg, Error)
Definition STK_Macros.h:165
void setSigma(Real const &sigma)

References setSigma(), sigma(), sigma_, and STKDOMAIN_ERROR_1ARG.

Referenced by setSigma().

◆ sigma()

Real const & STK::Law::LogNormal::sigma ( ) const
inline
Returns
sigma

Definition at line 86 of file STK_Law_LogNormal.h.

86{ return sigma_;}

References sigma_.

Referenced by setSigma().

Member Data Documentation

◆ mu_

Real STK::Law::LogNormal::mu_
protected

The location parameter.

Definition at line 170 of file STK_Law_LogNormal.h.

Referenced by mu(), and setMu().

◆ sigma_

Real STK::Law::LogNormal::sigma_
protected

The scale parameter.

Definition at line 172 of file STK_Law_LogNormal.h.

Referenced by setSigma(), and sigma().


The documentation for this class was generated from the following files: