STK++ 0.9.13

Logistic distribution law. More...

#include <STK_Law_Logistic.h>

Inheritance diagram for STK::Law::Logistic:
Inheritance graph

Public Types

typedef IUnivLaw< RealBase
 

Public Member Functions

 Logistic (Real const &mu=0., Real const &scale=1.)
 Constructor.
 
virtual ~Logistic ()
 Destructor.
 
Real constmu () const
 
Real constscale () const
 
void setMu (Real const &mu)
 
void setScale (Real const &scale)
 
Real rand () const
 Generate a pseudo Logistic 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 logistic distribution.
 
virtual Real icdf (Real const &p) const
 Compute the inverse cumulative distribution function at p of the standard logistic 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 &scale)
 Generate a pseudo Logistic random variate with location mu and scale scale parameters.
 
static Real pdf (Real const &x, Real const &mu, Real const &scale)
 
static Real lpdf (Real const &x, Real const &mu, Real const &scale)
 
static Real cdf (Real const &t, Real const &mu, Real const &scale)
 
static Real icdf (Real const &p, Real const &mu, Real const &scale)
 

Protected Attributes

Real mu_
 The mu parameter.
 
Real scale_
 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

Logistic distribution law.

In probability theory and statistics, the logistic distribution is a continuous probability distribution. Its cumulative distribution function is the logistic function, which appears in logistic regression and feedforward neural networks. It resembles the logistic distribution in shape but has heavier tails (higher kurtosis).

The Logistic distribution with location = m and scale = s>0 has distribution function

\[
  F(x) = 1 / (1 + exp(-(x-m)/s))
\]

and density

\[
f(x) = \frac{1}{s} \frac{exp\left(\frac{x-m}{s}\right)}
                        {\left(1 + exp\left(\frac{x-m}{s}\right)\right)^2}.
\]

It is a long-tailed distribution with mean m and variance $ \frac{π^2s^2}{3} $.

Definition at line 67 of file STK_Law_Logistic.h.

Member Typedef Documentation

◆ Base

Constructor & Destructor Documentation

◆ Logistic()

STK::Law::Logistic::Logistic ( Real const mu = 0.,
Real const scale = 1. 
)
inline

Constructor.

Parameters
mumean of the Logistic distribution
scalescale of the Logistic distribution

Definition at line 75 of file STK_Law_Logistic.h.

76 : Base(_T("Logistic")), mu_(mu), scale_(scale) {}
#define _T(x)
Let x unmodified.
Real scale_
The scale parameter.
IUnivLaw< Real > Base
Real mu_
The mu parameter.
Real const & scale() const
Real const & mu() const

◆ ~Logistic()

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

Destructor.

Definition at line 78 of file STK_Law_Logistic.h.

78{}

Member Function Documentation

◆ cdf() [1/2]

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

Compute the cumulative distribution function at t of the standard logistic distribution.

The cumulative distribution function of the logistic distribution is also a scaled version of the Hyperbolic function.

\[
 F(t; \mu, s) = \frac{1}{1+e^{-\frac{t-\mu}{s}}}
 = \frac{1}{2} + \frac{1}{2} \;\operatorname{tanh}\!\left(\frac{t-\mu}{2s}\right).
 \]

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

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

Definition at line 83 of file STK_Law_Logistic.cpp.

84{
85 return 0;
86}

◆ cdf() [2/2]

Real STK::Law::Logistic::cdf ( Real const t,
Real const mu,
Real const scale 
)
static
Returns
the cumulative distribution function value at t.
Parameters
ta real value
mu,scalelocation and scale of the Logistic distribution

Definition at line 142 of file STK_Law_Logistic.cpp.

143{
144 return 0;
145}

◆ icdf() [1/2]

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

Compute the inverse cumulative distribution function at p of the standard logistic distribution.

The inverse cumulative distribution function (quantile function) of the logistic distribution is a generalization of the logit function. It is defined as follows:

