STK++ 1.0
STK_IAAModel.h
Go to the documentation of this file.
00001 /*--------------------------------------------------------------------*/
00002 /*     Copyright (C) 2004-2010  Serge Iovleff
00003 
00004  This program is free software; you can redistribute it and/or modify
00005  it under the terms of the GNU Lesser General Public License as
00006  published by the Free Software Foundation; either version 2 of the
00007  License, or (at your option) any later version.
00008 
00009  This program is distributed in the hope that it will be useful,
00010  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  GNU Lesser General Public License for more details.
00013 
00014  You should have received a copy of the GNU Lesser General Public
00015  License along with this program; if not, write to the
00016  Free Software Foundation, Inc.,
00017  59 Temple Place,
00018  Suite 330,
00019  Boston, MA 02111-1307
00020  USA
00021 
00022  Contact : Serge.Iovleff@stkpp.org
00023  */
00024 
00025 /*
00026  * Project:  stkpp::AAModels
00027  * created on: 23 déc. 2010
00028  * Purpose: Interface bas class for all AA Models.
00029  * Author:   iovleff, serge.iovleff@stkpp.org
00030  *
00031  **/
00032 
00037 #ifndef STK_IAAMODEL_H
00038 #define STK_IAAMODEL_H
00039 
00040 #include "../../Arrays/include/STK_MatrixSquare.h"
00041 
00042 namespace STK
00043 {
00044 
00045 // forward declarations
00046 class IReduct;
00047 template<class X, class Y, class W> class IRegression;
00048 
00065 class IAAModel
00066 {
00068     typedef IRegression<Matrix, Matrix, Vector > Regressor;
00069   protected:
00073     IAAModel( Matrix& workData);
00077     ~IAAModel();
00078 
00079   public:
00083     inline Matrix const& workData() const { return *p_workData_;}
00087     inline IReduct* const& p_reductor() const { return p_reductor_;}
00091     inline Regressor* const& p_regressor() const { return p_regressor_;}
00095     inline Matrix*  const& p_reduced() const { return p_reduced_;}
00099     inline Matrix*  const& p_predicted() const { return p_predicted_;}
00103     inline Matrix* const& p_residuals() const { return p_residuals_;}
00107     inline Integer const& dim() const { return dim_;}
00108 
00112     inline bool isCentered() const { return isCentered_;}
00116     inline bool isStandardized() const { return isStandardized_;}
00117 
00121     inline Point const& mean() const { return mean_;}
00125     inline Point const& std() const { return std_;}
00129     inline MatrixSquare const& covProjected() const { return covProjected_;}
00133     inline MatrixSquare const& covResiduals() const { return covResiduals_;}
00137     inline Real const& varResiduals() const { return varResiduals_;}
00138 
00142     void setDimension( Integer const& dim);
00146     virtual void setWorkData( Matrix& workData);
00150     void setReductor( IReduct* p_reductor);
00154     void setRegressor( Regressor* p_regressor);
00155 
00157     void freeReductor();
00159     void freeRegressor();
00160 
00162     void center();
00166     void center( Vector const& weights);
00168     void standardize();
00172     void standardize( Vector const& weights);
00173 
00177     void reduction();
00181     void reduction( Vector const& weights);
00184     void regression();
00189     void regression( Vector const& weights);
00190 
00193     void decenterResults();
00196     void destandardizeResults();
00199     void computeProjectedCovariance();
00201     void computeResidualsCovariance();
00202 
00203   protected:
00207     Regressor* p_regressor_;
00211     IReduct* p_reductor_;
00212 
00214     Matrix* p_workData_;
00216     Matrix* p_reduced_;
00218     Matrix* p_predicted_;
00220     Matrix* p_residuals_;
00221 
00222   private:
00224     Integer dim_;
00226     Point mean_;
00228     Point std_;
00231     bool isCentered_;
00234     bool isStandardized_;
00236     MatrixSquare covProjected_;
00238     MatrixSquare covResiduals_;
00240     Real varResiduals_;
00241 };
00242 
00243 }
00244 
00245 #endif /* STK_IAAMODEL_H */