Hello, small update on MatlabStan. I downloaded MatlabStan with CmdStan v2.28.2 (stan v3.1)
Following code seems to be working:
% Import dependencies
addpath( genpath('/Users/edelaire1/Documents/software/MatlabStan/'))
addpath( genpath('/Users/edelaire1/Documents/software/MatlabProcessManager/'))
%% Define data and model
data = struct('N',10,...
'y',[0,1,0,0,0,0,0,0,0,1]);
model_path = '/Users/edelaire1/Documents/software/MatlabStan/Examples/bernoulli/';
model = StanModel('file',fullfile(model_path,'bernoulli.stan'), 'method','sample','algorithm','NUTS','verbose',true, ...
'working_dir',model_path);
model.compile();
model_fit = model.sampling('data', data);
%%
model_fit.print()
figure;
model_fit.traceplot()
model_fit.print
Inference for Stan model: bernoulli_model
4 chains: each with iter=(1000,1000,1000,1000); warmup=(0,0,0,0); thin=(1,1,1,1); 4000 iterations saved.
Warmup took (0.024, 0.031, 0.041, 0.033) seconds, 0.13 seconds total
Sampling took (0.10, 0.12, 0.11, 0.084) seconds, 0.42 seconds total
Mean MCSE StdDev 5% 50% 95% N_Eff N_Eff/s R_hat
lp__ -7.3 1.8e-02 0.69 -8.7 -7.0 -6.8 1451 3487 1.0
accept_stat__ 0.93 3.2e-03 0.11 0.68 0.97 1.0 1.3e+03 3.0e+03 1.0e+00
stepsize__ 0.90 5.5e-02 0.078 0.83 0.88 1.0 2.0e+00 4.8e+00 1.9e+13
treedepth__ 1.4 2.0e-02 0.55 1.0 1.0 2.0 7.8e+02 1.9e+03 1.0e+00
n_leapfrog__ 2.7 2.4e-01 1.5 1.0 3.0 7.0 4.1e+01 9.9e+01 1.0e+00
divergent__ 0.00 nan 0.00 0.00 0.00 0.00 nan nan nan
energy__ 7.8 2.5e-02 0.97 6.8 7.5 9.6 1.5e+03 3.6e+03 1.0e+00
theta 0.26 3.2e-03 0.12 0.083 0.24 0.48 1414 3398 1.0
Samples were drawn using hmc with nuts.
For each parameter, N_Eff is a crude measure of effective sample size,
and R_hat is the potential scale reduction factor on split chains (at
convergence, R_hat=1).
In the future changes, I will
Edit: fork can be found here: GitHub - Edouard2laire/MatlabStan: Matlab interface to Stan, a package for Bayesian inference