[97] | 1 | #include "arx.h" |
---|
[270] | 2 | namespace bdm { |
---|
[13] | 3 | |
---|
[700] | 4 | void ARX::bayes_weighted ( const vec &yt, const vec &cond, const double w ) { |
---|
[1009] | 5 | bdm_assert_debug ( yt.length() == dimy, "BM::bayes yt is of size "+num2str(yt.length())+" expected dimension is "+num2str(dimy) ); |
---|
| 6 | bdm_assert_debug ( cond.length() == rgrlen , "BM::bayes cond is of size "+num2str(cond.length())+" expected dimension is "+num2str(rgrlen) ); |
---|
[996] | 7 | |
---|
| 8 | BMEF::bayes_weighted(yt,cond,w); //potential discount scheduling |
---|
| 9 | |
---|
[97] | 10 | double lnc; |
---|
[679] | 11 | //cache |
---|
[737] | 12 | ldmat &V = est._V(); |
---|
| 13 | double &nu = est._nu(); |
---|
[679] | 14 | |
---|
[737] | 15 | dyad.set_subvector ( 0, yt ); |
---|
[741] | 16 | if (cond.length()>0) |
---|
| 17 | dyad.set_subvector ( dimy, cond ); |
---|
[679] | 18 | // possible "1" is there from the beginning |
---|
[737] | 19 | |
---|
[477] | 20 | if ( frg < 1.0 ) { |
---|
[665] | 21 | est.pow ( frg ); // multiply V and nu |
---|
[679] | 22 | |
---|
[737] | 23 | |
---|
[639] | 24 | //stabilize |
---|
[737] | 25 | ldmat V0 = alter_est._V(); //$ copy |
---|
| 26 | double &nu0 = alter_est._nu(); |
---|
| 27 | |
---|
| 28 | V0 *= ( 1 - frg ); |
---|
[639] | 29 | V += V0; //stabilization |
---|
[737] | 30 | nu += ( 1 - frg ) * nu0; |
---|
| 31 | |
---|
[665] | 32 | // recompute loglikelihood of new "prior" |
---|
[170] | 33 | if ( evalll ) { |
---|
[162] | 34 | last_lognc = est.lognc(); |
---|
| 35 | } |
---|
| 36 | } |
---|
[679] | 37 | V.opupdt ( dyad, w ); |
---|
[477] | 38 | nu += w; |
---|
[97] | 39 | |
---|
[204] | 40 | // log(sqrt(2*pi)) = 0.91893853320467 |
---|
[97] | 41 | if ( evalll ) { |
---|
| 42 | lnc = est.lognc(); |
---|
[204] | 43 | ll = lnc - last_lognc - 0.91893853320467; |
---|
[97] | 44 | last_lognc = lnc; |
---|
| 45 | } |
---|
| 46 | } |
---|
| 47 | |
---|
[1009] | 48 | double ARX::logpred ( const vec &yt, const vec &cond ) const { |
---|
[170] | 49 | egiw pred ( est ); |
---|
[477] | 50 | ldmat &V = pred._V(); |
---|
| 51 | double &nu = pred._nu(); |
---|
[170] | 52 | |
---|
| 53 | double lll; |
---|
[679] | 54 | vec dyad_p = dyad; |
---|
[737] | 55 | dyad_p.set_subvector ( 0, yt ); |
---|
[1009] | 56 | dyad_p.set_subvector(dimy,cond); |
---|
| 57 | |
---|
[477] | 58 | if ( frg < 1.0 ) { |
---|
[170] | 59 | pred.pow ( frg ); |
---|
| 60 | lll = pred.lognc(); |
---|
[477] | 61 | } else//should be save: last_lognc is changed only by bayes; |
---|
| 62 | if ( evalll ) { |
---|
| 63 | lll = last_lognc; |
---|
| 64 | } else { |
---|
| 65 | lll = pred.lognc(); |
---|
| 66 | } |
---|
[170] | 67 | |
---|
[679] | 68 | V.opupdt ( dyad_p, 1.0 ); |
---|
[477] | 69 | nu += 1.0; |
---|
[201] | 70 | // log(sqrt(2*pi)) = 0.91893853320467 |
---|
[477] | 71 | return pred.lognc() - lll - 0.91893853320467; |
---|
[170] | 72 | } |
---|
| 73 | |
---|
[1013] | 74 | void ARX::flatten ( const BMEF* B , double weight =1.0) { |
---|
[738] | 75 | const ARX* A = dynamic_cast<const ARX*> ( B ); |
---|
| 76 | // nu should be equal to B.nu |
---|
[1013] | 77 | est.pow ( A->posterior()._nu() / posterior()._nu() *weight); |
---|
[738] | 78 | if ( evalll ) { |
---|
| 79 | last_lognc = est.lognc(); |
---|
| 80 | } |
---|
| 81 | } |
---|
| 82 | |
---|
[766] | 83 | ARX* ARX::_copy ( ) const { |
---|
[477] | 84 | ARX* Tmp = new ARX ( *this ); |
---|
[170] | 85 | return Tmp; |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | void ARX::set_statistics ( const BMEF* B0 ) { |
---|
[477] | 89 | const ARX* A0 = dynamic_cast<const ARX*> ( B0 ); |
---|
[170] | 90 | |
---|
[679] | 91 | bdm_assert_debug ( dimension() == A0->dimension(), "Statistics of different dimensions" ); |
---|
| 92 | set_statistics ( A0->dimensiony(), A0->posterior()._V(), A0->posterior()._nu() ); |
---|
[170] | 93 | } |
---|
[180] | 94 | |
---|
[1003] | 95 | enorm<ldmat>* ARX::epredictor ( const vec &cond ) const { |
---|
| 96 | bdm_assert_debug ( cond.length() == rgrlen , "ARX::epredictor cond is of size "+num2str(cond.length())+" expected dimension is "+num2str(rgrlen) ); |
---|
| 97 | |
---|
[679] | 98 | mat mu ( dimy, posterior()._V().rows() - dimy ); |
---|
| 99 | mat R ( dimy, dimy ); |
---|
[270] | 100 | |
---|
[1003] | 101 | vec ext_rgr; |
---|
| 102 | if (have_constant){ |
---|
| 103 | ext_rgr = concat(cond,vec_1(1.0)); |
---|
| 104 | } else { |
---|
| 105 | ext_rgr = cond; |
---|
| 106 | } |
---|
| 107 | |
---|
[198] | 108 | enorm<ldmat>* tmp; |
---|
[477] | 109 | tmp = new enorm<ldmat> ( ); |
---|
[270] | 110 | //TODO: too hackish |
---|
[679] | 111 | if ( yrv._dsize() > 0 ) { |
---|
[270] | 112 | } |
---|
[198] | 113 | |
---|
[477] | 114 | est.mean_mat ( mu, R ); //mu = |
---|
[198] | 115 | //correction for student-t -- TODO check if correct!! |
---|
| 116 | //R*=nu/(nu-2); |
---|
[973] | 117 | if (mu.cols()>0) {// nonempty egiw |
---|
[1003] | 118 | mat p_mu = mu.T() * ext_rgr; //the result is one column |
---|
[973] | 119 | tmp->set_parameters ( p_mu.get_col ( 0 ), ldmat ( R ) ); |
---|
| 120 | } else { |
---|
| 121 | tmp->set_parameters ( zeros( R.rows() ), ldmat ( R ) ); |
---|
| 122 | } |
---|
| 123 | if (dimy==yrv._dsize()) |
---|
| 124 | tmp->set_rv(yrv); |
---|
[198] | 125 | return tmp; |
---|
| 126 | } |
---|
| 127 | |
---|
[270] | 128 | mlstudent* ARX::predictor_student ( ) const { |
---|
[679] | 129 | const ldmat &V = posterior()._V(); |
---|
[737] | 130 | |
---|
[679] | 131 | mat mu ( dimy, V.rows() - dimy ); |
---|
| 132 | mat R ( dimy, dimy ); |
---|
[198] | 133 | mlstudent* tmp; |
---|
[477] | 134 | tmp = new mlstudent ( ); |
---|
[198] | 135 | |
---|
[477] | 136 | est.mean_mat ( mu, R ); // |
---|
[198] | 137 | mu = mu.T(); |
---|
[270] | 138 | |
---|
[477] | 139 | int end = V._L().rows() - 1; |
---|
[679] | 140 | ldmat Lam ( V._L() ( dimy, end, dimy, end ), V._D() ( dimy, end ) ); //exp val of R |
---|
[198] | 141 | |
---|
| 142 | |
---|
[737] | 143 | if ( have_constant ) { // no constant term |
---|
[198] | 144 | //Assume the constant term is the last one: |
---|
[477] | 145 | if ( mu.cols() > 1 ) { |
---|
| 146 | tmp->set_parameters ( mu.get_cols ( 0, mu.cols() - 2 ), mu.get_col ( mu.cols() - 1 ), ldmat ( R ), Lam ); |
---|
| 147 | } else { |
---|
[679] | 148 | tmp->set_parameters ( mat ( dimy, dimc ), mu.get_col ( mu.cols() - 1 ), ldmat ( R ), Lam ); |
---|
[270] | 149 | } |
---|
[625] | 150 | } else { |
---|
| 151 | // no constant term |
---|
[679] | 152 | tmp->set_parameters ( mu, zeros ( dimy ), ldmat ( R ), Lam ); |
---|
[198] | 153 | } |
---|
[180] | 154 | return tmp; |
---|
| 155 | } |
---|
| 156 | |
---|
[585] | 157 | |
---|
| 158 | |
---|
[97] | 159 | /*! \brief Return the best structure |
---|
| 160 | @param Eg a copy of GiW density that is being examined |
---|
| 161 | @param Eg0 a copy of prior GiW density before estimation |
---|
| 162 | @param Egll likelihood of the current Eg |
---|
[896] | 163 | @param indices current indices |
---|
[97] | 164 | \return best likelihood in the structure below the given one |
---|
| 165 | */ |
---|
[896] | 166 | double egiw_bestbelow ( egiw Eg, egiw Eg0, double Egll, ivec &indices ) { //parameter Eg is a copy! |
---|
[97] | 167 | ldmat Vo = Eg._V(); //copy |
---|
| 168 | ldmat Vo0 = Eg._V(); //copy |
---|
| 169 | ldmat& Vp = Eg._V(); // pointer into Eg |
---|
| 170 | ldmat& Vp0 = Eg._V(); // pointer into Eg |
---|
[477] | 171 | int end = Vp.rows() - 1; |
---|
[97] | 172 | int i; |
---|
| 173 | mat Li; |
---|
| 174 | mat Li0; |
---|
[477] | 175 | double maxll = Egll; |
---|
| 176 | double tmpll = Egll; |
---|
| 177 | double belll = Egll; |
---|
[97] | 178 | |
---|
[896] | 179 | ivec tmpindices; |
---|
| 180 | ivec maxindices = indices; |
---|
[97] | 181 | |
---|
[115] | 182 | |
---|
[896] | 183 | cout << "bb:(" << indices << ") ll=" << Egll << endl; |
---|
[115] | 184 | |
---|
[97] | 185 | //try to remove only one rv |
---|
[477] | 186 | for ( i = 0; i < end; i++ ) { |
---|
[97] | 187 | //copy original |
---|
| 188 | Li = Vo._L(); |
---|
| 189 | Li0 = Vo0._L(); |
---|
| 190 | //remove stuff |
---|
[477] | 191 | Li.del_col ( i + 1 ); |
---|
| 192 | Li0.del_col ( i + 1 ); |
---|
| 193 | Vp.ldform ( Li, Vo._D() ); |
---|
| 194 | Vp0.ldform ( Li0, Vo0._D() ); |
---|
| 195 | tmpll = Eg.lognc() - Eg0.lognc(); // likelihood is difference of norm. coefs. |
---|
[115] | 196 | |
---|
[477] | 197 | cout << "i=(" << i << ") ll=" << tmpll << endl; |
---|
[170] | 198 | |
---|
[97] | 199 | // |
---|
| 200 | if ( tmpll > Egll ) { //increase of the likelihood |
---|
[896] | 201 | tmpindices = indices; |
---|
| 202 | tmpindices.del ( i ); |
---|
[97] | 203 | //search for a better match in this substructure |
---|
[896] | 204 | belll = egiw_bestbelow ( Eg, Eg0, tmpll, tmpindices ); |
---|
[477] | 205 | if ( belll > maxll ) { //better match found |
---|
[97] | 206 | maxll = belll; |
---|
[896] | 207 | maxindices = tmpindices; |
---|
[97] | 208 | } |
---|
| 209 | } |
---|
| 210 | } |
---|
[896] | 211 | indices = maxindices; |
---|
[97] | 212 | return maxll; |
---|
| 213 | } |
---|
| 214 | |
---|
[1003] | 215 | ivec ARX::structure_est ( const egiw &est0 ) { |
---|
[477] | 216 | ivec ind = linspace ( 1, est.dimension() - 1 ); |
---|
| 217 | egiw_bestbelow ( est, est0, est.lognc() - est0.lognc(), ind ); |
---|
[97] | 218 | return ind; |
---|
| 219 | } |
---|
[254] | 220 | |
---|
[577] | 221 | |
---|
| 222 | |
---|
[1003] | 223 | ivec ARX::structure_est_LT ( const egiw &est0 ) { |
---|
[577] | 224 | //some stuff with beliefs etc. |
---|
[996] | 225 | ivec belief = vec_1 ( 2 ); // default belief |
---|
| 226 | int nbest = 1; // nbest: how many regressors are returned |
---|
| 227 | int nrep = 5; // nrep: number of random repetions of structure estimation |
---|
| 228 | double lambda = 0.9; |
---|
| 229 | int k = 2; |
---|
| 230 | |
---|
| 231 | Array<str_aux> o2; |
---|
| 232 | |
---|
| 233 | ivec ind = bdm::straux1(est._V(),est._nu(), est0._V(), est0._nu(), belief, nbest, nrep, lambda, k, o2); |
---|
| 234 | |
---|
| 235 | return ind; |
---|
[577] | 236 | } |
---|
| 237 | |
---|
[477] | 238 | void ARX::from_setting ( const Setting &set ) { |
---|
[802] | 239 | BMEF::from_setting(set); |
---|
[883] | 240 | |
---|
[979] | 241 | UI::get (rgr, set, "rgr", UI::compulsory ); |
---|
[964] | 242 | |
---|
| 243 | dimy = yrv._dsize(); |
---|
| 244 | bdm_assert(dimy>0,"ARX::yrv should not be empty"); |
---|
[979] | 245 | rgrlen = rgr._dsize(); |
---|
[737] | 246 | |
---|
[631] | 247 | int constant; |
---|
[737] | 248 | if ( !UI::get ( constant, set, "constant", UI::optional ) ) { |
---|
| 249 | have_constant = true; |
---|
[631] | 250 | } else { |
---|
[737] | 251 | have_constant = constant > 0; |
---|
[625] | 252 | } |
---|
[964] | 253 | dimc = rgrlen; |
---|
[979] | 254 | rvc = rgr; |
---|
[585] | 255 | |
---|
[357] | 256 | //init |
---|
[737] | 257 | shared_ptr<egiw> pri = UI::build<egiw> ( set, "prior", UI::optional ); |
---|
[1003] | 258 | if (pri){ |
---|
[990] | 259 | set_prior(pri.get()); |
---|
[1003] | 260 | } else { |
---|
| 261 | shared_ptr<egiw> post = UI::build<egiw> ( set, "posterior", UI::optional ); |
---|
| 262 | set_prior(post.get()); |
---|
| 263 | } |
---|
| 264 | |
---|
[990] | 265 | |
---|
[737] | 266 | shared_ptr<egiw> alt = UI::build<egiw> ( set, "alternative", UI::optional ); |
---|
| 267 | if ( alt ) { |
---|
| 268 | bdm_assert ( alt->_dimx() == dimy, "alternative is not compatible" ); |
---|
[990] | 269 | bdm_assert ( alt->_V().rows() == dimy + rgrlen + int(have_constant==true), "alternative is not compatible" ); |
---|
[737] | 270 | alter_est.set_parameters ( alt->_dimx(), alt->_V(), alt->_nu() ); |
---|
[878] | 271 | alter_est.validate(); |
---|
[973] | 272 | } |
---|
[796] | 273 | // frg handled by BMEF |
---|
[357] | 274 | |
---|
[270] | 275 | } |
---|
[850] | 276 | |
---|
[973] | 277 | void ARX::set_prior(const epdf *pri){ |
---|
| 278 | const egiw * eg=dynamic_cast<const egiw*>(pri); |
---|
| 279 | if ( eg ) { |
---|
| 280 | bdm_assert ( eg->_dimx() == dimy, "prior is not compatible" ); |
---|
[990] | 281 | bdm_assert ( eg->_V().rows() == dimy + rgrlen + int(have_constant==true), "prior is not compatible" ); |
---|
[973] | 282 | est.set_parameters ( eg->_dimx(), eg->_V(), eg->_nu() ); |
---|
| 283 | est.validate(); |
---|
| 284 | } else { |
---|
[990] | 285 | est.set_parameters ( dimy, zeros ( dimy + rgrlen +int(have_constant==true)) ); |
---|
[973] | 286 | set_prior_default ( est ); |
---|
| 287 | } |
---|
| 288 | //check alternative |
---|
| 289 | if (alter_est.dimension()!=dimension()){ |
---|
| 290 | alter_est = est; |
---|
| 291 | } |
---|
[679] | 292 | } |
---|
[1025] | 293 | |
---|
| 294 | void ARXpartialforg::bayes ( const vec &val, const vec &cond ) { |
---|
| 295 | #define LOG2 0.69314718055995 |
---|
| 296 | vec frg = cond.right(cond.length() - rgrlen); |
---|
| 297 | vec cond_rgr = cond.left(rgrlen); // regression vector |
---|
| 298 | |
---|
| 299 | int dimV = est._V().cols(); |
---|
| 300 | int nparams = dimV - 1; // number of parameters |
---|
[1030] | 301 | int nalternatives = 1 << nparams; // number of alternatives |
---|
| 302 | |
---|
[1025] | 303 | // Permutation matrix |
---|
| 304 | mat perm_matrix = ones(nalternatives, nparams); |
---|
| 305 | int i, j, period, idx_from, idx_to, start, end; |
---|
| 306 | for(i = 0; i < nparams; i++) { |
---|
[1030] | 307 | idx_from = 1 << i; |
---|
| 308 | period = ( idx_from << 1 ); |
---|
| 309 | idx_to = period - 1; |
---|
| 310 | j = 0; |
---|
[1025] | 311 | start = idx_from; |
---|
| 312 | end = idx_to; |
---|
[1030] | 313 | while ( start < nalternatives ) { |
---|
[1025] | 314 | perm_matrix.set_submatrix(start, end, i, i, 0); |
---|
| 315 | j++; |
---|
| 316 | start = idx_from + period * j; |
---|
| 317 | end = idx_to + period * j; |
---|
| 318 | } |
---|
| 319 | } |
---|
| 320 | |
---|
| 321 | // Array of egiws for approximation |
---|
| 322 | Array<egiw*> egiw_array(nalternatives + 1); |
---|
| 323 | // No. of conditioning rows in LD |
---|
| 324 | int nalternatives_cond, position; |
---|
| 325 | |
---|
| 326 | for(int i = 0; i < nalternatives; i++) { |
---|
| 327 | // vector defining alternatives |
---|
| 328 | vec vec_alt = perm_matrix.get_row(i); |
---|
| 329 | |
---|
| 330 | // full alternative or filtered |
---|
| 331 | if( sum(vec_alt) == vec_alt.length() ) { |
---|
| 332 | egiw_array(i) = &alter_est; |
---|
| 333 | continue; |
---|
| 334 | } else if( sum(vec_alt) == 0 ) { |
---|
| 335 | egiw_array(i) = &est; |
---|
| 336 | continue; |
---|
| 337 | } |
---|
| 338 | |
---|
[1030] | 339 | nalternatives_cond = (int) sum(vec_alt) + 1; |
---|
[1025] | 340 | ivec vec_perm(0); // permutation vector |
---|
| 341 | |
---|
| 342 | for(int j = 0; j < nparams; j++) { |
---|
| 343 | position = dimV - j - 2; |
---|
| 344 | if ( vec_alt(position) == 0 ) { |
---|
| 345 | vec_perm.ins(j, position + 1); |
---|
| 346 | } |
---|
| 347 | else { |
---|
| 348 | vec_perm.ins(0, position + 1); |
---|
| 349 | } |
---|
| 350 | } |
---|
| 351 | vec_perm.ins(0, 0); |
---|
| 352 | |
---|
| 353 | ldmat filt (est._V(), vec_perm); |
---|
| 354 | ldmat alt (alter_est._V(), vec_perm); |
---|
| 355 | |
---|
| 356 | mat tmpL(dimV, dimV); |
---|
| 357 | tmpL.set_rows( 0, alt._L().get_rows(0, nalternatives_cond - 1) ); |
---|
| 358 | tmpL.set_rows( nalternatives_cond, filt._L().get_rows(nalternatives_cond, nparams) ); |
---|
| 359 | |
---|
| 360 | vec tmpD(dimV); |
---|
| 361 | tmpD.set_subvector( 0, alt._D()(0, nalternatives_cond - 1) ); |
---|
| 362 | tmpD.set_subvector( nalternatives_cond, filt._D()(nalternatives_cond, nparams) ); |
---|
| 363 | |
---|
| 364 | ldmat tmpLD (tmpL, tmpD); |
---|
| 365 | |
---|
| 366 | vec_perm = sort_index(vec_perm); |
---|
| 367 | ldmat newLD (tmpLD, vec_perm); |
---|
| 368 | |
---|
| 369 | egiw_array(i) = new egiw(1, newLD, alter_est._nu()); |
---|
| 370 | } |
---|
| 371 | |
---|
| 372 | // Approximation |
---|
| 373 | double sumVecCommon; // frequently used term |
---|
| 374 | vec vecNu(nalternatives); // vector of nus of components |
---|
| 375 | vec vecD(nalternatives); // vector of LS reminders |
---|
| 376 | vec vecCommon(nalternatives); // vector of common parts |
---|
| 377 | mat matVecsTheta; // matrix whose rows are theta vects. |
---|
| 378 | |
---|
| 379 | for (i = 0; i < nalternatives; i++) { |
---|
| 380 | vecNu.shift_left( egiw_array(i)->_nu() ); |
---|
| 381 | vecD.shift_left( egiw_array(i)->_V()._D()(0) ); |
---|
| 382 | matVecsTheta.append_row( egiw_array(i)->est_theta() ); |
---|
| 383 | } |
---|
| 384 | |
---|
| 385 | vecCommon = elem_mult ( frg, elem_div(vecNu, vecD) ); |
---|
| 386 | sumVecCommon = sum(vecCommon); |
---|
| 387 | |
---|
| 388 | // approximation of est. regr. coefficients |
---|
| 389 | vec aprEstTheta(nparams); aprEstTheta.zeros(); |
---|
| 390 | for (i = 0; i < nalternatives; i++) { |
---|
| 391 | aprEstTheta += matVecsTheta.get_row(i) * vecCommon(i); |
---|
| 392 | } |
---|
| 393 | aprEstTheta /= sumVecCommon; |
---|
| 394 | |
---|
| 395 | // approximation of degr. of freedom |
---|
| 396 | double aprNu; |
---|
| 397 | double A = log( sumVecCommon ); // Term 'A' in equation |
---|
| 398 | for ( int i = 0; i < nalternatives; i++ ) { |
---|
| 399 | A += frg(i) * ( log( vecD(i) ) - psi( 0.5 * vecNu(i) ) ); |
---|
| 400 | } |
---|
| 401 | aprNu = ( 1 + sqrt(1 + 4 * (A - LOG2)/3 ) ) / ( 2 * (A - LOG2) ); |
---|
| 402 | |
---|
| 403 | // approximation of LS reminder D(0,0) |
---|
| 404 | double aprD = aprNu / sumVecCommon; |
---|
| 405 | |
---|
| 406 | // Aproximation of covariance of LS est. |
---|
| 407 | mat aprC = zeros(nparams, nparams); |
---|
| 408 | for ( int i = 0; i < nalternatives; i++ ) { |
---|
| 409 | aprC += egiw_array(i)->est_theta_cov().to_mat() * frg(i); |
---|
| 410 | vec tmp = ( matVecsTheta.get_row(i) - aprEstTheta ); |
---|
| 411 | aprC += vecCommon(i) * outer_product( tmp, tmp); |
---|
| 412 | } |
---|
| 413 | |
---|
| 414 | // Construct GiW pdf |
---|
| 415 | ldmat aprCinv ( inv(aprC) ); |
---|
| 416 | vec D = concat( aprD, aprCinv._D() ); |
---|
| 417 | mat L = eye(dimV); |
---|
| 418 | L.set_submatrix(1, 0, aprCinv._L() * aprEstTheta); |
---|
| 419 | L.set_submatrix(1, 1, aprCinv._L()); |
---|
| 420 | ldmat aprLD (L, D); |
---|
| 421 | est = egiw(1, aprLD, aprNu); |
---|
| 422 | |
---|
[1038] | 423 | if ( evalll ) { |
---|
| 424 | last_lognc = est.lognc(); |
---|
| 425 | } |
---|
| 426 | |
---|
[1025] | 427 | // update |
---|
| 428 | ARX::bayes ( val, cond_rgr ); |
---|
[973] | 429 | } |
---|
[357] | 430 | |
---|
[1025] | 431 | } |
---|