Show
Ignore:
Timestamp:
09/18/09 00:17:05 (15 years ago)
Author:
smidl
Message:

ARX re-designed

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/estim/arx.h

    r585 r625  
    4848        //! Do NOT access directly, only via \c get_yrv(). 
    4949        RV _yrv; 
     50        //! rv of regressor 
     51        RV rgrrv; 
    5052        //! Posterior estimate of \f$\theta,r\f$ in the form of Normal-inverse Wishart density 
    5153        egiw est; 
     
    5456        //! cached value of est.nu 
    5557        double ν 
     58        //! switch if constant is modelled or not 
     59        bool have_constant; 
     60        //! cached value of data vector for have_constant =true 
     61        vec _dt; 
    5662public: 
    5763        //! \name Constructors 
     
    7379        //!@} 
    7480 
    75 //      //! Set parameters given by moments, \c mu (mean of theta), \c R (mean of R) and \c C (variance of theta) 
    76 //      void set_parameters ( const vec &mu, const mat &R, const mat &C, double dfm){}; 
    7781        //! Set sufficient statistics 
    7882        void set_statistics ( const BMEF* BM0 ); 
    79 //      //! Returns sufficient statistics 
    80 //      void get_parameters ( mat &V0, double &nu0 ) {V0=est._V().to_mat(); nu0=est._nu();} 
     83 
    8184        //!\name Mathematical operations 
    8285        //!@{ 
     
    121124        //!\name Connection 
    122125        //!@{ 
    123         void set_drv ( const RV &drv0 ) { 
    124                 drv = drv0; 
     126        void set_rv ( const RV &yrv0 , const RV &rgrrv0 ) { 
     127                _yrv = yrv0; 
     128                rgrrv=rgrrv0; 
     129                set_drv(concat(yrv0, rgrrv)); 
    125130        } 
    126131 
     
    140145        //!@} 
    141146 
    142         // TODO dokumentace - aktualizovat 
    143147        /*! UI for ARX estimator 
    144148 
    145         The ARX is constructed from a structure with fields: 
    146149        \code 
    147         estimator = { 
    148                 class = "ARX"; 
    149                 y = {type="rv", ...}   // description of output variables 
    150                 rgr = {type="rv", ...} // description of regressor variables 
    151                 constant = true;       // boolean switch if the constant term is modelled or not 
     150        class = 'ARX'; 
     151        rv    = RV({names_of_dt} )                 // description of output variables 
     152        rgr   = RV({names_of_regressors}, [-1,-2]} // description of regressor variables 
     153        constant = true;                           // boolean switch if the constant term is modelled or not 
    152154 
    153                 //optional fields 
    154                 dV0 = [1e-3, 1e-5, 1e-5, 1e-5]; 
    155                                                            // default: 1e-3 for y, 1e-5 for rgr 
    156                 nu0 = 6;               // default: rgrlen + 2 
    157                 frg = 1.0;             // forgetting, default frg=1.0 
    158         }; 
     155        --- optional --- 
     156        V0  = [1 0;0 1];                           // Initial value of information matrix V 
     157          --- OR --- 
     158        dV0 = [1e-3, 1e-5, 1e-5, 1e-5];            // Initial value of diagonal of information matrix V 
     159                                                                                           // default: 1e-3 for rv, 1e-5 for rgr 
     160        nu0 = 6;                                                   // initial value of nu, default: rgrlen + 2 
     161        frg = 1.0;                                 // forgetting, default frg=1.0 
     162 
     163        rv_param   = RV({names_of_parameters}}     // description of parametetr names  
     164                                                                                           // default: ["theta_i" and "r_i"] 
    159165        \endcode 
    160  
    161         The estimator will assign names of the posterior in the form ["theta_i" and "r_i"] 
    162166        */ 
    163167        void from_setting ( const Setting &set ); 
    164168 
     169        void validate() { 
     170                bdm_assert(dimx == _yrv._dsize(), "RVs of parameters and regressor do not match"); 
     171                 
     172        } 
    165173}; 
    166174