I am trying to fit a linear model with N=1344 observation ad a matrix of predictors (N=1344 * K=2).
here’s my model
data {
int<lower=0> N;
int<lower=0> K; //number of fixed effects
matrix[N, K] x;
vector[N] y;
}
transformed data {
matrix[N, K] Q_ast;
Q_ast = qr_Q(x)[, 1:K] * sqrt(N - 1);
}
parameters {
real alpha; //intercept
vector[K] theta;
real<lower=0> sigma;
}
model {
y ~ normal(Q_ast * theta + alpha, sigma);
}
The compilation stage fails with error:
file25053f4922a5.cpp:130:240: error: call of overloaded ‘sqrt(int)’ is ambiguous
stan::math::assign(Q_ast, multiply(stan::model::rvalue(qr_Q(x), stan::model::cons_list(stan::model::index_omni(), stan::model::cons_list(stan::model::index_min_max(1, K), stan::model::nil_index_list())), "qr_Q(x)"),sqrt((N - 1))));
...
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! file25053f4922a5.cpp: In member function ‘void model250526cfdfd_climateTAVG_namespace::model250526cfdfd_climateTAVG::ctor_body(stan::io::var_context&, unsigned int, std::ostream*)’:
file25053f4922a5.cpp:130:240: error: call of overloaded ‘sqrt(int)’ is ambiguous
stan::math::assign(Q_ast, multiply(stan::model::rvalue(qr_Q(x), stan::model::cons_list(stan::model::index_omni(), stan::model::cons_list(stan::model::index_min_max(1, K), stan::model::nil_index_list())), "qr_Q(x)"),sqrt((N - 1))));
^
In file included from /usr/include/features.h:419:0,
from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
from /usr/include/stdint.h:
In addition: Warning message:
running command '/usr/lib/R/bin/R CMD SHLIB file25053f4922a5.cpp 2> file25053f4922a5.cpp.err.txt' had status 1