Revision 1935 trunk/src/nh99/xxmcmc.cpp
xxmcmc.cpp (revision 1935)  

160  160 
//double total_spread=2500; 
161  161 
uostream * pofs_sd = NULL; 
162  162  
163 
#if defined(USE_LAPLACE) 

164  163 
initial_params::set_inactive_random_effects(); 
165  164 
//int nvar_x=initial_params::nvarcalc(); 
166  165 
initial_params::set_active_random_effects(); 
167 
int nvar_re=initial_params::nvarcalc(); 

168 
#endif 

169  166  
170  167 
int nvar=initial_params::nvarcalc(); // get the number of active parameters 
171  168 
//int scov_option=0; 
...  ...  
200  197 
number_offsets=stddev_params::copy_all_number_offsets(); 
201  198 
} 
202  199 
*/ 
203 
#if defined(USE_LAPLACE) 

204  200 
if (mcmc2_flag==0) 
205  201 
{ 
206  202 
initial_params::set_inactive_random_effects(); 
207  203 
nvar=initial_params::nvarcalc(); // get the number of active parameters 
208  204 
} 
209 
#endif 

210  205 
dvector x(1,nvar); 
211  206 
dvector scale(1,nvar); 
212  207 
dmatrix values; 
...  ...  
379  374 
// get lower and upper bounds 
380  375  
381  376 
independent_variables y(1,nvar); 
382 
#if defined(USE_LAPLACE) 

383 
independent_variables parsave(1,nvar_re); 

384 
initial_params::restore_start_phase(); 

385 
#else 

386  377 
independent_variables parsave(1,nvar); 
387 
#endif


378 
initial_params::restore_start_phase();


388  379  
389  380 
// read in the mcmc values to date 
390  381 
int ii=1; 
...  ...  
450  441 
ii=1; 
451  442 
initial_params::restore_all_values(parsave,ii); 
452  443  
453 
#if defined(USE_LAPLACE) 

454  444 
if (mcmc2_flag==0) 
455  445 
{ 
456  446 
initial_params::set_inactive_random_effects(); 
457  447 
} 
458 
#endif 

459  448  
460  449 
gradient_structure::set_NO_DERIVATIVES(); 
461  450 
ofstream ogs("sims"); 
...  ...  
594  583 
{ 
595  584 
if (psvflag  (mcrestart_flag == 1) ) 
596  585 
{ 
597 
# if defined(USE_LAPLACE) 

598 
(*pofs_psave) << nvar_re; 

599 
# else 

600  586 
(*pofs_psave) << nvar; 
601 
# endif 

602  587 
} 
603  588 
} 
604  589 
} 
...  ...  
696  681 
} 
697  682 
} 
698  683 
ii=1; 
699 
#if defined(USE_LAPLACE) 

700  684 
if (random_effects_flag) 
701  685 
{ 
702  686 
initial_params::restore_start_phase(); 
...  ...  
710  694 
{ 
711  695 
initial_params::restore_all_values(parsave,ii); 
712  696 
} 
713 
#else 

714 
initial_params::restore_all_values(parsave,ii); 

715 
#endif 

716  697 
initial_params::set_all_simulation_bounds(symbds); 
717  698  
718  699 
// option of generating uniform or normal random variables 
...  ...  
738  719 
symbds(2), chd,lpinv,1*(chdinv*bmn1),pprobe,rng); 
739  720  
740  721 
ll=get_monte_carlo_value(nvar,y); 
741 
#if defined(USE_LAPLACE) 

742  722 
if (random_effects_flag) 
743  723 
{ 
744  724 
initial_params::restore_start_phase(); 
745  725 
} 
746 
#endif 

747  726 
//cout << ll << " " << llc << endl; 
748  727 
double ldiff=lproblpinv; 
749  728 
logr= ll  ldiff  llc; 
Also available in: Unified diff