STK++ 1.0
STK::Stat::Multivariate< TYPE, TContainer2D > Class Template Reference

Computation of the multivariate statistics of a Variable. More...

#include <STK_Stat_Multivariate.h>

Inheritance diagram for STK::Stat::Multivariate< TYPE, TContainer2D >:
Collaboration diagram for STK::Stat::Multivariate< TYPE, TContainer2D >:

List of all members.

Public Member Functions

 Multivariate (TContainer2D const *p_data)
 Constructor.
virtual ~Multivariate ()
 virtual destructor.
Integer const & nbSamples () const
 Number of samples.
Integer const & nbVar () const
 Number of variables.
Array1D< Integer > const & nbMissingSamples () const
 Number of missing values.
Array1D< Integer > const & nbAvailableSamples () const
 Number of observed values.
virtual bool run ()
 run the estimation of the Multivariate statistics.
virtual void run (Vector const &weights)
 run the estimation of the weighted multivariate statistics.

Protected Attributes

Vector const * p_weights_
 Vector of the weights.
Integer nbSamples_
 number of samples
Integer nbVar_
 Number of variables.
Array1D< IntegernMiss_
 number of missing data of each variables
Array1D< IntegernbAvailable_
 number of observed data of each variables

Private Types

typedef IRunnerPtr2D< Real,
TContainer2D > 
Runner2D

Detailed Description

template<class TYPE, class TContainer2D>
class STK::Stat::Multivariate< TYPE, TContainer2D >

Computation of the multivariate statistics of a Variable.

The template parameter TContainer2D is the type of container used for storing the data : It should derive from ITContainer2D and contain elements of type TYPE.

The template parameter TYPE is the Type of the data to analyze.

Definition at line 55 of file STK_Stat_Multivariate.h.


Member Typedef Documentation

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

Definition at line 57 of file STK_Stat_Multivariate.h.


Constructor & Destructor Documentation

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

Constructor.

Data set are initialized but no computation is done in this constructor. Statistics of the number of missing data and available data are delegated to derived classes.

Parameters:
p_datathe data set

Definition at line 65 of file STK_Stat_Multivariate.h.

                : Runner2D(p_data)
                , p_weights_(0)
                , nbSamples_(p_data->sizeVe())
                , nbVar_(p_data->sizeHo())
                , nMiss_(p_data->rangeHo(), 0)
//                , nbSamples_(p_data->rangeHo(), nbSamples_)
    { }
template<class TYPE , class TContainer2D >
virtual STK::Stat::Multivariate< TYPE, TContainer2D >::~Multivariate ( ) [inline, virtual]

virtual destructor.

Definition at line 76 of file STK_Stat_Multivariate.h.

{ ;}

Member Function Documentation

template<class TYPE , class TContainer2D >
Integer const& STK::Stat::Multivariate< TYPE, TContainer2D >::nbSamples ( ) const [inline]

Number of samples.

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

Definition at line 81 of file STK_Stat_Multivariate.h.

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

{return nbSamples_;}
template<class TYPE , class TContainer2D >
Integer const& STK::Stat::Multivariate< TYPE, TContainer2D >::nbVar ( ) const [inline]

Number of variables.

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

Definition at line 86 of file STK_Stat_Multivariate.h.

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

{return nbVar_;}
template<class TYPE , class TContainer2D >
Array1D<Integer> const& STK::Stat::Multivariate< TYPE, TContainer2D >::nbMissingSamples ( ) const [inline]

Number of missing values.

Returns:
An array with the number of missing values for each variables of the data set

Definition at line 92 of file STK_Stat_Multivariate.h.

References STK::Stat::Multivariate< TYPE, TContainer2D >::nMiss_.

{return nMiss_;}
template<class TYPE , class TContainer2D >
Array1D<Integer> const& STK::Stat::Multivariate< TYPE, TContainer2D >::nbAvailableSamples ( ) const [inline]

Number of observed values.

Returns:
An array with the number of observed values for each variables of the data set (not missing).

Definition at line 98 of file STK_Stat_Multivariate.h.

References STK::Stat::Multivariate< TYPE, TContainer2D >::nbAvailable_.

{return nbAvailable_;}
template<class TYPE , class TContainer2D >
virtual bool STK::Stat::Multivariate< TYPE, TContainer2D >::run ( ) [inline, virtual]

run the estimation of the Multivariate statistics.

Implements STK::IRunnerBase.

Definition at line 101 of file STK_Stat_Multivariate.h.

References STK::IContainer2D::firstCol(), STK::IContainer2D::firstRow(), STK::IContainer2D::lastCol(), STK::IContainer2D::lastRow(), STK::Stat::Multivariate< TYPE, TContainer2D >::nbAvailable_, STK::Stat::Multivariate< TYPE, TContainer2D >::nbSamples_, STK::Stat::Multivariate< TYPE, TContainer2D >::nbVar_, STK::Stat::Multivariate< TYPE, TContainer2D >::nMiss_, STK::IRunnerPtr2D< TYPE, TContainer2D >::p_data_, STK::IContainer2D::rangeHo(), STK::IContainer1D::resize(), STK::IContainer2D::sizeHo(), and STK::IContainer2D::sizeVe().

Referenced by STK::LocalVariance::computeCovarianceMatrices(), and STK::Stat::Multivariate< TYPE, TContainer2D >::run().

    {
      nbSamples_ = this->p_data_->sizeVe();
      nbVar_ = this->p_data_->sizeHo();
      nMiss_.resize(this->p_data_->rangeHo());
      nMiss_ = 0;
      nbAvailable_.resize(this->p_data_->rangeHo());
      // get dimensions
      const Integer first_ind = this->p_data_->firstRow();
      const Integer last_ind  = this->p_data_->lastRow();
      const Integer first_var = this->p_data_->firstCol();
      const Integer last_var  = this->p_data_->lastCol();
      // for each variables
      for (Integer j= first_var; j<= last_var; j++)
      {
        // number of not missing observations
        Integer nobs = nbSamples_;
        // compute the mean
        for (Integer i= first_ind; i<= last_ind; i++)
          if (!Arithmetic<TYPE>::isFinite((*this->p_data_)(i,j))) nobs--;
        nbAvailable_[j] = nobs;
        nMiss_[j] = nbSamples_ - nobs;
      }
      return true;
    }

Here is the call graph for this function:

template<class TYPE , class TContainer2D >
virtual void STK::Stat::Multivariate< TYPE, TContainer2D >::run ( Vector const &  weights) [inline, virtual]

run the estimation of the weighted multivariate statistics.

Parameters:
weightsthe weights of the samples

Definition at line 130 of file STK_Stat_Multivariate.h.

References STK::Stat::Multivariate< TYPE, TContainer2D >::p_weights_, and STK::Stat::Multivariate< TYPE, TContainer2D >::run().

    {
      p_weights_ = &weights;
      run();
    }

Here is the call graph for this function:


Member Data Documentation

template<class TYPE , class TContainer2D >
Vector const* STK::Stat::Multivariate< TYPE, TContainer2D >::p_weights_ [protected]

Vector of the weights.

Definition at line 138 of file STK_Stat_Multivariate.h.

Referenced by STK::Stat::Multivariate< TYPE, TContainer2D >::run().

template<class TYPE , class TContainer2D >
Array1D<Integer> STK::Stat::Multivariate< TYPE, TContainer2D >::nMiss_ [protected]
template<class TYPE , class TContainer2D >
Array1D<Integer> STK::Stat::Multivariate< TYPE, TContainer2D >::nbAvailable_ [protected]

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