I am trying to figure out why my function isn’t working since I changed it from a 1-dimensional to 2-dimensional array output.
A very simple version of my function is below. Are there any obvious syntax errors?
functions {
vector[] out_func(int A, int B, real num1, real num2, vector vec1, vector vec2) {
vector[A] out[B, B];
out = { { vec1, num1*vec1 }, { num2*vec2, vec2 } }
return out;
}
}
data {
int A;
int B;
vector[A] vec1;
vector[A] vec2;
}
parameters {
real num1;
real num2;
}
transformed parameters {
vector[A] out[B, B] = out_func(A, B, num1, num2, vec1, vec2) ;
vector[A] lam[B];
for (b in 1:B)
lam[b] = { out[b, 1] + out[b, 2] }
}
I get the “syntax error” output when I run it with the ^ under the r of return.
Thank you :)