Changeset 330

Show
Ignore:
Timestamp:
04/28/09 16:39:40 (15 years ago)
Author:
dedecius
Message:

Added methods egiw::est_theta() for LS estimate of theta and egiw::est_theta_cov() for covariance of the LS estimate.

Location:
bdm/stat
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • bdm/stat/libEF.cpp

    r283 r330  
    6363} 
    6464 
     65vec egiw::est_theta() const { 
     66        if ( dimx==1 ) { 
     67                const mat &L = V._L(); 
     68                int end = L.rows() - 1; 
     69 
     70                mat iLsub = ltuinv ( L ( dimx,end,dimx,end ) ); 
     71 
     72                vec L0 = L.get_col(0); 
     73 
     74                return iLsub * L0(1,end); 
     75        } 
     76        else { 
     77                it_error("ERROR: est_theta() not implemented for dimx>1"); 
     78                return 0; 
     79        } 
     80} 
     81 
     82ldmat egiw::est_theta_cov() const { 
     83        if ( dimx == 1 ) { 
     84                const mat &L = V._L(); 
     85                const vec &D = V._D(); 
     86                int end = D.length() - 1; 
     87 
     88                mat Lsub = L ( 1, end, 1, end); 
     89                mat Dsub = diag(D(1, end)); 
     90 
     91                return inv( transpose(Lsub) * Dsub * Lsub ); 
     92 
     93        } 
     94        else { 
     95                it_error("ERROR: est_theta_cov() not implemented for dimx>1"); 
     96                return 0; 
     97        } 
     98 
     99} 
     100 
    65101vec egiw::mean() const { 
    66102 
    67103        if ( dimx==1 ) { 
    68                 const mat &L= V._L(); 
    69104                const vec &D= V._D(); 
    70                 int end = L.rows()-1; 
     105                int end = D.length()-1; 
    71106 
    72107                vec m ( dim ); 
    73                 mat iLsub = ltuinv ( L ( dimx,end,dimx,end ) ); 
    74  
    75                 vec L0 = L.get_col ( 0 ); 
    76  
    77                 m.set_subvector ( 0,iLsub*L0 ( 1,end ) ); 
     108                m.set_subvector ( 0, est_theta() ); 
    78109                m ( end ) = D ( 0 ) / ( nu -nPsi -2*dimx -2 ); 
    79110                return m; 
     
    102133                return var; 
    103134        } 
    104         else {it_error("not implemneted"); return vec(0);} 
     135        else {it_error("not implemented"); return vec(0);} 
    105136} 
    106137 
  • bdm/stat/libEF.h

    r310 r330  
    201201                        vec mean() const; 
    202202                        vec variance() const; 
     203 
     204                        //! LS estimate of \f$\theta\f$ 
     205                        vec est_theta() const; 
     206 
     207                        //! Covariance of the LS estimate 
     208                        ldmat est_theta_cov() const; 
     209 
    203210                        void mean_mat ( mat &M, mat&R ) const; 
    204211                        //! In this instance, val= [theta, r]. For multivariate instances, it is stored columnwise val = [theta_1 theta_2 ... r_1 r_2 ]