Show
Ignore:
Timestamp:
05/21/10 00:44:04 (14 years ago)
Author:
smidl
Message:

Corrections in ARX and PF

Files:
1 modified

Legend:

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

    r896 r964  
    4747        //! vector of dyadic update 
    4848        vec dyad; 
     49        //! length of the regressor 
     50        int rgrlen; 
    4951        //! posterior density 
    5052        egiw est; 
     
    5456        //! \name Constructors 
    5557        //!@{ 
    56         ARX ( const double frg0 = 1.0 ) : BMEF ( frg0 ),  have_constant ( true ), dyad(), est(), alter_est() {}; 
    57         ARX ( const ARX &A0 ) : BMEF ( A0 ),  have_constant ( A0.have_constant ), dyad ( A0.dyad ), est ( A0.est ), alter_est ( A0.alter_est ) { }; 
     58        ARX ( const double frg0 = 1.0 ) : BMEF ( frg0 ),  have_constant ( true ), dyad(), rgrlen(),est(), alter_est() {}; 
     59        ARX ( const ARX &A0 ) : BMEF ( A0 ),  have_constant ( A0.have_constant ), dyad ( A0.dyad ),rgrlen(A0.rgrlen), est ( A0.est ), alter_est ( A0.alter_est ) { }; 
    5860 
    5961        ARX* _copy() const; 
     
    115117        \code 
    116118        class = 'ARX'; 
    117         rv    = RV({names_of_dt} )                 // description of output variables 
     119        yrv   = RV({names_of_dt} )                 // description of output variables 
    118120        rgr   = RV({names_of_regressors}, [-1,-2]} // description of regressor variables 
    119121        constant = 1;                              // 0/1 switch if the constant term is modelled or not 
     
    125127        frg = 1.0;                                 // forgetting, default frg=1.0 
    126128 
    127         rv_param   = RV({names_of_parameters}}     // description of parametetr names 
    128                                                                                            // default: ["theta_i" and "r_i"] 
     129        rv  = RV({names_of_parameters}}            // description of parametetr names 
     130                                                                                           // default: [""] 
    129131        \endcode 
    130132        */ 
     
    133135        void validate() { 
    134136                BMEF::validate();        
    135  
     137                est.validate(); 
    136138                //if dimc not set set it from V 
    137139                if ( dimc == 0 ) { 
     
    192194 
    193195        void bayes ( const vec &val, const vec &cond ) { 
    194                 frg = cond ( dimc - 1 ); //  last in cond is phi 
    195                 ARX::bayes ( val, cond ); 
     196                int arx_cond_size=rgrlen -int(have_constant==true); 
     197                bdm_assert_debug(cond.size()>arx_cond_size, "ARXfrg: Insufficient conditioning, frg not given."); 
     198                frg = cond ( arx_cond_size ); // the first part after rgrlen 
     199                ARX::bayes ( val, cond.left(arx_cond_size) ); 
    196200        } 
    197201        void validate() {