- 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 ) {
    00064                 frg = frg0;
    00065         }
    00066         void set_statistics ( int dimx0, const ldmat V0, double nu0 = -1.0 ) {
    00067                 est.set_parameters ( dimx0, V0, nu0 );
    00068                 last_lognc = est.lognc();
    00069                 dimx = dimx0;
    00070         }
    00072
    00073 //      //! Set parameters given by moments, \c mu (mean of theta), \c R (mean of R) and \c C (variance of theta)
    00074 //      void set_parameters ( const vec &mu, const mat &R, const mat &C, double dfm){};
    00076         void set_statistics ( const BMEF* BM0 );
    00077 //      //! Returns sufficient statistics
    00078 //      void get_parameters ( mat &V0, double &nu0 ) {V0=est._V().to_mat(); nu0=est._nu();}
    00081
    00083         void bayes ( const vec &dt, const double w );
    00084         void bayes ( const vec &dt ) {
    00085                 bayes ( dt, 1.0 );
    00086         };
    00087         double logpred ( const vec &dt ) const;
    00088         void flatten ( const BMEF* B ) {
    00089                 const ARX* A = dynamic_cast<const ARX*> ( B );
    00090                 // nu should be equal to B.nu
    00091                 est.pow ( A->nu / nu );
    00092                 if ( evalll ) {
    00093                         last_lognc = est.lognc();
    00094                 }
    00095         }
    00097         enorm<ldmat>* epredictor ( const vec &rgr ) const;
    00099         enorm<ldmat>* epredictor() const {
    00100                 it_assert_debug ( dimx == V.rows() - 1, "Regressor is not only 1" );
    00101                 return epredictor ( vec_1 ( 1.0 ) );
    00102         }
    00104         mlnorm<ldmat>* predictor() const;
    00105         mlstudent* predictor_student() const;
    00107         ivec structure_est ( egiw Eg0 );
    00109
    00112         const egiw& posterior() const {
    00113                 return est;
    00114         }
    00116
    00119         void set_drv ( const RV &drv0 ) {
    00120                 drv = drv0;
    00121         }
    00122         RV& get_yrv() {
    00123                 //if yrv is not ready create it
    00124                 if ( _yrv._dsize() != dimx ) {
    00125                         int i = 0;
    00126                         while ( _yrv._dsize() < dimx ) {
    00127                                 _yrv.add ( drv ( vec_1 ( i ) ) );
    00128                                 i++;
    00129                         }
    00130                 }
    00131                 //yrv should be ready by now
    00132                 it_assert_debug ( _yrv._dsize() == dimx, "incompatible drv" );
    00133                 return _yrv;
    00134         }
    00136
    00137         // TODO dokumentace - aktualizovat
    00158         void from_setting ( const Setting &set );
    00159
    00160 };
    00161
    00162 UIREGISTER ( ARX );
    00163 SHAREDPTR ( ARX );
    00164
    00165 }
    00166
    00167 #endif // AR_H
    00168
    00169