[ADMB Users] MCMC in Windows environment

Luis Ridao luridao at gmail.com
Tue Apr 5 08:38:56 PDT 2011


ADMB-help,

I wish to know how to run a model with MCMC on Windows.

The ADMB editor I am using is Emacs (customised for Windows users --
courtesy of Arni Magnuson)

The model is the well known Ricker S-R with an extra covariate:
###########
GLOBALS_SECTION
  #include "admodel.h"
  const double pi = 3.141592654;
  ofstream mcmc_par("ricker2massb_mcmc.csv")

DATA_SECTION
  init_int n
  init_matrix data(1,n,1,3)
  vector S(1,n)
  !! S = column(data,1);
  vector R(1,n)
  !! R = column(data,2);
  vector massb(1,n)
  !! massb = column(data,3);

PARAMETER_SECTION
  init_number a
  init_number b
  init_number c
  init_number logSigma
  sdreport_number sigma
  vector Rfit(1,n)
  number RSS
  objective_function_value f

INITIALIZATION_SECTION
  a 0.6
  b -4.0
  c -1.1
  logSigma -1

PROCEDURE_SECTION
  Rfit = exp(a) * elem_prod(S, exp(-exp(b)*S+exp(c)*massb));
  RSS = sum(square(log(R)-log(Rfit)));
  sigma = exp(logSigma);
  f = 0.5*n*log(2*pi) + n*logSigma + RSS/(2.0*square(sigma));
  if(mceval_phase())
  write_mcmc();

FUNCTION write_mcmc
  mcmc_par << a << "," << b << "," << c << endl;
###################

Thanks in advance,
Luis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20110405/541cd317/attachment.html>


More information about the Users mailing list