STK++ 1.0
STK::Stat::Multivariate< Real, TContainerHo, TContainerVe, TContainer2D > Class Template Reference

Computation of the Multivariate Statistics of a 2D Container of Real. More...

#include <STK_Stat_MultivariateReal.h>

Inheritance diagram for STK::Stat::Multivariate< Real, TContainerHo, TContainerVe, TContainer2D >:

List of all members.

Public Member Functions

 Multivariate (TContainer2D const *p_data)
 Constructor.
virtual ~Multivariate ()
 virtual destructor.
Integer const & nbVar () const
 get the number of variables
Integer const & nbSamples () const
 get the umber of samples
TContainerHo const & mean () const
 get the Vector of the mean
TContainerHo const & variance () const
 get the vector of the variance of the Variables
MatrixSquare const & covariance () const
 Matrix of the covariance of the variables.
virtual bool run ()
 run the estimation of the Multivariate statistics.
virtual bool run (TContainerVe const &weights)
 run the estimation of the weighted multivariate statistics.

Protected Attributes

Integer nbSamples_
 number of samples
Integer nbVar_
 Number of variables.
TContainerHo mean_
 Vector of the mean of the Variables.
TContainerHo var_
 Vector of the variance of the variables.
MatrixSquare cov_
 Matrix of the covariance of the variables.

Private Types

typedef IRunnerPtr2D< Real,
TContainerHo, TContainerVe,
TContainer2D > 
Runner2D
 type of runner

Detailed Description

template<class TContainerHo, class TContainerVe, class TContainer2D>
class STK::Stat::Multivariate< Real, TContainerHo, TContainerVe, TContainer2D >

Computation of the Multivariate Statistics of a 2D Container of Real.

This partial specialization if the class Multivariate is just a factory class for computing the mean, the variance and the covariance Matrix of a p_data set stored in a TContainer2D with n rows (the samples) and p columns (the variables).

The p_data set will be copied as a reference of the original p_data set.

The p_data set can be weighted with a vector of weight.

Definition at line 69 of file STK_Stat_MultivariateReal.h.


Member Typedef Documentation

template<class TContainerHo , class TContainerVe , class TContainer2D >
typedef IRunnerPtr2D< Real, TContainerHo, TContainerVe, TContainer2D> STK::Stat::Multivariate< Real, TContainerHo, TContainerVe, TContainer2D >::Runner2D [private]

type of runner

Definition at line 72 of file STK_Stat_MultivariateReal.h.


Constructor & Destructor Documentation

template<class TContainerHo , class TContainerVe , class TContainer2D >
STK::Stat::Multivariate< Real, TContainerHo, TContainerVe, TContainer2D >::Multivariate ( TContainer2D const *  p_data) [inline]

Constructor.

Compute the Multivariate statistics of the Matrix p_data set.

Parameters:
p_datathe p_data set

Definition at line 79 of file STK_Stat_MultivariateReal.h.

                : Runner2D(p_data)
                , nbSamples_(p_data->sizeVe())
                , nbVar_(p_data->sizeHo())
                , mean_(p_data->rangeHo())
                , var_(p_data->rangeHo())
                , cov_(p_data->rangeHo())
    { }
template<class TContainerHo , class TContainerVe , class TContainer2D >
virtual STK::Stat::Multivariate< Real, TContainerHo, TContainerVe, TContainer2D >::~Multivariate ( ) [inline, virtual]

virtual destructor.

Definition at line 89 of file STK_Stat_MultivariateReal.h.

{ }

Member Function Documentation

template<class TContainerHo , class TContainerVe , class TContainer2D >
Integer const& STK::Stat::Multivariate< Real, TContainerHo, TContainerVe, TContainer2D >::nbVar ( ) const [inline]

get the number of variables

Returns:
the number of variables in the p_data set (the number of columns)

Definition at line 94 of file STK_Stat_MultivariateReal.h.

References STK::Stat::Multivariate< TYPE, TContainerHo, TContainerVe, TContainer2D >::nbVar_.

{return nbVar_;}
template<class TContainerHo , class TContainerVe , class TContainer2D >
Integer const& STK::Stat::Multivariate< Real, TContainerHo, TContainerVe, TContainer2D >::nbSamples ( ) const [inline]

get the umber of samples

Returns:
the number of samples in the p_data set (the number of rows)

Definition at line 98 of file STK_Stat_MultivariateReal.h.

References STK::Stat::Multivariate< TYPE, TContainerHo, TContainerVe, TContainer2D >::nbSamples_.

{return nbSamples_;}
template<class TContainerHo , class TContainerVe , class TContainer2D >
TContainerHo const& STK::Stat::Multivariate< Real, TContainerHo, TContainerVe, TContainer2D >::mean ( ) const [inline]

get the Vector of the mean

Returns:
the mean of the variables

Definition at line 101 of file STK_Stat_MultivariateReal.h.

{ return mean_;}
template<class TContainerHo , class TContainerVe , class TContainer2D >
TContainerHo const& STK::Stat::Multivariate< Real, TContainerHo, TContainerVe, TContainer2D >::variance ( ) const [inline]

