Hey, I just would like to compute the residuals in Stan and got this error:
functions{
real EL_lpdf(matrix X,vector y, real[] theta){
real N = rows(X);
vector[N] resi = y - X *to_vector(theta);
}
}
Expression denoting integer required; found type=real
error in ‘model915f15caf1e8_EL’ at line 15, column 11
13: real EL_lpdf(matrix X,vector y, real[] theta){
14: real N = rows(X);
15: vector[N] resi = y - X *to_vector(theta);
^
16: //matrix Xs;
PARSER EXPECTED:
if.I change the type of “resi” from vector to real and got this:
functions{
real EL_lpdf(matrix X,vector y, real[] theta){
real N = rows(X);
real[N] resi = y - X *to_vector(theta);
}
}
SYNTAX ERROR, MESSAGE(S) FROM PARSER:
error in ‘model915f8bbe70b_EL’ at line 15, column 8
13: real EL_lpdf(matrix X,vector y, real[] theta){
14: real N = rows(X);
15: real[N] resi = y - X *to_vector(theta);
^
16: //matrix Xs;
PARSER EXPECTED:
Anyone knows what is going wrong??