Changeset 996 for library/bdm/estim

Show
Ignore:
Timestamp:
05/26/10 23:33:28 (14 years ago)
Author:
smidl
Message:

Scheduling of forgetting factor

Location:
library/bdm/estim
Files:
3 modified

Legend:

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

    r990 r996  
    33 
    44void ARX::bayes_weighted ( const vec &yt, const vec &cond, const double w ) { 
    5  
    65        bdm_assert_debug ( yt.length() == dimy, "ARX::bayes yt is of size "+num2str(yt.length())+" expected dimension is "+num2str(dimy) ); 
    76        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         
    810        double lnc; 
    911        //cache 
     
    216218ivec ARX::structure_est_LT ( egiw est0 ) { 
    217219        //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; 
    220231} 
    221232 
  • library/bdm/estim/arx.h

    r990 r996  
    105105        //! Smarter structure estimation by Ludvik Tesar.\return indices of accepted regressors. 
    106106        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        } 
    107116        //!@} 
    108117 
     
    138147                BMEF::validate();        
    139148                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"); 
    151157                        est.set_parameters(dimy, zeros(dimy+rgrlen+int(have_constant==true))); 
    152158                        set_prior_default(est); 
     
    213219 
    214220 
     221 
    215222//////////////////// 
    216223template<class sq_T> 
  • library/bdm/estim/arx_straux.h

    r737 r996  
    4848 
    4949 
    50 //! Rplication of Ludvik Tesar original straux1 from mixtools straux1 
     50//! Replication of Ludvik Tesar original straux1 from mixtools straux1 
    5151ivec 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 ); 
    5252