DRAMRUN Metropolis-Hastings MCMC run with adaptive delayed rejection (DRAM) This function generates MCMC chain using DRAM adaptation for a model defined by user supplied sum-of-squares function and with additive i.i.d. Gaussian errors for the observations. The error variance sigma2 is updated using conjugate inverse gamma distribution. [results,chain,s2chain]=dramrun(model,data,params,options) input: model.ssfun = ; % sum-of-squares function, ss=ssfun(par,data), % that returns -2*log(p(y|par)) model.priorfun = ; % prior "sum-of-squares", priorfun(par,params), % that returns -2*log(p(par)), % default: inline('0','x','params') data = ; % extra argument for ssfun (to pass the data etc.) params.par0 = ; % initial parameter vector (a row vector) params.sigma2 = 1;% initial/prior value for the Gaussian error variance params.n0 = -1;% precision of sigma2 as imaginative observations % if n0<0, no sigma2 update params.n = ; % number of actual observations (for sigma2 update) params.bounds = ; % 2*npar matrix of parameter bounds % default: [-Inf,Inf] options.nsimu = 2000; % length of the chain options.qcov = ; % proposal covariance matrix parameters for DRAM options.adaptint = 10; % how often to adapt, if zero, no adaptation options.drscale = 3; % scale for the second proposal, if zero, no DR output: results structure that contains some info about the run chain nsimu*npar MCMC chain s2chain sigmaČ chain (if generated)