STK++ 0.9.13
STK_IStatModelBase.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------*/
2/* Copyright (C) 2004-2016 Serge Iovleff
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::StatModels
27 * created on: 15 oct. 2012
28 * Author: iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
29 **/
30
36#ifndef STK_ISTATMODELBASE_H
37#define STK_ISTATMODELBASE_H
38
39#include <cmath>
40#include <STKernel.h>
41
42namespace STK
43{
56{
57 protected:
59 inline IStatModelBase() { initialize(0, 0);}
64 { initialize(nbSample, 0);}
80 inline ~IStatModelBase() {}
81
82 public:
84 inline int nbSample() const { return nbSample_;}
86 inline Real lnNbSample() const
87 { return (nbSample_ <= 0) ? -Arithmetic<Real>::infinity() : std::log((Real)nbSample_);}
89 inline int nbVariable() const { return nbVariable_;}
91 inline Real lnLikelihood() const { return lnLikelihood_;}
93 inline Real likelihood() const
94 { return (Arithmetic<Real>::isFinite(lnLikelihood_)) ? std::exp((Real)lnLikelihood_) : 0.;}
96 inline int nbFreeParameter() const { return nbFreeParameter_;}
98 inline Real computeBIC() const
99 { return (-2. * lnLikelihood() + nbFreeParameter() * lnNbSample());}
101 inline Real computeAIC() const
102 { return (-2. * lnLikelihood()+nbFreeParameter());}
104 inline Real computeML() const
105 { return (-2. * lnLikelihood());}
106
107 protected:
116 inline void setNbSample( int const& nbSample)
117 { nbSample_ = nbSample;}
121 inline void setNbVariable( int const& nbVariable)
139
140 private:
149};
150
151} // namespace STK
152
153#endif /* STK_ISTATMODELBASE_H */
This file include all the header files of the project STKernel.
Interface base class for all Statistical Models.
IStatModelBase(int nbSample, int nbVariable)
Constructor with specified dimension.
IStatModelBase()
Default constructor.
void setNbFreeParameter(int const &nbFreeParameter)
set the number of free parameters of the model
IStatModelBase(int nbSample)
Constructor with specified dimension.
void setLnLikelihood(Real const &lnLikelihood)
set the log-likelihood of the model
IStatModelBase(IStatModelBase const &model)
Copy constructor.
void setNbSample(int const &nbSample)
set the number of samples of the model
int nbFreeParameter_
number of free parameters of the model
int nbSample_
total available samples
void setNbVariable(int const &nbVariable)
set the number of variables of the model
void initialize(int nbSample, int nbVariable)
set the dimensions of the parameters of the model
Real lnLikelihood_
likelihood of the samples
int nbVariable_
total available variables
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
double Real
STK fundamental type of Real values.
The namespace STK is the main domain space of the Statistical ToolKit project.
Arithmetic properties of STK fundamental types.