Changeset 1003
- Timestamp:
- 05/27/10 13:08:38 (14 years ago)
- Location:
- library/bdm
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/estim/arx.cpp
r996 r1003 92 92 } 93 93 94 enorm<ldmat>* ARX::epredictor ( const vec &rgr ) const { 94 enorm<ldmat>* ARX::epredictor ( const vec &cond ) const { 95 bdm_assert_debug ( cond.length() == rgrlen , "ARX::epredictor cond is of size "+num2str(cond.length())+" expected dimension is "+num2str(rgrlen) ); 96 95 97 mat mu ( dimy, posterior()._V().rows() - dimy ); 96 98 mat R ( dimy, dimy ); 97 99 100 vec ext_rgr; 101 if (have_constant){ 102 ext_rgr = concat(cond,vec_1(1.0)); 103 } else { 104 ext_rgr = cond; 105 } 106 98 107 enorm<ldmat>* tmp; 99 108 tmp = new enorm<ldmat> ( ); … … 106 115 //R*=nu/(nu-2); 107 116 if (mu.cols()>0) {// nonempty egiw 108 mat p_mu = mu.T() * rgr; //the result is one column117 mat p_mu = mu.T() * ext_rgr; //the result is one column 109 118 tmp->set_parameters ( p_mu.get_col ( 0 ), ldmat ( R ) ); 110 119 } else { … … 114 123 tmp->set_rv(yrv); 115 124 return tmp; 116 }117 118 enorm<ldmat>* ARX::epredictor() const {119 bdm_assert_debug ( dimy == posterior()._V().rows() - 1, "Regressor is not only 1" );120 return epredictor ( vec_1 ( 1.0 ) );121 125 } 122 126 … … 208 212 } 209 213 210 ivec ARX::structure_est ( egiwest0 ) {214 ivec ARX::structure_est ( const egiw &est0 ) { 211 215 ivec ind = linspace ( 1, est.dimension() - 1 ); 212 216 egiw_bestbelow ( est, est0, est.lognc() - est0.lognc(), ind ); … … 216 220 217 221 218 ivec ARX::structure_est_LT ( egiwest0 ) {222 ivec ARX::structure_est_LT ( const egiw &est0 ) { 219 223 //some stuff with beliefs etc. 220 224 ivec belief = vec_1 ( 2 ); // default belief … … 251 255 //init 252 256 shared_ptr<egiw> pri = UI::build<egiw> ( set, "prior", UI::optional ); 253 if (pri) 257 if (pri){ 254 258 set_prior(pri.get()); 259 } else { 260 shared_ptr<egiw> post = UI::build<egiw> ( set, "posterior", UI::optional ); 261 set_prior(post.get()); 262 } 263 255 264 256 265 shared_ptr<egiw> alt = UI::build<egiw> ( set, "alternative", UI::optional ); -
library/bdm/estim/arx.h
r996 r1003 92 92 //! Conditioned version of the predictor 93 93 enorm<ldmat>* epredictor ( const vec &rgr ) const; 94 //! Predictor for empty regressor95 enorm<ldmat>* epredictor() const;96 94 //! conditional version of the predictor 97 95 template<class sq_T> … … 102 100 mlstudent* predictor_student() const; 103 101 //! Brute force structure estimation.\return indices of accepted regressors. 104 ivec structure_est ( egiwEg0 );102 ivec structure_est ( const egiw &Eg0 ); 105 103 //! Smarter structure estimation by Ludvik Tesar.\return indices of accepted regressors. 106 ivec structure_est_LT ( egiwEg0 );104 ivec structure_est_LT ( const egiw &Eg0 ); 107 105 //! reduce to 108 106 void reduce_structure(ivec &inds_in_V){ … … 150 148 // When statistics is defined, it has priority 151 149 if(posterior()._dimx()>0) {//statistics is assigned 152 dimy = posterior()._dimx() >0;150 dimy = posterior()._dimx(); 153 151 rgrlen=posterior()._V().rows() - dimy - int ( have_constant == true ); 154 152 dimc = rgrlen; -
library/bdm/stat/exp_family.h
r996 r1003 639 639 UI::save( &est, set, "prior" ); 640 640 } 641 void from_setting (const Setting &set ) { 642 BMEF::from_setting ( set ); 643 UI::get( est, set, "prior" ); 644 } 641 645 }; 642 646 UIREGISTER( multiBM );