Revision 1058 trunk/src/nh99/xxmcmc.cpp

xxmcmc.cpp (revision 1058)
95 95

  
96 96
void ADSleep(int);
97 97

  
98
void function_minimizer::mcmc_routine(int nmcmc,int iseed0,double dscale,
98
/**
99
 * Monte Carlo Markov Chain minimization routine
100
 * Approximate the target distribution by performing a random walk
101
   across parameter space, integrating at each step.
102
 * This routine also parses the command line arguments and performs actions for
103
   the following ones:
104
 * -mcdiag     Use diagonal covariance matrix with covariance = dscale.
105
 * -mcrb N     Modify covariance matrix to reduce high correlations. 1<=N<=9
106
               where 1=10% and 9=90%.
107
 * -mcec       Read in empirical covariance matrix. This is a file with the
108
               program name prepended to extension '.ecm'.
109
 * -mcpin NAME Read in starting values for MCMC from file NAME. NAME must be a
110
               valid ADMB '.par' file.
111
 * -mcscale    Dynamically scales covariance matrix until a reasonable
112
               acceptance rate is observed.
113
 * -nosdmcmc   Turn off calculation os sdreport variables during mcsave phase
114
               (saves a lot of CPU time).
115
 * -mcu        Use uniform multivariate distributions as bounds, if this is not
116
               specified then random normal multivariate distributions will be
117
               used.
118
 * -mcnoscale  Don't rescale step size based on acceptance rate.
119
 * -mcr        Continue MCMC from a previous -mcmc call. Uses '.mcm' file to
120
               accomplish this.
121
 * -mcsave N   Save parameter values from every Nth simulation instead of every
122
               single one.
123
 * -mcprobe N  Use probing strategy, 0.00001<N<=0.499. See the function
124
               new_probing_bounded_multivariate_normal() in prmonte.cpp
125
               for more detail.
126
 * -mcgrope    Deprecated, equivalent to -mcprobe
127
 * \param int nmcmc The number of MCMC simulations to run.
128
 * \param int iseed0 Initial seed value for simulations.
129
 * \param double dscale Scale value used only if -mcdiag is specified.
130
 * \param int restart_flag Restart the MCMC, even if -mcr is specified.
131
 * \return Nothing.
132
 */
133
void function_minimizer::mcmc_routine(int nmcmc,int iseed0, double dscale,
99 134
  int restart_flag)
100
{
135
 {
101 136
  uostream * pofs_psave=NULL;
102 137
  dmatrix mcmc_display_matrix;
103
  //int mcmc_save_index=1; 
138
  //int mcmc_save_index=1;
104 139
  //int mcmc_wrap_flag=0;
105 140
  //int mcmc_gui_length=10000;
106 141
  int no_sd_mcmc=0;
......
474 509
          int iii=atoi(ad_comm::argv[on+1]);
475 510
          if (iii <=0)
476 511
          {
477
            cerr << " Invalid option following command line option -mcball -- "
512
            cerr << " Invalid option following command line option -mcscale -- "
478 513
              << endl << " ignored" << endl;
479 514
          }
480 515
          else
......
605 640
          pprobe=strtod(ad_comm::argv[on+1],&end);
606 641
          if (pprobe<=0.00001 || pprobe > .499) 
607 642
          {
608
            cerr << "Invalid argument to option -mcgrope" << endl;
643
            cerr << "Invalid argument to option -mcprobe" << endl;
609 644
            pprobe=-1.0;
610 645
            probe_flag=0;
611 646
          }
......
887 922
  }
888 923
}
889 924

  
925
/**
926
 * Writes the covariance matrix out to a file, which is prog_name
927
 * prepended to the extension '.ecm'.
928
 * Also writes the sorted eigenvalues of the covariance matrix to the screen.
929
 * \param int ncor
930
 * \param dvector& s_mean
931
 * \param dmatrix& s_covar
932
 * \param adstring& prog_name
933
 * \return Nothing.
934
 */
890 935
void write_empirical_covariance_matrix(int ncor, const dvector& s_mean,
891 936
  const dmatrix& s_covar,adstring& prog_name)
892 937
{
......
923 968
 */
924 969
}
925 970

  
926
void read_empirical_covariance_matrix(int nvar, const dmatrix& S, const adstring& prog_name)
971
/**
972
 * Reads the covariance matrix from a file, which is the program name
973
 * prepended to the extension '.ecm'.
974
 * \param int nvar
975
 * \param dmatrix& S
976
 * \param adstring& prog_name
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff