According to 1D Integrator, in order to use relative_tolerance as an argument, I need to use integrate\_1d, but Stan does not seem to like this function. I receive an error message when trying to use integrate\_1d
SYNTAX ERROR, MESSAGE(S) FROM PARSER:
variable "integrate" does not exist.
It is fine to define them as empty arrays in the transformed data block. I didn’t compile or run that code; I was just saying I didn’t get a parser error from it.
Okay. I will rewrite this “by hand”. I pasted the code from the Stan user guide and I may have accidentally copied something from the pdf that does not compile well in R.
Update: I just ran two Stan codes, both have a functions block defined. The scripts both use integrate_1d and both give an error message saying that the variable (which is actually a function, so Stan is confusing the function for a variable) does not exist. E.g.
SYNTAX ERROR, MESSAGE(S) FROM PARSER:
variable "normal_density" does not exist.
error in 'modeldd88ab7bd6_example' at line 26, column 43
-------------------------------------------------
24: left_limit ~ normal(0,1);
25: target+= normal_lpdf(y | mu, sigma);
26: target+= log(integrate_1d(normal_density, left_limit, positive_infinity(), {mu, sigma}, x_r, x_i, 1e-8));
^
27: }
-------------------------------------------------