- Timestamp:
- 05/25/10 20:54:43 (15 years ago)
- Location:
- library/bdm/stat
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/stat/exp_family.cpp
r970 r977 239 239 // cut out rest of lower-right part of V 240 240 // invert it 241 ldmat itmp ( l );241 ldmat itmp; 242 242 if (dimx<l){ 243 243 const ldmat tmp ( V, linspace ( dimx, l - 1 ) ); 244 244 tmp.inv ( itmp ); 245 } 245 } 246 246 // following Wikipedia notation 247 247 // m=nu-nPsi-dimx-1, p=dimx 248 248 double mp1p = nu - nPsi - 2 * dimx; // m-p+1 249 249 double mp1m = mp1p - 2; // m-p-1 250 250 251 251 if ( dimx == 1 ) { 252 252 double cove = V._D() ( 0 ) / mp1m ; 253 253 254 254 vec var ( l ); 255 255 var.set_subvector ( 0, diag ( itmp.to_mat() ) *cove ); … … 260 260 mat Y = Vll.to_mat(); 261 261 mat varY ( Y.rows(), Y.cols() ); 262 262 263 263 double denom = ( mp1p - 1 ) * mp1m * mp1m * ( mp1m - 2 ); // (m-p)(m-p-1)^2(m-p-3) 264 264 265 265 int i, j; 266 266 for ( i = 0; i < Y.rows(); i++ ) { … … 276 276 var_Th.set_subvector ( i*var_th.length(), var_th*mean_dR ( i ) ); 277 277 } 278 278 279 279 return concat ( var_Th, cvectorize ( varY ) ); 280 280 } -
library/bdm/stat/exp_family.h
r970 r977 370 370 vec mean() const; 371 371 vec variance() const; 372 //mat covariance() const; 372 373 void sample_mat ( mat &Mi, chmat &Ri ) const; 373 374 … … 585 586 UIREGISTER ( mDirich ); 586 587 588 587 589 //! \brief Estimator for Multinomial density 588 590 class multiBM : public BMEF {