\[
    Q(p;\mu,s) = \mu + s\,\ln\left(\frac{p}{1-p}\right).
\]

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

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

Definition at line 100 of file STK_Law_Logistic.cpp.

101{
102 return 0;
103}

◆ icdf() [2/2]

Real STK::Law::Logistic::icdf ( Real const p,
Real const mu,
Real const scale 
)
static
Returns
the inverse cumulative distribution function value at p.
Parameters
pa probability number.
mu,scalelocation and scale of the Logistic distribution

Definition at line 153 of file STK_Law_Logistic.cpp.

154{
155 return 0;
156}

◆ lpdf() [1/2]

Real STK::Law::Logistic::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 66 of file STK_Law_Logistic.cpp.

67{
68 return 0;
69}

◆ lpdf() [2/2]

Real STK::Law::Logistic::lpdf ( Real const x,
Real const mu,
Real const scale 
)
static
Returns
Give the value of the log-pdf at x.
Parameters
xa real value
mu,scalelocation and scale of the Logistic distribution

Definition at line 132 of file STK_Law_Logistic.cpp.

133{
134 return 0;
135}

◆ mu()

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

Definition at line 80 of file STK_Law_Logistic.h.

80{ return mu_;}

References mu_.

Referenced by setMu().

◆ pdf() [1/2]

Real STK::Law::Logistic::pdf ( Real const x) const
virtual
Parameters
xa real value
Returns
the value of the logistic pdf at x

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

Definition at line 59 of file STK_Law_Logistic.cpp.

60{
61 return 0;
62}

◆ pdf() [2/2]

Real STK::Law::Logistic::pdf ( Real const x,
Real const mu,
Real const scale 
)
static
Parameters
xa real value
mu,scalelocation and scale of the Logistic distribution
Returns
the value of the logistic pdf at x

Definition at line 123 of file STK_Law_Logistic.cpp.

124{
125 return 0;
126}

◆ rand() [1/2]

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

Generate a pseudo Logistic random variate.

Generate a pseudo Logistic random variate with location parameter mu_ and scale scale_.

Returns
a pseudo logistic random variate

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

Definition at line 52 of file STK_Law_Logistic.cpp.

53{
54 return 0;
55}

◆ rand() [2/2]

Real STK::Law::Logistic::rand ( Real const mu,
Real const scale 
)
static

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

scale scale parameters.

Parameters
mu,scalelocation and scale of the Logistic distribution
Returns
a pseudo logistic random variate, centered in mu and with scale scale

Definition at line 114 of file STK_Law_Logistic.cpp.

115{
116 return 0;
117}

◆ scale()

Real const & STK::Law::Logistic::scale ( ) const
inline
Returns
mu

Definition at line 82 of file STK_Law_Logistic.h.

82{ return scale_;}

References scale_.

Referenced by setScale().

◆ setMu()

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

Definition at line 84 of file STK_Law_Logistic.h.

84{ mu_ = mu;}

References mu(), and mu_.

◆ setScale()

void STK::Law::Logistic::setScale ( Real const scale)
inline
Parameters
scalethe value to set to scale

Definition at line 86 of file STK_Law_Logistic.h.

87 {
89 scale_ = scale;
90 }
#define STKDOMAIN_ERROR_1ARG(Where, Arg, Error)
Definition STK_Macros.h:165
void setScale(Real const &scale)

References scale(), scale_, setScale(), and STKDOMAIN_ERROR_1ARG.

Referenced by setScale().

Member Data Documentation

◆ mu_

Real STK::Law::Logistic::mu_
protected

The mu parameter.

Definition at line 173 of file STK_Law_Logistic.h.

Referenced by mu(), and setMu().

◆ scale_

Real STK::Law::Logistic::scale_
protected

The scale parameter.

Definition at line 175 of file STK_Law_Logistic.h.

Referenced by scale(), and setScale().


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