Hello,
I am trying to run Stan’s diagnose binary on a model. Unfortunately, I am getting an error. Here is some reproducible code using the example bernoulli model.
using StanSample, DataFrames
ProjDir = @__DIR__
bernoulli_model = "
data {
int<lower=1> N;
int<lower=0,upper=1> y[N];
}
parameters {
real<lower=0,upper=1> theta;
}
model {
theta ~ beta(1,1);
y ~ bernoulli(theta);
}
";
data = Dict("N" => 10, "y" => [0, 1, 0, 1, 0, 0, 0, 0, 0, 1])
# Keep tmpdir across multiple runs to prevent re-compilation
tmpdir = joinpath(ProjDir, "tmp")
isdir(tmpdir) && rm(tmpdir; recursive=true)
sm = SampleModel("bernoulli", bernoulli_model, tmpdir);
rc = stan_sample(sm; data);
if success(rc)
diagnose(sm)
end
Unfortunately, I get this error message:
Base.IOError("could not spawn `/Users/stephenwild/cmdstan/bin/diagnose /Users/stephenwild/Desktop/Stats_stuff/State_space/tmp/bernoulli_chain_1.csv /Users/stephenwild/Desktop/Stats_stuff/State_space/tmp/bernoulli_chain_2.csv /Users/stephenwild/Desktop/Stats_stuff/State_space/tmp/bernoulli_chain_3.csv /Users/stephenwild/Desktop/Stats_stuff/State_space/tmp/bernoulli_chain_4.csv`: no such file or directory (ENOENT)", -2)
I tried using StanDiagnose.jl, but was also unsuccessful.
What code do I need to run Stan’s diagnose binary on a model?