STK++ 0.9.13
|
Interface base class for all Multivariate Statistical Models. More...
#include <STK_IMultiStatModel.h>
Public Types | |
typedef hidden::StatModelTraits< Derived >::Data | Data |
Type of the container with the data. | |
typedef hidden::StatModelTraits< Derived >::Type | Type |
Type of the data in the container. | |
typedef hidden::StatModelTraits< Derived >::WColVector | WColVector |
Type of the vector with the weights. | |
typedef hidden::StatModelTraits< Derived >::Parameters | Parameters |
Type of the parameters of the Model. | |
Public Member Functions | |
Data const *const | p_data () const |
Parameters const & | param () const |
String const & | error () const |
void | setData (Data const *p_data) |
Set the data set. | |
bool | run () |
Estimate the parameters of the model and update the model. | |
bool | run (WColVector const &weights) |
compute the weighted empirical probability of success based on the observed variables. | |
void | writeParameters (ostream &os) |
void | writeParametersImpl (ostream &os) |
default implementation of the writeParameters method. | |
![]() | |
int | nbSample () const |
Real | lnNbSample () const |
int | nbVariable () const |
Real | lnLikelihood () const |
Real | likelihood () const |
int | nbFreeParameter () const |
Real | computeBIC () const |
Real | computeAIC () const |
Real | computeML () const |
![]() | |
Derived & | asDerived () |
static cast : return a reference of this with a cast to the derived class. | |
Derived const & | asDerived () const |
static cast : return a const reference of this with a cast to the derived class. | |
Derived * | asPtrDerived () |
static cast : return a ptr on a Derived of this with a cast to the derived class. | |
Derived const * | asPtrDerived () const |
static cast : return a ptr on a constant Derived of this with a cast to the derived class. | |
Derived * | clone () const |
create a leaf using the copy constructor of the Derived class. | |
Derived * | clone (bool isRef) const |
create a leaf using the copy constructor of the Derived class and a flag determining if the clone is a reference or not. | |
Protected Member Functions | |
IMultiStatModel () | |
default constructor. | |
IMultiStatModel (Data const &data) | |
Constructor with data set. | |
IMultiStatModel (Data const *p_data) | |
Constructor with a ptr on the data set. | |
IMultiStatModel (IMultiStatModel const &model) | |
Copy constructor. | |
~IMultiStatModel () | |
destructor | |
Parameters & | param () |
Real | computeLnLikelihood () const |
compute the log Likelihood of the statistical model. | |
void | update () |
update the model if a new data set is set | |
![]() | |
IStatModelBase () | |
Default constructor. | |
IStatModelBase (int nbSample) | |
Constructor with specified dimension. | |
IStatModelBase (int nbSample, int nbVariable) | |
Constructor with specified dimension. | |
IStatModelBase (IStatModelBase const &model) | |
Copy constructor. | |
~IStatModelBase () | |
destructor | |
void | setNbFreeParameter (int const &nbFreeParameter) |
set the number of free parameters of the model | |
void | setNbSample (int const &nbSample) |
set the number of samples of the model | |
void | setNbVariable (int const &nbVariable) |
set the number of variables of the model | |
void | setLnLikelihood (Real const &lnLikelihood) |
set the log-likelihood of the model | |
void | initialize (int nbSample, int nbVariable) |
set the dimensions of the parameters of the model | |
![]() | |
IRecursiveTemplate () | |
constructor. | |
~IRecursiveTemplate () | |
destructor. | |
Protected Attributes | |
Data const * | p_data_ |
Pointer on the parameters of the model. | |
Parameters | param_ |
Pointer on the parameters of the model. | |
String | msg_error_ |
String with the last error message. | |
Interface base class for all Multivariate Statistical Models.
A Statistical model,
A statistical model may be used to describe the set of distributions from which one assumes that a particular data set is sampled. For example, if one assumes that data arise from a multivariate Gaussian distribution, then one has assumed a Gaussian model:
From a computational point of view a statistical model is defined with the help of two elements
Data
.Parameters
. These parameters can be created using the createParameters
method with the effect to call the default constructor of the Parameters class, or can be set to this class using the method setParameters
.The design for this class is the Curious Recursive Pattern. Derived implementations of this interface have to implement the following psudo virtual methods:
Dervived | any kind of multidimensionnal model. |
Definition at line 112 of file STK_IMultiStatModel.h.
typedef hidden::StatModelTraits<Derived>::Data STK::IMultiStatModel< Derived >::Data |
Type of the container with the data.
Definition at line 116 of file STK_IMultiStatModel.h.
typedef hidden::StatModelTraits<Derived>::Parameters STK::IMultiStatModel< Derived >::Parameters |
Type of the parameters of the Model.
Definition at line 122 of file STK_IMultiStatModel.h.
typedef hidden::StatModelTraits<Derived>::Type STK::IMultiStatModel< Derived >::Type |
Type of the data in the container.
Definition at line 118 of file STK_IMultiStatModel.h.
typedef hidden::StatModelTraits<Derived>::WColVector STK::IMultiStatModel< Derived >::WColVector |
Type of the vector with the weights.
Definition at line 120 of file STK_IMultiStatModel.h.
|
inlineprotected |
default constructor.
Definition at line 126 of file STK_IMultiStatModel.h.
|
inlineprotected |
Constructor with data set.
Definition at line 128 of file STK_IMultiStatModel.h.
References STK::IStatModelBase::initialize().
|
inlineprotected |
Constructor with a ptr on the data set.
Definition at line 131 of file STK_IMultiStatModel.h.
References STK::IStatModelBase::initialize(), STK::IMultiStatModel< Derived >::p_data(), STK::IMultiStatModel< Derived >::p_data_, and STK::IMultiStatModel< Derived >::param_.
|
inlineprotected |
Copy constructor.
model | the model to copy |
Definition at line 142 of file STK_IMultiStatModel.h.
|
inlineprotected |
|
inlineprotected |
compute the log Likelihood of the statistical model.
Definition at line 234 of file STK_IMultiStatModel.h.
References STK::IRecursiveTemplate< Derived >::asDerived(), STK::IMultiStatModel< Derived >::p_data(), and STK::sum().
Referenced by STK::IMultiStatModel< Derived >::run(), and STK::IMultiStatModel< Derived >::run().
|
inline |
Definition at line 156 of file STK_IMultiStatModel.h.
References STK::IMultiStatModel< Derived >::msg_error_.
|
inline |
Definition at line 152 of file STK_IMultiStatModel.h.
References STK::IMultiStatModel< Derived >::p_data_.
Referenced by STK::IMultiStatModel< Derived >::computeLnLikelihood(), STK::IMultiStatModel< Derived >::IMultiStatModel(), STK::IMultiStatModel< Derived >::run(), STK::IMultiStatModel< Derived >::run(), STK::IMultiStatModel< Derived >::setData(), and STK::IMultiStatModel< Derived >::update().
|
inlineprotected |
Definition at line 232 of file STK_IMultiStatModel.h.
References STK::IMultiStatModel< Derived >::param_.
|
inline |
Definition at line 154 of file STK_IMultiStatModel.h.
References STK::IMultiStatModel< Derived >::param_.
|
inline |
Estimate the parameters of the model and update the model.
Definition at line 167 of file STK_IMultiStatModel.h.
References STK::IRecursiveTemplate< Derived >::asDerived(), STK::IMultiStatModel< Derived >::computeLnLikelihood(), STK::Exception::error(), STK::IMultiStatModel< Derived >::msg_error_, STK::IMultiStatModel< Derived >::p_data(), STK::IMultiStatModel< Derived >::run(), STK::IStatModelBase::setLnLikelihood(), STK::IStatModelBase::setNbFreeParameter(), and STKERROR_NO_ARG.
Referenced by STK::IMultiStatModel< Derived >::run(), and STK::IMultiStatModel< Derived >::run().
|
inline |
compute the weighted empirical probability of success based on the observed variables.
The NA values are discarded.
weights | the weights of the observations |
Definition at line 192 of file STK_IMultiStatModel.h.
References STK::IRecursiveTemplate< Derived >::asDerived(), STK::IMultiStatModel< Derived >::computeLnLikelihood(), STK::Exception::error(), STK::IMultiStatModel< Derived >::msg_error_, STK::IMultiStatModel< Derived >::p_data(), STK::IMultiStatModel< Derived >::run(), STK::IStatModelBase::setLnLikelihood(), STK::IStatModelBase::setNbFreeParameter(), and STKERROR_NO_ARG.
|
inline |
Set the data set.
If the state of the derived runner change when a new data set is set the user have to overload the udpate() method.
p_data | A pointer on the data set to run |
Definition at line 161 of file STK_IMultiStatModel.h.
References STK::IMultiStatModel< Derived >::p_data(), STK::IMultiStatModel< Derived >::p_data_, and STK::IMultiStatModel< Derived >::update().
|
inlineprotected |
update the model if a new data set is set
Definition at line 242 of file STK_IMultiStatModel.h.
References STK::IStatModelBase::initialize(), STK::IMultiStatModel< Derived >::p_data(), STK::IMultiStatModel< Derived >::p_data_, and STK::IMultiStatModel< Derived >::param_.
Referenced by STK::IMultiStatModel< Derived >::setData().
|
inline |
os | the output stream for the parameters |
Definition at line 214 of file STK_IMultiStatModel.h.
References STK::IRecursiveTemplate< Derived >::asDerived().
|
inline |
default implementation of the writeParameters method.
os | the output stream for the parameters |
Definition at line 217 of file STK_IMultiStatModel.h.
|
protected |
String with the last error message.
Definition at line 230 of file STK_IMultiStatModel.h.
Referenced by STK::IMultiStatModel< Derived >::error(), STK::IMultiStatModel< Derived >::run(), and STK::IMultiStatModel< Derived >::run().
|
protected |
Pointer on the parameters of the model.
Definition at line 226 of file STK_IMultiStatModel.h.
Referenced by STK::IMultiStatModel< Derived >::IMultiStatModel(), STK::IMultiStatModel< Derived >::p_data(), STK::IMultiStatModel< Derived >::setData(), and STK::IMultiStatModel< Derived >::update().
|
protected |
Pointer on the parameters of the model.
Definition at line 228 of file STK_IMultiStatModel.h.
Referenced by STK::IMultiStatModel< Derived >::IMultiStatModel(), STK::IMultiStatModel< Derived >::param(), STK::IMultiStatModel< Derived >::param(), and STK::IMultiStatModel< Derived >::update().