Compilation error (beginner)

Hello, I am very new to Stan and try to use it through R. I am getting a compilation error for a very simple model

I want to use Stan for ODE fitting and later hierarchical models. I had trouble running the ODE code so I started with something simple I found but I still get an error I do not understand.

bern.stan =
"data {
int<lower=0> N; // number of trials
int<lower=0, upper=1> y[N]; // success on trial n

parameters {
real<lower=0, upper=1> theta; // chance of success

model {
theta ~ uniform(0, 1); // prior
y ~ bernoulli(theta); // likelihood

theta = 0.30
N = 20
y = rbinom(N, 1, 0.3)

fit = stan(model_code=bern.stan, data = list(y = y, N = N), iter=5000)`


Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from /opt/scp/software/mro/3.5.1-foss-2017a/lib64/R/site-library/rstan/include/rstan/rstaninc.hpp:3:0,
from file62927ea13771.cpp:336:
/opt/scp/software/mro/3.5.1-foss-2017a/lib64/R/site-library/rstan/include/rstan/stan_fit.hpp:30:40: fatal error: stan/callbacks/interrupt.hpp: No such file or directory
#include <stan/callbacks/interrupt.hpp>
compilation terminated.
make: *** [file62927ea13771.o] Error 1
In addition: Warning message:
In system(cmd, intern = !verbose) :
running command ‘/opt/scp/software/mro/3.5.1-foss-2017a/lib64/R/bin/R CMD SHLIB file62927ea13771.cpp 2> file62927ea13771.cpp.err.txt’ had status 1

Is it possible StanHeaders isn’t installed? This package:

1 Like

That must have been it. I tried it and it worked! Thank you very much

1 Like