|
STK++ 1.0
|
Compute the the maximum likelihood estimates of a Gaussian tow blocks statistical model. More...
#include <STK_Gaussian2BlocksStatModel.h>

Public Member Functions | |
| Gaussian2BlocksStatModel (Matrix const *p_data) | |
| constructor. | |
| virtual | ~Gaussian2BlocksStatModel () |
| destructor. | |
| Integer const & | dim () const |
| get the dimension of the model. | |
| void | setDim (Integer const &dim) |
| set the dimension of the model. | |
| bool | run (Integer const &dim) |
| implementation of the 2 blocks Gaussian statistical model | |
| bool | run (Vector const &weights, Integer const &dim) |
| implementation of the weighted 2 blocks Gaussian statistical model. | |
Protected Member Functions | |
| virtual void | compCovariance () |
| compute the empirical covariance matrix. | |
| virtual void | compWeightedCovariance (Vector const &weights) |
| compute the empirical weighted covariance matrix. | |
Protected Attributes | |
| Integer | dim_ |
| dimension of the 2 block model | |
| Real | variance2_ |
| variance in the second block | |
Compute the the maximum likelihood estimates of a Gaussian tow blocks statistical model.
A random vector
is a Gaussian two blocks if
and
where d is a given dimension.
Definition at line 86 of file STK_Gaussian2BlocksStatModel.h.
| home iovleff Developpement workspace stkpp projects StatModel src STK_Gaussian2BlocksStatModel cpp home iovleff Developpement workspace stkpp projects StatModel src STK_Gaussian2BlocksStatModel cpp STK::Gaussian2BlocksStatModel::Gaussian2BlocksStatModel | ( | Matrix const * | p_data | ) |
constructor.
The dimension of the model will be initialized to the maximal dimension of the data set (only one block).
| p_data | pointer on the data set |
Definition at line 48 of file STK_Gaussian2BlocksStatModel.cpp.
{ }
| STK::Gaussian2BlocksStatModel::~Gaussian2BlocksStatModel | ( | ) | [virtual] |
destructor.
Definition at line 55 of file STK_Gaussian2BlocksStatModel.cpp.
| Integer const& STK::Gaussian2BlocksStatModel::dim | ( | ) | const [inline] |
get the dimension of the model.
Definition at line 101 of file STK_Gaussian2BlocksStatModel.h.
| void STK::Gaussian2BlocksStatModel::setDim | ( | Integer const & | dim | ) | [inline] |
set the dimension of the model.
| dim | the dimension of the model |
Definition at line 105 of file STK_Gaussian2BlocksStatModel.h.
Referenced by run().
{
| bool STK::Gaussian2BlocksStatModel::run | ( | Integer const & | dim | ) | [inline] |
implementation of the 2 blocks Gaussian statistical model
true if no error occur and false otherwise. Definition at line 110 of file STK_Gaussian2BlocksStatModel.h.
References STK::GaussianStatModel::run(), and setDim().
{
setDim(dim);
return GaussianStatModel::run();
}implementation of the weighted 2 blocks Gaussian statistical model.
| weights | the weights of the samples |
| dim | the dimension of the first block |
true if no error occur and false otherwise. Definition at line 120 of file STK_Gaussian2BlocksStatModel.h.
References STK::GaussianStatModel::run(), and setDim().
{
setDim(dim);
return GaussianStatModel::run(weights);
}
| void STK::Gaussian2BlocksStatModel::compCovariance | ( | ) | [protected, virtual] |
compute the empirical covariance matrix.
Reimplemented from STK::GaussianStatModel.
Definition at line 60 of file STK_Gaussian2BlocksStatModel.cpp.
References STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::col(), STK::GaussianStatModel::cov_, STK::GaussianStatModel::mean_, and STK::IRunnerPtr2D< Real, Point, Vector, Matrix >::p_data_.
{
cov_(i, i) = Stat::varianceWithFixedMean<Vector>(p_data_->col(i), mean_[i]);
for (Integer j= first1; j < i; ++j)
{
cov_(i, j) = Stat::covarianceWithFixedMean<Vector>(p_data_->col(i), p_data_->col(j), mean_[i], mean_[j]);
cov_(j, i) = cov_(i,j);
}
}
// get dimensions for the second block
const Integer first2 = last1+1, last2 = p_data_->lastCol(), size2 = last2 - last1 ;
if (size2)
{
// compute variance of each column
for (Integer i= first2; i <= last2; ++i)
{ cov_(i, i) = Stat::varianceWithFixedMean<Vector>(p_data_->col(i), mean_[i]);}
variance2_ = trace(MatrixSquare(cov_, Range(first2, last2)))/(Real)size2;
// compute variance of each column
for (Integer i= first2; i <= last2; ++i)
{ cov_(i, i) = variance2_;}
}
}
/* compute the empirical covariance matrix. */
| void STK::Gaussian2BlocksStatModel::compWeightedCovariance | ( | Vector const & | weights | ) | [protected, virtual] |
compute the empirical weighted covariance matrix.
| weights | the weights of the samples |
Reimplemented from STK::GaussianStatModel.
Definition at line 91 of file STK_Gaussian2BlocksStatModel.cpp.
References STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::col(), STK::GaussianStatModel::cov_, STK::GaussianStatModel::mean_, and STK::IRunnerPtr2D< Real, Point, Vector, Matrix >::p_data_.
{
cov_(i, i) = Stat::varianceWithFixedMean<Vector>(p_data_->col(i), weights, mean_[i]);
for (Integer j= first1; j < i; ++j)
{
cov_(i, j) = 0.;
cov_(j, i) = 0.;
}
}
// get dimensions for the second block
const Integer first2 = last1+1, last2 = p_data_->lastCol(), size2 = last2 - last1 ;
if (size2)
{
// compute variance of each column
for (Integer i= first2; i <= last2; ++i)
{ cov_(i, i) = Stat::varianceWithFixedMean<Vector>(p_data_->col(i), weights, mean_[i]);}
variance2_ = trace(MatrixSquare(cov_, Range(first2, last2)))/(Real)size2;
for (Integer i= first2; i <= last2; ++i)
{ cov_(i, i) = variance2_;}
}
}
} // namespace STK
Integer STK::Gaussian2BlocksStatModel::dim_ [protected] |
dimension of the 2 block model
Definition at line 134 of file STK_Gaussian2BlocksStatModel.h.
Real STK::Gaussian2BlocksStatModel::variance2_ [protected] |
variance in the second block
Definition at line 136 of file STK_Gaussian2BlocksStatModel.h.