Changeset 200

Show
Ignore:
Timestamp:
11/10/08 15:40:24 (15 years ago)
Author:
smidl
Message:

BM has now function _e() returning posterior of correct type

Location:
bdm
Files:
16 added
6 modified

Legend:

Unmodified
Added
Removed
  • bdm/estim/arx.h

    r198 r200  
    7979        //! Brute force structure estimation.\return indeces of accepted regressors. 
    8080        ivec structure_est ( egiw Eg0 ); 
     81        const egiw* _e() const {return &est ;}; 
    8182}; 
    8283 
  • bdm/estim/libKF.h

    r170 r200  
    122122        //!access function 
    123123        const epdf& _epdf() const {return est;} 
     124        const enorm<sq_T>* _e() const {return &est;} 
    124125        //!access function 
    125126        mat& __K() {return _K;} 
     
    187188        //!dummy! 
    188189        const epdf& _epdf()const{return E;}; 
     190        const enorm<fsqmat>* _e()const{return &E;}; 
    189191}; 
    190192 
  • bdm/estim/libPF.h

    r170 r200  
    122122        void bayes ( const vec &dt ); 
    123123        const epdf& _epdf() const {return jest;} 
     124        const epdf* _e() const {return &jest;} //Fixme: is it useful? 
    124125        //! Set postrior of \c rvc to samples from epdf0. Statistics of Bms are not re-computed! Use only for initialization! 
    125126        void set_est ( const epdf& epdf0 ) { 
  • bdm/estim/mixef.h

    r198 r200  
    105105        double logpred ( const vec &dt ) const; 
    106106        const epdf& _epdf() const {return *est;} 
     107        const eprod* _e() const {return est;} 
    107108        emix* predictor(const RV &rv) const; 
    108109        //! Flatten the density as if it was not estimated from the data 
  • bdm/stat/libBM.h

    r198 r200  
    416416        //! Batch Bayes rule (columns of Dt are observations) 
    417417        virtual void bayesB ( const mat &Dt ); 
     418        //! Returns a reference to the epdf representing posterior density on parameters.  
     419        virtual const epdf& _epdf() const =0; 
     420 
    418421        //! Returns a pointer to the epdf representing posterior density on parameters. Use with care! 
    419         virtual const epdf& _epdf() const =0; 
     422        virtual const epdf* _e() const =0; 
    420423 
    421424        //! Evaluates predictive log-likelihood of the given data record 
  • bdm/stat/libEF.h

    r198 r200  
    167167        int nPsi; 
    168168public: 
    169         //!Default constructor, assuming 
    170         egiw ( RV rv, mat V0, double nu0 ) : eEF ( rv ), V ( V0 ), nu ( nu0 ) { 
     169        //!Default constructor, if nu0<0 a minimal nu0 will be computed 
     170        egiw ( RV rv, mat V0, double nu0=-1.0 ) : eEF ( rv ), V ( V0 ), nu ( nu0 ) { 
    171171                xdim = rv.count() /V.rows(); 
    172172                it_assert_debug ( rv.count() ==xdim*V.rows(),"Incompatible V0." ); 
    173173                nPsi = V.rows()-xdim; 
     174                //set mu to have proper normalization and  
     175                if (nu0<0){ 
     176                        nu = 0.1 +nPsi +2*xdim +2; // +2 assures finite expected value of R 
     177                        // terms before that are sufficient for finite normalization 
     178                } 
    174179        } 
    175180        //!Full constructor for V in ldmat form 
    176         egiw ( RV rv, ldmat V0, double nu0 ) : eEF ( rv ), V ( V0 ), nu ( nu0 ) { 
     181        egiw ( RV rv, ldmat V0, double nu0=-1.0 ) : eEF ( rv ), V ( V0 ), nu ( nu0 ) { 
    177182                xdim = rv.count() /V.rows(); 
    178183                it_assert_debug ( rv.count() ==xdim*V.rows(),"Incompatible V0." ); 
    179184                nPsi = V.rows()-xdim; 
     185                if (nu0<0){ 
     186                        nu = 0.1 +nPsi +2*xdim +2; // +2 assures finite expected value of R 
     187                        // terms before that are sufficient for finite normalization 
     188                } 
    180189        } 
    181190 
     
    275284        } 
    276285        const epdf& _epdf() const {return est;}; 
     286        const eDirich* _e() const {return &est;}; 
    277287        void set_parameters ( const vec &beta0 ) { 
    278288                est.set_parameters ( beta0 );