drbenvincent / delay-discounting-analysis

Hierarchical Bayesian estimation and hypothesis testing for delay discounting tasks
http://www.inferencelab.com/delay-discounting-analysis/
MIT License
23 stars 9 forks source link

add discounting function to STAN models #162

Closed drbenvincent closed 7 years ago

drbenvincent commented 7 years ago

We already have some user-defined functions psychometric_function and df_hyperbolic1, but we can also extract a new discounting function out of the transformed parameters block.

I first tried to add a custom sampling function (e.g. R ~ discounting_hyperbolic(...) but didn't have much luck, even when following the advice of this paper:

Annis, J., Miller, B. J., & Palmeri, T. J. (2016). Bayesian inference with Stan: A tutorial on adding custom distributions. Behavior Research Methods, 1–24. http://doi.org/10.3758/s13428-016-0746-9

So this might act as a stepping stone towards that

drbenvincent commented 7 years ago

Unexpected side-effect of this was to break model.get_inferred_present_subjective_values(). This was picked up by the unit tests :) But I was slack and didn't run them :(

It's because VA and VB are now in a private user-defined function, they aren't able to be monitored.

Solutions:

drbenvincent commented 7 years ago

I've reverted back so that now VA and VB are available to monitor and get the values of.

This was a big waste of time. I should have run the tests.