Skip to content

Controlling Stan behavior using parameters

Brian Lau edited this page May 19, 2017 · 4 revisions

Stan has lots of parameters, which are all exposed in the Matlab interface (see help stan). These can all be set using name/value pairs. Case and ordering do not matter, and

fit = stan('model_code',model_code,'data',data,'verbose',true);

is the same as

fit = stan('data',data,'verbose',true,'model_code',model_code);

You can also pass structures of parameters to stan or StanModel.

% name/value pairs
fit = stan('model_code',model_code,'data',data,'verbose',true);

% structure
params = struct('model_code',{model_code},'data',data,'verbose',true);
fit = stan(params);

Note the {} braces around model_code, which is necessary to prevent cell array expansion.