- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

# arx.h

Go to the documentation of this file.

    00001
    00013 #ifndef AR_H
    00014 #define AR_H
    00015
    00016 #include "../stat/libFN.h"
    00017 #include "../stat/libEF.h"
    00018 #include "../user_info.h"
    00019
    00020 namespace bdm {
    00021
    00040 class ARX: public BMEF {
    00041 protected:
    00043         int dimx;
    00046         RV _yrv;
    00048         egiw est;
    00050         ldmat &V;
    00052         double &nu;
    00053 public:
    00056         ARX ( const double frg0=1.0 ) : BMEF ( frg0 ),est (), V ( est._V() ), nu ( est._nu() ) {};
    00057         ARX ( const ARX &A0 ) : BMEF (),est (), V ( est._V() ), nu ( est._nu() ) {
    00058                 set_statistics ( A0.dimx,A0.V,A0.nu );
    00059                 set_parameters(A0.frg);
    00060         };
    00061         ARX* _copy_() const;
    00062         void set_parameters ( double frg0 ) {frg=frg0;}
    00063         void set_statistics ( int dimx0, const ldmat V0, double nu0=-1.0 ) {est.set_parameters ( dimx0,V0,nu0 );last_lognc=est.lognc();dimx=dimx0;}
    00065
    00066 //      //! Set parameters given by moments, \c mu (mean of theta), \c R (mean of R) and \c C (variance of theta)
    00067 //      void set_parameters ( const vec &mu, const mat &R, const mat &C, double dfm){};
    00069         void set_statistics ( const BMEF* BM0 );
    00070 //      //! Returns sufficient statistics
    00071 //      void get_parameters ( mat &V0, double &nu0 ) {V0=est._V().to_mat(); nu0=est._nu();}
    00074
    00076         void bayes ( const vec &dt, const double w );
    00077         void bayes ( const vec &dt ) {bayes ( dt,1.0 );};
    00078         double logpred ( const vec &dt ) const;
    00079         void flatten ( const BMEF* B ) {
    00080                 const ARX* A=dynamic_cast<const ARX*> ( B );
    00081                 // nu should be equal to B.nu
    00082                 est.pow ( A->nu/nu );
    00083                 if ( evalll ) {last_lognc=est.lognc();}
    00084         }
    00086         enorm<ldmat>* epredictor ( const vec &rgr ) const;
    00088         enorm<ldmat>* epredictor() const {
    00089                 it_assert_debug ( dimx==V.rows()-1,"Regressor is not only 1" );
    00090                 return epredictor ( vec_1 ( 1.0 ) );
    00091         }
    00093         mlnorm<ldmat>* predictor() const;
    00094         mlstudent* predictor_student() const;
    00096         ivec structure_est ( egiw Eg0 );
    00098
    00101         const egiw* _e() const {return &est ;};
    00102         const egiw& posterior() const {return est;}
    00104
    00107         void set_drv ( const RV &drv0 ) {drv=drv0;}
    00108         RV& get_yrv() {
    00109                 //if yrv is not ready create it
    00110                 if ( _yrv._dsize() !=dimx ) {
    00111                         int i=0;
    00112                         while ( _yrv._dsize() <dimx ) {_yrv.add ( drv ( vec_1 ( i ) ) );i++;}
    00113                 }
    00114                 //yrv should be ready by now
    00115                 it_assert_debug ( _yrv._dsize() ==dimx,"incompatible drv" );
    00116                 return _yrv;
    00117         }
    00119
    00120         // TODO dokumentace - aktualizovat
    00141         void from_setting( const Setting &root );
    00142
    00143         // TODO dodelat void to_setting( Setting &root ) const;
    00144 };
    00145
    00146 UIREGISTER(ARX);
    00147
    00148 }
    00149
    00150 #endif // AR_H
    00151
    00152