ADMB-help,<div><br></div><div>I wish to know how to run a model with MCMC on Windows.</div><div><br></div><div>The ADMB editor I am using is Emacs (customised for Windows users -- courtesy of Arni Magnuson)</div><div><br></div>
<div>The model is the well known Ricker S-R with an extra covariate:</div><div>###########</div><div>GLOBALS_SECTION</div><div><div> #include "admodel.h"</div><div> const double pi = 3.141592654;</div><div> ofstream mcmc_par("ricker2massb_mcmc.csv")</div>
<div><br></div><div>DATA_SECTION</div><div> init_int n</div><div> init_matrix data(1,n,1,3)</div><div> vector S(1,n)</div><div> !! S = column(data,1);</div><div> vector R(1,n)</div><div> !! R = column(data,2);</div>
<div> vector massb(1,n)</div><div> !! massb = column(data,3);</div><div> </div><div>PARAMETER_SECTION</div><div> init_number a</div><div> init_number b</div><div> init_number c</div><div> init_number logSigma</div>
<div> sdreport_number sigma</div><div> vector Rfit(1,n)</div><div> number RSS</div><div> objective_function_value f</div><div><br></div><div>INITIALIZATION_SECTION</div><div> a 0.6</div><div> b -4.0</div><div> c -1.1</div>
<div> logSigma -1</div><div> </div><div>PROCEDURE_SECTION</div><div> Rfit = exp(a) * elem_prod(S, exp(-exp(b)*S+exp(c)*massb));</div><div> RSS = sum(square(log(R)-log(Rfit)));</div><div> sigma = exp(logSigma);</div><div>
f = 0.5*n*log(2*pi) + n*logSigma + RSS/(2.0*square(sigma));</div><div> if(mceval_phase())</div><div> write_mcmc();</div><div><br></div><div>FUNCTION write_mcmc</div><div> mcmc_par << a << "," << b << "," << c << endl;</div>
</div><div>###################</div><div><br></div><div>Thanks in advance,</div><div>Luis</div>