Before Ben comes to rescue, there are few things missing from the implementation. For instance, myqgamma
needs a “pstream” argument, like so
double myqgamma(double p, double shape, double scale, std::ostream* pstream__) {
...
}
Also, if shape
and scale
vary, i.e., are estimated parameters, you’ll need to implement them as var
so they can be autodiffed with respect to.
Take a look at this thread for some details.
I also think the stan program needs to define myqgamma
before it’s used, like so:
functions {
real mygamma(real p, real shape, real scale);
real standard_normal_rng() {
return normal_rng(0,1);
}
}
....