- 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 //#include "../estim/kalman.h"
    00020 #include "arx_straux.h"
    00021
    00022 namespace bdm {
    00023
    00043 class ARX: public BMEF {
    00044 protected:
    00046         int dimx;
    00049         RV _yrv;
    00051         egiw est;
    00053         ldmat &V;
    00055         double &nu;
    00056 public:
    00059         ARX ( const double frg0 = 1.0 ) : BMEF ( frg0 ), est (), V ( est._V() ), nu ( est._nu() ) {};
    00060         ARX ( const ARX &A0 ) : BMEF (), est (), V ( est._V() ), nu ( est._nu() ) {
    00061                 set_statistics ( A0.dimx, A0.V, A0.nu );
    00062                 set_parameters ( A0.frg );
    00063         };
    00064         ARX* _copy_() const;
    00065         void set_parameters ( double frg0 ) {
    00066                 frg = frg0;
    00067         }
    00068         void set_statistics ( int dimx0, const ldmat V0, double nu0 = -1.0 ) {
    00069                 est.set_parameters ( dimx0, V0, nu0 );
    00070                 last_lognc = est.lognc();
    00071                 dimx = dimx0;
    00072         }
    00074
    00075 //      //! Set parameters given by moments, \c mu (mean of theta), \c R (mean of R) and \c C (variance of theta)
    00076 //      void set_parameters ( const vec &mu, const mat &R, const mat &C, double dfm){};
    00078         void set_statistics ( const BMEF* BM0 );
    00079 //      //! Returns sufficient statistics
    00080 //      void get_parameters ( mat &V0, double &nu0 ) {V0=est._V().to_mat(); nu0=est._nu();}
    00083
    00085         void bayes ( const vec &dt, const double w );
    00086         void bayes ( const vec &dt ) {
    00087                 bayes ( dt, 1.0 );
    00088         };
    00089         double logpred ( const vec &dt ) const;
    00090         void flatten ( const BMEF* B ) {
    00091                 const ARX* A = dynamic_cast<const ARX*> ( B );
    00092                 // nu should be equal to B.nu
    00093                 est.pow ( A->nu / nu );
    00094                 if ( evalll ) {
    00095                         last_lognc = est.lognc();
    00096                 }
    00097         }
    00099         enorm<ldmat>* epredictor ( const vec &rgr ) const;
    00101         enorm<ldmat>* epredictor() const {
    00102                 bdm_assert_debug ( dimx == V.rows() - 1, "Regressor is not only 1" );
    00103                 return epredictor ( vec_1 ( 1.0 ) );
    00104         }
    00106         mlnorm<ldmat>* predictor() const;
    00107         mlstudent* predictor_student() const;
    00109         ivec structure_est ( egiw Eg0 );
    00111         ivec structure_est_LT ( egiw Eg0 );
    00113
    00116         const egiw& posterior() const {
    00117                 return est;
    00118         }
    00120
    00123         void set_drv ( const RV &drv0 ) {
    00124                 drv = drv0;
    00125         }
    00126
    00127         RV& get_yrv() {
    00128                 //if yrv is not ready create it
    00129                 if ( _yrv._dsize() != dimx ) {
    00130                         int i = 0;
    00131                         while ( _yrv._dsize() < dimx ) {
    00132                                 _yrv.add ( drv ( vec_1 ( i ) ) );
    00133                                 i++;
    00134                         }
    00135                 }
    00136                 //yrv should be ready by now
    00137                 bdm_assert_debug ( _yrv._dsize() == dimx, "incompatible drv" );
    00138                 return _yrv;
    00139         }
    00141
    00142         // TODO dokumentace - aktualizovat
    00163         void from_setting ( const Setting &set );
    00164
    00165 };
    00166
    00167 UIREGISTER ( ARX );
    00168 SHAREDPTR ( ARX );
    00169
    00170 }
    00171
    00172 #endif // AR_H
    00173
    00174