get the vector of the variance of the Variables

Returns:
the variance of the variables

Definition at line 105 of file STK_Stat_MultivariateReal.h.

{ return var_;}
template<class TContainerHo , class TContainerVe , class TContainer2D >
MatrixSquare const& STK::Stat::Multivariate< Real, TContainerHo, TContainerVe, TContainer2D >::covariance ( ) const [inline]

Matrix of the covariance of the variables.

Returns:
the covariance of the variables

Definition at line 109 of file STK_Stat_MultivariateReal.h.

{ return cov_;}
template<class TContainerHo , class TContainerVe , class TContainer2D >
virtual bool STK::Stat::Multivariate< Real, TContainerHo, TContainerVe, TContainer2D >::run ( ) [inline, virtual]

run the estimation of the Multivariate statistics.

Implements STK::IRunnerBase.

Definition at line 111 of file STK_Stat_MultivariateReal.h.

References STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::col(), STK::Stat::covarianceWithFixedMean(), STK::IContainer2D::firstCol(), STK::IContainer2D::lastCol(), STK::Stat::mean(), STK::IRunnerPtr2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::p_data_, and STK::Stat::varianceWithFixedMean().

    {
      // get dimensions
      const Integer first = this->p_data_->firstCol(), last  = this->p_data_->lastCol();
      // for each variables
      for (Integer j= first; j<= last; j++)
      {
        mean_[j] = Stat::mean(this->p_data_->col(j));
        // compute the variance
        var_[j]  = varianceWithFixedMean(this->p_data_->col(j), mean_[j]);
        cov_(j, j) = var_[j];
        // compute the covariances
        for (Integer i= first; i<j; i++)
        {
          cov_(i, j) = covarianceWithFixedMean(this->p_data_->col(i), this->p_data_->col(j), mean_[i], mean_[j]);
          cov_(j, i) = cov_(i, j);
        }
      }
      return true;
    }
template<class TContainerHo , class TContainerVe , class TContainer2D >
virtual bool STK::Stat::Multivariate< Real, TContainerHo, TContainerVe, TContainer2D >::run ( TContainerVe const &  weights) [inline, virtual]

run the estimation of the weighted multivariate statistics.

Parameters:
weightsthe weights of the samples

Implements STK::IRunnerPtr2D< Real, TContainerHo, TContainerVe, TContainer2D >.

Definition at line 135 of file STK_Stat_MultivariateReal.h.

References STK::ITContainer2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::col(), STK::Stat::covarianceWithFixedMean(), STK::IContainer2D::firstCol(), STK::IContainer2D::lastCol(), STK::Stat::mean(), STK::IRunnerPtr2D< TYPE, TContainerHo, TContainerVe, TContainer2D >::p_data_, and STK::Stat::varianceWithFixedMean().

    {
      // get dimensions
      const Integer first = this->p_data_->firstCol(), last  = this->p_data_->lastCol();
      // for each variables
      for (Integer j= first; j<= last; j++)
      {
        mean_[j] = Stat::mean(this->p_data_->col(j), weights);
        // compute the variance
        var_[j]  = varianceWithFixedMean(this->p_data_->col(j), weights, mean_[j]);
        cov_(j, j) = var_[j];
        // compute the covariances
        for (Integer i= first; i<j; i++)
        {
          cov_(i, j) = covarianceWithFixedMean(this->p_data_->col(i), this->p_data_->col(j), weights, mean_[i], mean_[j]);
          cov_(j, i) = cov_(i, j);
        }
      }
      return true;
    }

Member Data Documentation

template<class TContainerHo , class TContainerVe , class TContainer2D >
Integer STK::Stat::Multivariate< Real, TContainerHo, TContainerVe, TContainer2D >::nbSamples_ [protected]

number of samples

Definition at line 158 of file STK_Stat_MultivariateReal.h.

template<class TContainerHo , class TContainerVe , class TContainer2D >
Integer STK::Stat::Multivariate< Real, TContainerHo, TContainerVe, TContainer2D >::nbVar_ [protected]

Number of variables.

Definition at line 160 of file STK_Stat_MultivariateReal.h.

template<class TContainerHo , class TContainerVe , class TContainer2D >
TContainerHo STK::Stat::Multivariate< Real, TContainerHo, TContainerVe, TContainer2D >::mean_ [protected]

Vector of the mean of the Variables.

Definition at line 163 of file STK_Stat_MultivariateReal.h.

template<class TContainerHo , class TContainerVe , class TContainer2D >
TContainerHo STK::Stat::Multivariate< Real, TContainerHo, TContainerVe, TContainer2D >::var_ [protected]

Vector of the variance of the variables.

Definition at line 165 of file STK_Stat_MultivariateReal.h.

template<class TContainerHo , class TContainerVe , class TContainer2D >
MatrixSquare STK::Stat::Multivariate< Real, TContainerHo, TContainerVe, TContainer2D >::cov_ [protected]

Matrix of the covariance of the variables.

Definition at line 167 of file STK_Stat_MultivariateReal.h.


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