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

# 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 ( A0.est ), V ( est._V() ), nu ( est._nu() ) {};
    00057         ARX* _copy_() const;
    00058         void set_parameters ( double frg0 ) {frg=frg0;}
    00059         void set_statistics ( int dimx0, const ldmat V0, double nu0=-1.0 ) {est.set_parameters ( dimx0,V0,nu0 );last_lognc=est.lognc();dimx=dimx0;}
    00061
    00062 //      //! Set parameters given by moments, \c mu (mean of theta), \c R (mean of R) and \c C (variance of theta)
    00063 //      void set_parameters ( const vec &mu, const mat &R, const mat &C, double dfm){};
    00065         void set_statistics ( const BMEF* BM0 );
    00066 //      //! Returns sufficient statistics
    00067 //      void get_parameters ( mat &V0, double &nu0 ) {V0=est._V().to_mat(); nu0=est._nu();}
    00070
    00072         void bayes ( const vec &dt, const double w );
    00073         void bayes ( const vec &dt ) {bayes ( dt,1.0 );};
    00074         double logpred ( const vec &dt ) const;
    00075         void flatten ( const BMEF* B ) {
    00076                 const ARX* A=dynamic_cast<const ARX*> ( B );
    00077                 // nu should be equal to B.nu
    00078                 est.pow ( A->nu/nu );
    00079                 if ( evalll ) {last_lognc=est.lognc();}
    00080         }
    00082         enorm<ldmat>* epredictor ( const vec &rgr ) const;
    00084         enorm<ldmat>* epredictor() const {it_assert_debug ( est.dimension() ==V.rows()-1,"Regressor is not only 1" );return epredictor ( vec_1 ( 1.0 ) );}
    00086         mlnorm<ldmat>* predictor() const;
    00087         mlstudent* predictor_student() const;
    00089         ivec structure_est ( egiw Eg0 );
    00091
    00094         const egiw* _e() const {return &est ;};
    00095         const egiw& posterior() const {return est;}
    00097
    00100         void set_drv ( const RV &drv0 ) {drv=drv0;}
    00101         RV& get_yrv() {
    00102                 //if yrv is not ready create it
    00103                 if ( _yrv._dsize() !=dimx ) {
    00104                         int i=0;
    00105                         while ( _yrv._dsize() <dimx ) {_yrv.add ( drv ( vec_1(i) ) );i++;}
    00106                 }
    00107                 //yrv should be ready by now
    00108                 it_assert_debug ( _yrv._dsize() ==dimx,"incompatible drv" );
    00109                 return _yrv;
    00110         }
    00112 };
    00113
    00114 }
    00115
    00116 #endif // AR_H
    00117
    00118