Open alashworth opened 5 years ago
Comment by bob-carpenter
Tuesday Aug 23, 2016 at 12:37 GMT
I take it this requires all four flavors of function:
_lp
: has access to density so target +=
and ~
statements may be used (only callable in model block)_rng
: has access to PRNG, so _rng
functions may be used (only callable in generated quantities block)_lpdf
, _lpmf
, _lcdf
, _lccdf
: pdf and pmf may be used on right-hand side of sampling statements, called with vertical bar notation (can be used anywhere, but sampling sttements restricted to model block) Comment by bgoodri
Tuesday Aug 23, 2016 at 13:05 GMT
I would think that the possible types would be the same as for global functions the user defines.
On Aug 23, 2016 8:37 AM, "Bob Carpenter" notifications@github.com wrote:
I take it this requires all four flavors of function:
-
_lp : has access to density so target += and ~ statements may be used
_rng: has access to PRNG, so _rng functions may be used
_lpdf, _lpmf : may be used on right-hand side of sampling statements
none-of-the-above: can't do any of the above, but may be used anywhere
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/stan-dev/stan/issues/2024#issuecomment-241716731, or mute the thread https://github.com/notifications/unsubscribe-auth/ADOrqgdP7qATtcDAKQZjQtp7N4QczV5jks5qiumPgaJpZM4Jqg88 .
Summary:
The Stan language should have the ability to create user-defined member functions of the model class
Description:
At the last meeting, we proposed adding a new block to the Stan language that perhaps could be called
local functions
that would go aftertransformed data
. The Stan syntax would be the same as in thefunctions
block but unlike the user-defined functions in thefunctions
block the user-defined functions in thelocal functions
block could refer to objects in thedata
andtransformed data
blocks without explicitly passing them as arguments. This would make such functions much easier to use thanintegrate_ode
, which requires fixed arguments to be passed in a very clunky way. It might look likeReproducible Steps:
Does not currently exist.
Current Output:
Does not currently exist.
Expected Output:
Whatever the user-defined function returns
Additional Information:
None
Current Version:
v2.11.0