STK++ 0.9.13
STK_Law_IUnivLaw.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------*/
2/* Copyright (C) 2004-2016 Serge Iovleff, Université Lille 1, Inria
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this program; if not, write to the
16 Free Software Foundation, Inc.,
17 59 Temple Place,
18 Suite 330,
19 Boston, MA 02111-1307
20 USA
21
22 Contact : S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
23*/
24
25/*
26 * Project: stkpp::STatistiK::Law
27 * Purpose: Interface base class for all univariate distributions laws.
28 * Author: Serge Iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
29 **/
30
36#ifndef STK_LAW_IUNIVLAW_H
37#define STK_LAW_IUNIVLAW_H
38
39#include "STK_Law_ILawBase.h"
40
41namespace STK
42{
43
44namespace Law
45{
70template <class Type>
71class IUnivLaw: public ILawBase
72{
73 protected:
81 IUnivLaw(IUnivLaw const& law): ILawBase(law.name_) {}
82
83 public:
85 inline virtual ~IUnivLaw() {}
86 // pure virtual metods
88 virtual Type rand() const =0;
94 virtual Real pdf(Type const& x) const =0;
100 virtual Type icdf(Real const& p) const=0;
101
102 // virtual methods with default implementation
108 virtual Real lpdf(Type const& x) const { return(std::log(pdf(x)));}
114 virtual Real cdf(Real const& t) const =0;
120 virtual Real lcdf(Real const& t) const { return(std::log(cdf(t)));}
126 virtual Real cdfc(Real const& t) const { return(1. - cdf(t));}
132 virtual Real lcdfc(Real const& t) const { return(std::log(cdfc(t)));}
133};
134
135} // namespace Law
136
137} // namespace STK
138
139#endif /*STK_LAW_IUNIVLAW_H*/
In this file we define the interface base class for all multivariate probabilities laws ILawBase.
Interface base class for all the (univariate/multivariate) probabilities laws.
String name_
Name of the Law.
String const & name() const
Interface base class for all the univariate distributions.
virtual ~IUnivLaw()
Virtual destructor.
IUnivLaw(IUnivLaw const &law)
copy Constructor.
virtual Real cdfc(Real const &t) const
calculate the complement of cumulative distribution function, called in statistics the survival funct...
virtual Real lcdfc(Real const &t) const
calculate the log-complement of cumulative distribution function Give the log-probability that a rand...
virtual Real lcdf(Real const &t) const
compute the lower tail log-cumulative distribution function Give the log-probability that a random va...
IUnivLaw(String const &name)
Constructor.
virtual Type icdf(Real const &p) const =0
inverse cumulative distribution function The quantile is defined as the smallest value x such that F...
virtual Real pdf(Type const &x) const =0
compute the probability distribution function (density) in the continuous case and the probability ma...
virtual Type rand() const =0
virtual Real cdf(Real const &t) const =0
compute the lower tail cumulative distribution function Give the probability that a random variate is...
virtual Real lpdf(Type const &x) const
compute the log probability distribution function Give the value of the log-pdf at the point x.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
std::basic_string< Char > String
STK fundamental type of a String.
double Real
STK fundamental type of Real values.
The namespace STK is the main domain space of the Statistical ToolKit project.