DrugowitschLab / dm

C++ Diffusion model toolset with Python and Matlab interfaces
Other
16 stars 8 forks source link

Leaky Integrator - ddm_rand_sym? #3

Closed ummd closed 7 years ago

ummd commented 7 years ago

Hey Jan,

The examples in ddm_fpt_example demonstrate how to call a "leaky" version of ddm_fpt via the parameter inv_leak:

ddm_fpt_full(mu, sig2, b_lo, b_up, b_lo_deriv, b_up_deriv, delta_t, t_max, [inv_leak])

Does a similar call to ddm_rand_sym exist? (i.e. can I use it to simulate a leaky accumulator?)

ddm_rand_sym(mu, b_lo, b_up, delta_t, n[, seed])

It seems to be restricted to non-leaky versions.

jdrugo commented 7 years ago

Currently, I am not providing a MATLAB interface to sampling a leaky diffusion model version. The basic reason for this is that both ddm_rand_sym and ddm_rand_asym use a fast sampling algorithm that is only accurate for non-leaky diffusion models.

A sampling algorithm for leaky diffusion models is implemented in C++ in ddm_ftp_lib.cpp, line 808, but uses the slow and potentially biased Euler–Maruyama method. I could make it available through a general interface, similar to ddm_fpt_full. Would that help?

ummd commented 7 years ago

Ah, I see.

How biased is Euler-Maruyama? A general method would be useful, probably ok for what I’m doing.

Another possibility would be to use the densities from ddm_fpt, and use Rejection Sampling to generate draws…. Not sure if this would be faster?


Ryan Webb Assistant Professor Rotman School of Management University of Toronto ryan.webb@utoronto.camailto:ryan.webb@utoronto.ca

On Oct 24, 2016, at 4:51 PM, Jan Drugowitsch notifications@github.com<mailto:notifications@github.com> wrote:

Currently, I am not providing a MATLAB interface to sampling a leaky diffusion model version. The basic reason for this is that both ddm_rand_sym and ddm_rand_asym use a fast sampling algorithmhttp://dx.doi.org/10.1038/srep20490 that is only accurate for non-leaky diffusion models.

A sampling algorithm for leaky diffusion models is implemented in C++ in ddm_ftp_lib.cpp, line 808https://github.com/jdrugo/dm/blob/master/src/ddm_fpt_lib.cpp#L808, but uses the slow and potentially biased Euler–Maruyama method. I could make it available through a general interface, similar to ddm_fpt_full. Would that help?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/jdrugo/dm/issues/3#issuecomment-255862319, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AI_KiwGQG7c-jlMLtxh3elGPcutt3jAEks5q3RpGgaJpZM4KfL9a.

jdrugo commented 7 years ago

In my paper where I describe the faster sampling algorithm, there is an illustration of the bias in Fig. 5. Unfortunately, I wouldn't know how to do rejection sampling for leaky integrators as I don't have closed-form expressions for the first-passage densities for that case - I don't think that such an expression exists. The densities could be computed numerically, but it might be faster to just simulate the models instead.

Depending on how much free time I find, I will try to provide a general-purpose sampler in the next days.

ummd commented 7 years ago

Awesome. Will read it tonight.

Rejection Sampling doesn’t require a closed form, you can use numerical distributions (and either interpolate, or use some kernel). People do this all the time in Bayesian Econometrics. I’ll talk to a few people here you use these methods and see which they recommend.

R


Ryan Webb Assistant Professor Rotman School of Management University of Toronto ryan.webb@utoronto.camailto:ryan.webb@utoronto.ca

On Oct 25, 2016, at 2:19 PM, Jan Drugowitsch notifications@github.com<mailto:notifications@github.com> wrote:

I my paper where I describe the faster sampling algorithmhttp://www.nature.com/articles/srep20490, there is an illustration of the bias in Fig. 5. Unfortunately, I wouldn't know how to do rejection sampling for leaky integrators as I don't have closed-form expressions for the first-passage densities for that case - I don't think that such an expression exists. The densities could be computed numerically, but it might be faster to just simulate the models instead.

Depending on how much free time I find, I will try to provide a general-purpose sampler in the next days.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/jdrugo/dm/issues/3#issuecomment-256120626, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AI_Ki9oRJcJD3QxS_CAp1pNHsxuECh7_ks5q3kgtgaJpZM4KfL9a.

jdrugo commented 7 years ago

Sorry for the delay. The SfN annual meeting got in the way.

I have now implemented the Matlab interface to the full (possibly leaky) sampler. You can find it at matlab/ddm_rand_full.cpp. Let me know if you have any problems.