#include #include using namespace bdm; //These lines are needed for use of cout and endl using std::cout; using std::endl; int main() { RNG_randomize(); RV y ( "{y }","1" ); RV u1 ( "{u1 }","1" ); RV u2 ( "{u2 }","1" ); RV all = y; all.add ( u1 ); all.add ( u2 ); mlnorm f1; f1.set_rv( y ); f1.set_rvc( u1 ); mlnorm f2; f2.set_rv( y ); f2.set_rvc( u2 ); //Differneces in constant term are essential f1.set_parameters ( "0.4","1",mat ( "0.04" ) ); f2.set_parameters ( "0.2","-1",mat ( "0.08" ) ); Array A ( 2 ); A ( 0 ) =&f1; A ( 1 ) =&f2; merger M ( A ); M.debug_file("iter_cond_debug.it"); enorm g0; g0.set_rv ( all ); mat Cov=0.3*eye ( 3 ); Cov(1,2)=0.29; Cov(2,1)=0.29; g0.set_parameters ( vec ( "1 1 1" ),Cov);// +1*ones ( 3,3 ) ); enorm* teste=g0.marginal(concat(u1,u2)); mlnorm* testm=(mlnorm*)teste->condition(u2); M.set_parameters ( 1.2,1000,1 ); Array YUU(3); YUU(0)=linspace(-2.9,3.1,20); YUU(1)=linspace(-5,5,20); YUU(2)=linspace(-3,3,20); M.set_grid(YUU); int Ntrials=1; vec A1s ( Ntrials ); vec A2s ( Ntrials ); vec R1s ( Ntrials ); vec R2s ( Ntrials ); vec C1s ( Ntrials ); vec C2s ( Ntrials ); for ( int it=0;itepredictor ( ); MP->set_rv(all); RV yu1 = y; yu1.add ( u1 ); RV yu2 = y; yu2.add ( u2 ); enorm* P1m= ( enorm* ) MP->marginal ( yu1 ); enorm* P2m= ( enorm* ) MP->marginal ( yu2 ); mlnorm* P1c= ( mlnorm* ) ( P1m->condition ( y ) ); mlnorm* P2c= ( mlnorm* ) ( P2m->condition ( y ) ); A1s(it) = P1c->_A()(0,0); A2s(it) = P2c->_A()(0,0); R1s(it) = P1c->_R()(0,0); R2s(it) = P2c->_R()(0,0); C1s(it) = P1c->_mu_const()(0); C2s(it) = P2c->_mu_const()(0); cout << "mean: " << MM._Coms(0)->_e()->mean() <