This model compiles fine on my Windows computer but it gives me an error on linux:
data {
int<lower=0> J; //
real y[J]; //
int<lower=0> n[J]; //
}
parameters {
real mu; //
real<lower=0> nu; //
real<lower=0> tau; //
vector[J] eta;
}
transformed parameters {
vector[J] theta;
vector<lower = 0>[J] sigma;
theta = mu + tau * eta;
for (j in 1:J) sigma[j] = nu/sqrt(n[j]);
}
model {
eta ~ normal(0, 1);
y ~ normal(theta, sigma);
}
This is the error I get on linux:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! fileda15802fa8.cpp: In member function ‘T__ modelda70c1bd88_stan_da1b9222be_namespace::modelda70c1bd88_stan_da1b9222be::log_prob(std::vector<T2>&, std::vector<int>&, std::ostream*) const’:
fileda15802fa8.cpp:283:101: error: call of overloaded ‘sqrt(const int&)’ is ambiguous
stan::math::assign(get_base1_lhs(sigma,j,"sigma",1), (nu / sqrt(get_base1(n,j,"n",1))));
^
In file included from /usr/include/features.h:364:0,
from /usr/include/stdint.h:25,
from /usr/lib/gcc/x86_64-linux-gnu/6/include/stdint.h:9,
from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/memory/stack_alloc.hpp:6,
from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:4,
from /usr/local/lib/R/sit
In addition: Warning message:
running command '/usr/local/lib/R/bin/R CMD SHLIB fileda15802fa8.cpp 2> fileda15802fa8.cpp.err.txt' had status 1
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! fileda15802fa8.cpp: In member function ‘T__ modelda70c1bd88_stan_da1b9222be_namespace::modelda70c1bd88_stan_da1b9222be::log_prob(std::vector<T2>&, std::vector<int>&, std::ostream*) const’:
fileda15802fa8.cpp:283:101: error: call of overloaded ‘sqrt(const int&)’ is ambiguous
stan::math::assign(get_base1_lhs(sigma,j,"sigma",1), (nu / sqrt(get_base1(n,j,"n",1))));
^
In file included from /usr/include/features.h:364:0,
from /usr/include/stdint.h:25,
from /usr/lib/gcc/x86_64-linux-gnu/6/include/stdint.h:9,
from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/memory/stack_alloc.hpp:6,
from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:4,
from /usr/local/lib/R/sit
Am I doing something wrong? If so, how can I fix it?