Is it possible in Stan now, or a feature that might be added, to let a function be passed into a user-defined Stan function?
I am thinking I have functions P and Q defined in the functions block, along with some other function R:
`functions{
real P(real X){
real Z;
Z=X+1;
return Z;
}
real Q(real X){
real Z;
Z=X+2;
return Z;
}
real R(function S, real X){
real Z;
Z=S(X);
return Z;
}
}`
and then have something like:
model{ real Y[2] Y[1] = S(P,X); Y[2] = S(Q,X); }
In this example code, it a rather useless request, but in the project I’m working on it would reduce a bunch of code replication.