9 const int& level_index,
dvector& xdist,
int index);
12 const int& level_index,
dvector& xdist,
int index);
24 for (
int i=mmin;i<=mmax;i++)
47 double trimax(
double x,
double y,
double z);
49 #if defined(USE_ADPVM)
54 int prof_switch=get_int_from_master();
55 if (!prof_switch)
break;
58 cerr <<
"Error in prof_switch " << prof_switch <<
endl;
61 int underflow_flag=get_int_from_master();
76 cerr <<
"Usage -iprint option needs integer -- ignored" <<
endl;
85 dvector siglevel(
"{.90,.95,.975}");
93 if (sno>num_pp) num_pp=sno;
112 double current_value;
120 dvector all_values(-num_pp,num_pp);
121 dvector all_num_sigs(-num_pp,num_pp);
128 dmatrix xmax(-num_pp,num_pp,1,nvar);
129 dmatrix gprof(-num_pp,num_pp,1,nvar);
130 dmatrix fgrads(-num_pp,num_pp,1,nvar);
143 d3_array eigenvals(0,nlp-1,-num_pp,num_pp,1,nvar-1);
144 d3_array curvcor(0,nlp-1,-num_pp,num_pp,1,nvar-1);
163 const double relsig = snz > 0 ? snz : 0.5;
172 cerr <<
"error standard dev of likeporf parameter is 0" <<
endl;
174 old_value=likeprof_save(ip);
175 old_value=old_value+offset*relsig*sigma;
180 for (
int i=1;i<=2;i++)
185 int underflow_flag=0;
199 current_value=old_value;
200 for (
int j=0;j<=num_pp;j++)
202 if (j!=0 || sign > 0)
208 new_value=current_value;
215 num_sigs+=1.5*relsig*
sign;
216 current_value+=1.5*relsig*sign*sigma;
217 new_value=current_value;
221 num_sigs+=2.5*relsig*
sign;
222 current_value+=2.5*relsig*sign*sigma;
223 new_value=current_value;
226 #if defined(USE_ADPVM)
231 send_int_to_slaves(3);
233 global_min,penalties(ip,j*sign),final_weight);
242 global_min,penalties(ip,j*sign),final_weight);
248 global_min,penalties(ip,j*sign),final_weight);
252 all_num_sigs(j*sign)=num_sigs;
270 #if defined(USE_DDOUBLE)
271 lg_jacob(ip,sign*j)=
sum(
log(
fabs(xscale)+
double(1.e-60)));
273 lg_jacob(ip,sign*j)=
sum(
log(
fabs(xscale)+1.e-60));
277 lprof(ip,sign*j)=fprof;
281 lprof(ip,sign*j)=lprof(ip,sign*(j-1))+2;
286 actual_value(ip,sign*j)=xx;
290 actual_value(ip,sign*j)=new_value;
293 ldiff=fprof-lprof(ip,0);
326 gprof(sign*j)=gprof(sign*(j-1));
327 xdist(ip,sign*j)=xdist(ip,sign*(j-1));
360 ofstream ofs3((
char*) (profrep_name+
adstring(
".pvl")));
361 for (
int ix=-num_pp;ix<=num_pp;ix++)
363 ofs3 <<
"#Step " << ix <<
endl;
364 ofs3 <<
"#num sigmas " << all_num_sigs(ix) <<
endl;
365 ofs3 << xmax(ix) <<
endl;
369 #if defined(DO_PROFILE)
372 ldet(ip)=ldet(ip)-ln_det_proj_jac(ip);
375 ofstream ofs(
"det.tmp");
378 ofs <<
"the log dets" <<
endl;
379 ofs <<
"ldet" <<
endl;
380 ofs << ldet(ip) << endl <<
endl;
381 ofs <<
"lndet_proj_jac" <<
endl;
382 ofs << ln_det_proj_jac(ip) << endl <<
endl;
383 ofs <<
"ldet-lndet_proj_jac" <<
endl;
384 ofs << ldet(ip)-ln_det_proj_jac(ip) +ln_det_proj_jac(ip,0)
395 cerr <<
"Error standard dev of likeprof parameter is 0" <<
endl;
396 #ifndef CURVE_CORRECT
398 all_values,actual_value,global_min,offset,lprof,ldet,xdist,
402 all_values,actual_value,global_min,offset,lprof,ldet,xdist,
static likeprof_params * likeprofptr[500]
void get_onesided_intervals(const dvector &left_bd, const dvector &right_bd, dmatrix &ms, const dvector &xs, const dvector &siglevel, const int &level_index, dvector &xdist, int index)
static void restore_all_values(const dvector &x, const int &ii)
static adpvm_manager * pvm_manager
void pvm_master_prof_minimize(int iprof, double sigma, double new_value, const double &_fprof, const int underflow_flag, double global_min, const double &_penalties, const double &_final_weight)
void report_onesided_confidence_limits(const ofstream &ofs3, int numsig_levels, dvector &siglevel, const dvector &left_bd, const dvector &right_bd, int ip)
dmatrix trans(const dmatrix &m1)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Vector of double precision numbers.
int indexmin() const
Get minimum valid index.
void prof_minimize(int iprof, double sigma, double new_value, const double &fprof, const int underflow_flag, double global_min, const double &penalties, const double &final_weight)
double sum(const d3_array &darray)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
d3_array elem_div(const d3_array &a, const d3_array &b)
Returns d3_array results with computed elements division of a(i, j, k) / b(i, j, k).
df1_two_variable fabs(const df1_two_variable &x)
virtual double & get_sigma(void)=0
static adstring adprogram_name
double norm(const d3_array &a)
Return computed norm value of a.
void get_confidence_interval(const dvector &left_bd, const dvector &right_bd, dmatrix &ms, const dvector &xs, const dvector &siglevel, const int &level_index, dvector &xdist, int index)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
void likeprof_routine(double global_min)
int atoi(adstring &s)
Returns a integer converted from input s.
double mult_factor(int j)
prnstream & endl(prnstream &)
static int max_number_phases
int indexmax() const
Get maximum valid index.
void normalize_posterior_distribution(double udet, const dvector &siglevel, const ofstream &ofs2, int num_pp, const dvector &all_values, const dmatrix &actual_value, double global_min, int offset, const dmatrix &lprof, const dmatrix &ldet, const dmatrix &xdist, const dmatrix &penalties)
Description not yet available.
static void xinit(const dvector &x)
Description not yet available.
virtual double get_value(void)=0
void prof_minimize_re(int iprof, double sigma, double new_value, const double &fprof, const int underflow_flag, double global_min, const double &penalties, const double &final_weight)
double unrestricted_hess_determinant(void)
static void copy_all_values(const dvector &x, const int &ii)
int option_match(int argc, char *argv[], const char *string)
Checks if the program has been invoked with a particular command line argument ("string").
void get_particular_grad(int iprof, int nvar, const dvector &fg, const dvector &g)
void pvm_slave_likeprof_routine(void)
virtual const char * label()=0
void report_confidence_limits(const ofstream &ofs3, int numsig_levels, dvector &siglevel, const dvector &left_bd, const dvector &right_bd)
double sign(const double x)
The sign of a number.
static int stddev_scale(const dvector &d, const dvector &x)
Description not yet available.
double trimax(double x, double y, double z)
void initialize(void)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
d3_array log(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
void pvm_slave_prof_minimize(int underflow_flag)
static void set_inactive_only_random_effects(void)
static int random_effects_flag
double get_stepsize(void)
static int num_likeprof_params
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.