Changeset 996 for library/bdm/estim
- Timestamp:
- 05/26/10 23:33:28 (14 years ago)
- Location:
- library/bdm/estim
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/estim/arx.cpp
r990 r996 3 3 4 4 void ARX::bayes_weighted ( const vec &yt, const vec &cond, const double w ) { 5 6 5 bdm_assert_debug ( yt.length() == dimy, "ARX::bayes yt is of size "+num2str(yt.length())+" expected dimension is "+num2str(dimy) ); 7 6 bdm_assert_debug ( cond.length() == rgrlen , "ARX::bayes cond is of size "+num2str(cond.length())+" expected dimension is "+num2str(rgrlen) ); 7 8 BMEF::bayes_weighted(yt,cond,w); //potential discount scheduling 9 8 10 double lnc; 9 11 //cache … … 216 218 ivec ARX::structure_est_LT ( egiw est0 ) { 217 219 //some stuff with beliefs etc. 218 // ivec ind = bdm::straux1(V,nu, est0._V(), est0._nu()); 219 return ivec();//ind; 220 ivec belief = vec_1 ( 2 ); // default belief 221 int nbest = 1; // nbest: how many regressors are returned 222 int nrep = 5; // nrep: number of random repetions of structure estimation 223 double lambda = 0.9; 224 int k = 2; 225 226 Array<str_aux> o2; 227 228 ivec ind = bdm::straux1(est._V(),est._nu(), est0._V(), est0._nu(), belief, nbest, nrep, lambda, k, o2); 229 230 return ind; 220 231 } 221 232 -
library/bdm/estim/arx.h
r990 r996 105 105 //! Smarter structure estimation by Ludvik Tesar.\return indices of accepted regressors. 106 106 ivec structure_est_LT ( egiw Eg0 ); 107 //! reduce to 108 void reduce_structure(ivec &inds_in_V){ 109 ldmat V = posterior()._V(); 110 if (max(inds_in_V)>=V.rows()) {bdm_error("Incompatible structure");} 111 112 ldmat newV(V,inds_in_V); 113 est.set_parameters(dimy,newV, posterior()._nu()); 114 validate(); 115 } 107 116 //!@} 108 117 … … 138 147 BMEF::validate(); 139 148 est.validate(); 140 //if dimc not set set it from V 141 if(dimy>0) {//statistics is assigned 142 if (posterior()._V().rows()>dimy) {//statistics is assigned 143 rgrlen=posterior()._V().rows() - dimy - int ( have_constant == true ); 144 } 145 } else{ 146 bdm_error("No posterior or yrv assigned matrix assigned"); 147 } 148 dimc =rgrlen; 149 150 if(est._dimx()==0) { // no prior 149 150 // When statistics is defined, it has priority 151 if(posterior()._dimx()>0) {//statistics is assigned 152 dimy = posterior()._dimx()>0; 153 rgrlen=posterior()._V().rows() - dimy - int ( have_constant == true ); 154 dimc = rgrlen; 155 } else{ // statistics is not assigned - build it from dimy and rgrlen 156 bdm_assert(dimy>0,"No way to validate egiw: empty statistics and empty dimy"); 151 157 est.set_parameters(dimy, zeros(dimy+rgrlen+int(have_constant==true))); 152 158 set_prior_default(est); … … 213 219 214 220 221 215 222 //////////////////// 216 223 template<class sq_T> -
library/bdm/estim/arx_straux.h
r737 r996 48 48 49 49 50 //! R plication of Ludvik Tesar original straux1 from mixtools straux150 //! Replication of Ludvik Tesar original straux1 from mixtools straux1 51 51 ivec straux1 ( ldmat Ld, double nu, ldmat Ld0, double nu0, ivec belief, int nbest, int max_nrep, double lambda, int order_k, Array<str_aux> &rgrsout ); 52 52