Revision 1108 trunk/src/nh99/xxmcmc2.cpp
xxmcmc2.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 
#include <admodel.h> 
8  8  
...  ...  
98  98 
{ 
99  99 
uostream * pofs_psave=NULL; 
100  100 
dmatrix mcmc_display_matrix; 
101 
int mcmc_save_index=1;


101 
int mcmc_save_index=1; 

102  102 
int mcmc_wrap_flag=0; 
103  103 
int mcmc_gui_length=10000; 
104  104 
int no_sd_mcmc=0; 
105 


105  
106  106 
int on2=1; 
107  107 
if ( (on2=option_match(ad_comm::argc,ad_comm::argv,"nosdmcmc"))>1) 
108  108 
no_sd_mcmc=1; 
109 


110 
if (stddev_params::num_stddev_params==0)


109  
110 
if (stddev_params::num_stddev_params==0) 

111  111 
{ 
112  112 
cerr << " You must declare at least one object of type sdreport " 
113  113 
<< endl << " to do the mcmc calculations" << endl; 
...  ...  
115  115 
} 
116  116 
{ 
117  117 
//ofstream of_bf("testbf"); 
118 


118  
119  119 
//if (adjm_ptr) set_labels_for_mcmc(); 
120 


120  
121  121 
ivector number_offsets; 
122  122 
dvector lkvector; 
123  123 
//double current_bf=0; 
...  ...  
141  141 
int ibfcount=0; 
142  142 
double llbest; 
143  143 
double lbmax; 
144 


144  
145  145 
//if ( (on=option_match(ad_comm::argc,ad_comm::argv,"mcscov",ntmp))>1) 
146  146 
//{ 
147  147 
scov_option=1; 
...  ...  
153  153 
int ndvar=stddev_params::num_stddev_calc(); 
154  154 
int numdvar=stddev_params::num_stddev_number_calc(); 
155  155 
/* 
156 
if (adjm_ptr)


156 
if (adjm_ptr) 

157  157 
{ 
158  158 
mcmc_display_matrix.allocate(1,numdvar,1,mcmc_gui_length); 
159  159 
number_offsets.allocate(1,numdvar); 
...  ...  
164  164 
dvector scale(1,nvar); 
165  165 
dmatrix values; 
166  166 
int have_hist_flag=0; 
167 
initial_params::xinit(x);


167 
initial_params::xinit(x); 

168  168 
dvector pen_vector(1,nvar); 
169  169 
{ 
170 
initial_params::reset(dvar_vector(x),pen_vector);


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

171  171 
cout << pen_vector << endl << endl; 
172  172 
} 
173 


173  
174  174 
initial_params::mc_phase=0; 
175  175 
initial_params::stddev_scale(scale,x); 
176  176 
initial_params::mc_phase=1; 
...  ...  
190  190 
{ 
191  191 
diag_option=1; 
192  192 
cout << " Setting covariance matrix to diagonal with entries " << dscale 
193 
<< endl;


193 
<< endl; 

194  194 
} 
195  195 
dmatrix S(1,nvar,1,nvar); 
196  196 
dvector sscale(1,nvar); 
...  ...  
224  224 
use_empirical_flag=1; 
225  225 
} 
226  226 
if (use_empirical_flag) 
227 
{


227 
{ 

228  228 
read_empirical_covariance_matrix(nvar,S,ad_comm::adprogram_name); 
229  229 
} 
230  230 
else if (!rescale_bounded_flag) 
...  ...  
261  261 
S(i,i)=dscale; 
Also available in: Unified diff