Hello,
Is there a recommended way to automate testing for hand-written Stan functions?
For example, say I define a new Stan function:
functions {
real my_square(real x) {
return square(x);
}
I would like to verify that the output of this function is correct for a set of inputs via some sort of automated procedure.
So far, the two options I can think of are:
- Use the
rstaninterface andexpose_stan_functionsto be able to directly call the function in R, at which point the output can be compared to some reference output. - Write a dummy model in Stan that serves only to execute the function on a set of inputs, and then outputs the results via
print. You could perhaps implement this in agenerated datablock, and haveparametersandmodelbe empty. The output could then be read externally and checked against some reference.
Are there any other options I’ve missed?
Thanks,
- Herb