- 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
    00019 namespace bdm {
    00020
    00039 class ARX: public BMEF {
    00040 protected:
    00042         int dimx;
    00045         RV _yrv;
    00047         egiw est;
    00049         ldmat &V;
    00051         double &nu;
    00052 public:
    00055         ARX ( const double frg0=1.0 ) : BMEF ( frg0 ),est (), V ( est._V() ), nu ( est._nu() ) {};
    00056         ARX ( const ARX &A0 ) : BMEF (),est (), V ( est._V() ), nu ( est._nu() ) {
    00057                 set_statistics ( A0.dimx,A0.V,A0.nu );
    00058                 set_parameters(A0.frg);
    00059         };
    00060         ARX* _copy_() const;
    00061         void set_parameters ( double frg0 ) {frg=frg0;}
    00062         void set_statistics ( int dimx0, const ldmat V0, double nu0=-1.0 ) {est.set_parameters ( dimx0,V0,nu0 );last_lognc=est.lognc();dimx=dimx0;}
    00064
    00065 //      //! Set parameters given by moments, \c mu (mean of theta), \c R (mean of R) and \c C (variance of theta)
    00066 //      void set_parameters ( const vec &mu, const mat &R, const mat &C, double dfm){};
    00068         void set_statistics ( const BMEF* BM0 );
    00069 //      //! Returns sufficient statistics
    00070 //      void get_parameters ( mat &V0, double &nu0 ) {V0=est._V().to_mat(); nu0=est._nu();}
    00073
    00075         void bayes ( const vec &dt, const double w );
    00076         void bayes ( const vec &dt ) {bayes ( dt,1.0 );};
    00077         double logpred ( const vec &dt ) const;
    00078         void flatten ( const BMEF* B ) {
    00079                 const ARX* A=dynamic_cast<const ARX*> ( B );
    00080                 // nu should be equal to B.nu
    00081                 est.pow ( A->nu/nu );
    00082                 if ( evalll ) {last_lognc=est.lognc();}
    00083         }
    00085         enorm<ldmat>* epredictor ( const vec &rgr ) const;
    00087         enorm<ldmat>* epredictor() const {
    00088                 it_assert_debug ( dimx==V.rows()-1,"Regressor is not only 1" );
    00089                 return epredictor ( vec_1 ( 1.0 ) );
    00090         }
    00092         mlnorm<ldmat>* predictor() const;
    00093         mlstudent* predictor_student() const;
    00095         ivec structure_est ( egiw Eg0 );
    00097
    00100         const egiw* _e() const {return &est ;};
    00101         const egiw& posterior() const {return est;}
    00103
    00106         void set_drv ( const RV &drv0 ) {drv=drv0;}
    00107         RV& get_yrv() {
    00108                 //if yrv is not ready create it
    00109                 if ( _yrv._dsize() !=dimx ) {
    00110                         int i=0;
    00111                         while ( _yrv._dsize() <dimx ) {_yrv.add ( drv ( vec_1 ( i ) ) );i++;}
    00112                 }
    00113                 //yrv should be ready by now
    00114                 it_assert_debug ( _yrv._dsize() ==dimx,"incompatible drv" );
    00115                 return _yrv;
    00116         }
    00118 };
    00119
    00120 }
    00121
    00122 #endif // AR_H
    00123
    00124