- Main Page
- Related Pages
- 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 "../math/functions.h"
    00017 #include "../stat/exp_family.h"
    00018 #include "../base/user_info.h"
    00019
    00020 namespace bdm {
    00021
    00041 class ARX: public BMEF {
    00042 protected:
    00044         int dimx;
    00047         RV _yrv;
    00049         egiw est;
    00051         ldmat &V;
    00053         double &nu;
    00054 public:
    00057         ARX ( const double frg0=1.0 ) : BMEF ( frg0 ),est (), V ( est._V() ), nu ( est._nu() ) {};
    00058         ARX ( const ARX &A0 ) : BMEF (),est (), V ( est._V() ), nu ( est._nu() ) {
    00059                 set_statistics ( A0.dimx,A0.V,A0.nu );
    00060                 set_parameters(A0.frg);
    00061         };
    00062         ARX* _copy_() const;
    00063         void set_parameters ( double frg0 ) {frg=frg0;}
    00064         void set_statistics ( int dimx0, const ldmat V0, double nu0=-1.0 ) {est.set_parameters ( dimx0,V0,nu0 );last_lognc=est.lognc();dimx=dimx0;}
    00066
    00067 //      //! Set parameters given by moments, \c mu (mean of theta), \c R (mean of R) and \c C (variance of theta)
    00068 //      void set_parameters ( const vec &mu, const mat &R, const mat &C, double dfm){};
    00070         void set_statistics ( const BMEF* BM0 );
    00071 //      //! Returns sufficient statistics
    00072 //      void get_parameters ( mat &V0, double &nu0 ) {V0=est._V().to_mat(); nu0=est._nu();}
    00075
    00077         void bayes ( const vec &dt, const double w );
    00078         void bayes ( const vec &dt ) {bayes ( dt,1.0 );};
    00079         double logpred ( const vec &dt ) const;
    00080         void flatten ( const BMEF* B ) {
    00081                 const ARX* A=dynamic_cast<const ARX*> ( B );
    00082                 // nu should be equal to B.nu
    00083                 est.pow ( A->nu/nu );
    00084                 if ( evalll ) {last_lognc=est.lognc();}
    00085         }
    00087         enorm<ldmat>* epredictor ( const vec &rgr ) const;
    00089         enorm<ldmat>* epredictor() const {
    00090                 it_assert_debug ( dimx==V.rows()-1,"Regressor is not only 1" );
    00091                 return epredictor ( vec_1 ( 1.0 ) );
    00092         }
    00094         mlnorm<ldmat>* predictor() const;
    00095         mlstudent* predictor_student() const;
    00097         ivec structure_est ( egiw Eg0 );
    00099
    00102         const egiw* _e() const {return &est ;};
    00103         const egiw& posterior() const {return est;}
    00105
    00108         void set_drv ( const RV &drv0 ) {drv=drv0;}
    00109         RV& get_yrv() {
    00110                 //if yrv is not ready create it
    00111                 if ( _yrv._dsize() !=dimx ) {
    00112                         int i=0;
    00113                         while ( _yrv._dsize() <dimx ) {_yrv.add ( drv ( vec_1 ( i ) ) );i++;}
    00114                 }
    00115                 //yrv should be ready by now
    00116                 it_assert_debug ( _yrv._dsize() ==dimx,"incompatible drv" );
    00117                 return _yrv;
    00118         }
    00120
    00121         // TODO dokumentace - aktualizovat
    00142         void from_setting( const Setting &set );
    00143
    00144 };
    00145
    00146 UIREGISTER(ARX);
    00147
    00148 }
    00149
    00150 #endif // AR_H
    00151
    00152