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

2  2 
* $Id$ 
3  3 
* 
4  4 
* Author: David Fournier 
5 
* Copyright (c) 20082012 Regents of the University of California


5 
* Copyright (c) 20082012 Regents of the University of California 

6  6 
*/ 
7  7  
8  8  
...  ...  
139  139 
//int mcmc_wrap_flag=0; 
140  140 
//int mcmc_gui_length=10000; 
141  141 
int no_sd_mcmc=0; 
142 


142  
143  143 
int on2=1; 
144  144 
int nvar1=0; 
145  145 
if ( (on2=option_match(ad_comm::argc,ad_comm::argv,"nosdmcmc"))>1) 
146  146 
{ 
147  147 
no_sd_mcmc=1; 
148 


149  148 
} 
150  149 
if (mcmc2_flag==1) 
151  150 
{ 
...  ...  
153  152 
nvar1=initial_params::nvarcalc(); // get the number of active parameters 
154  153 
} 
155  154  
156 
if (stddev_params::num_stddev_params==0)


155 
if (stddev_params::num_stddev_params==0) 

157  156 
{ 
158  157 
cerr << " You must declare at least one object of type sdreport " 
159  158 
<< endl << " to do the mcmc calculations" << endl; 
...  ...  
161  160 
} 
162  161 
{ 
163  162 
//ofstream of_bf("testbf"); 
164 


163  
165  164 
//if (adjm_ptr) set_labels_for_mcmc(); 
166 


165  
167  166 
ivector number_offsets; 
168  167 
dvector lkvector; 
169  168 
//double current_bf=0; 
...  ...  
179  178 
int nvar_x=0; 
180  179 
#if defined(USE_LAPLACE) 
181  180 
initial_params::set_inactive_random_effects(); 
182 
nvar_x=initial_params::nvarcalc();


181 
nvar_x=initial_params::nvarcalc(); 

183  182 
initial_params::set_active_random_effects(); 
184 
int nvar_re=initial_params::nvarcalc();


183 
int nvar_re=initial_params::nvarcalc(); 

185  184 
#endif 
186  185  
187  186  
...  ...  
198  197 
int ibfcount=0; 
199  198 
double llbest; 
200  199 
double lbmax; 
201 


200  
202  201 
//int ntmp=0; 
203  202 
//if ( (on=option_match(ad_comm::argc,ad_comm::argv,"mcscov",ntmp))>1) 
204  203 
//{ 
...  ...  
211  210 
int ndvar=stddev_params::num_stddev_calc(); 
212  211 
int numdvar=stddev_params::num_stddev_number_calc(); 
213  212 
/* 
214 
if (adjm_ptr)


213 
if (adjm_ptr) 

215  214 
{ 
216  215 
mcmc_display_matrix.allocate(1,numdvar,1,mcmc_gui_length); 
217  216 
number_offsets.allocate(1,numdvar); 
...  ...  
229  228 
dvector scale(1,nvar); 
230  229 
dmatrix values; 
231  230 
int have_hist_flag=0; 
232 
initial_params::xinit(x);


231 
initial_params::xinit(x); 

233  232 
dvector pen_vector(1,nvar); 
234  233 
{ 
235 
initial_params::reset(dvar_vector(x),pen_vector);


234 
initial_params::reset(dvar_vector(x),pen_vector); 

236  235 
//cout << pen_vector << endl << endl; 
237  236 
} 
238 


237  
239  238 
initial_params::mc_phase=0; 
240  239 
initial_params::stddev_scale(scale,x); 
241  240 
initial_params::mc_phase=1; 
...  ...  
254  253 
{ 
255  254 
diag_option=1; 
256  255 
cout << " Setting covariance matrix to diagonal with entries " << dscale 
257 
<< endl; 
Also available in: Unified diff