Closed DominiqueMakowski closed 1 year ago
I would like to add DDM to the list of models at some point, the main stumbling block for me is that I don't understand the numerical techniques used to deal with the divergent, oscillating sum in the pdf of the DDM. Do you happen to be familiar with those details?
not at all sadly, I am just slowly getting into these models.
As a matter of fact, I discovered some of them thanks to this package. If you want, I could make a PR to add a couple of references to the README so that people can check out the papers related to each model. As well as a section for "How to use these models" with some examples in Turing, but that might be best in a GH documentation page.
That is awesome. I would definitely appreciate a PR with those changes.
Do you happen to be familiar with those details?
But maybe some inspiration can be found in the C code of Rwiener (scr/pwiener.c)
Not a bad idea. For the pdf, I belief you need dweiner.c. The main limitation is that this simplified version of the DDM does not have cross trial drift rate variability which is important for accounting for speed differences between correct and incorrect responses.
As inspiration for the full DDM, you might consider https://github.com/rtdists/rtdists/blob/master/src/Density.h
I'm not familiar with C++, but it might not be too bad. Given that loops are not problematic in Julia, I think much of the translation would be direct. However, to prevent licencing conflicts, I think it would require implementing the concept rather than a direct translation. I'll put it on my list of projects for this summer. I welcome a PR if you would like something sooner.
@itsdfish Thanks for the work you have done so far! Really excited to see what comes of this project and happy to help where I can.
To compute the likelihood of the DDM, the most commonly used implementation is:
Navarro, D., & Fuss, I. (2009). Fast and accurate calculations for first-passage times in Wiener diffusion models. https://doi.org/10.1016/J.JMP.2009.02.003
The Ratcliff Diffusion model (which allows for cross-trial variability in bias, drift, and ndt) has been implemented using both Navarro & Fuss and an additional integration over parameter ranges (as linked by @DominiqueMakowski ).
Other places that provide relevant implementations are: hddm: https://github.com/hddm-devs/hddm/blob/master/src/pdf.pxi pyddm: https://github.com/mwshinn/PyDDM/blob/master/pyddm/analytic.py Other places: https://github.com/DrugowitschLab/dm
In Julia, work has been done to implement these sorts of methods. However, the project is no longer maintained (related to Drugowitsch's work mentioned above):
https://github.com/DrugowitschLab/DiffModels.jl/blob/master/src/fpt.jl
I propose we adapt what has been done in DiffModels.jl to SequentialSamplingModels.jl. I am not very familiar with licensing, but I noticed that DiffModels.jl is under the MIT license. Let me know if I can be of any help. Happy to work on an implamentation.
Thank you for these resources. They are very helpful, especially DiffModels.jl, which has an MIT license. My understanding based on this thread is that the GNU (see also, GPL) license is "viral", meaning if you use or significantly copy from a source that has a GNU license it will supercede the MIT licence for the new package and all packages using it as a dependency. As you can see, it creates a mess and no one will want to use the package.
I appreciate your offer to help. I think I will have some time to devote to this sometime during June. I think my approach will be to copy the pdf method in DiffModels.jl
and compare the output to the same approach in R or Python. My guess is it should be fairly straight forward if DiffModels is implemented correctly, but I will definitely reach out if I have an unexpected problem.
Just a quick update: I have been working through my To Do list. I added the LCA and added proper documentation. I looked at Navarro, D., & Fuss, I. (2009) and DiffModels.jl and realized they are using diffusion models without variability in drift rate, starting point, and non-decision time. In my opinion, the model without those sources of variability have limited utility because they cannot account for RT differences in correct and incorrect responses. In the meantime, I did implement the generative model of the DDM. As time permits, I will take a closer look into code that integrates out the drift rate, starting point, and non-decision time variability in the pdf.
FWIW... I am working on implementing the Wiener Diffusion Model in Julia for quite some time, also based on the Distribution.jl API. Here is my repo: https://github.com/t-alfers/WienerDiffusionModel.jl. I will also like to extend the package by allowing for inter-trial variability but don't need it badly for my research needs right now.
Nice work all, it seems like there's a dynamic going on here! From a user standpoint, it would be really neat to have all of these models in the same package though... I am talking out of my depth here, as I'm not even a maintainer or contributor of anything 😅, but just to have an idea @t-alfers how would you feel about some possible integration & collaboration between your package and this one?
I agree with @DominiqueMakowski. @t-alfers, I also believe that it would be highly beneficial for the community to have a centralized repository for sequential sampling model implementations. If you would like, I would even be more than happy to start writing the pull request to get the integration started. I will credit you for what you have already implemented for the Diffusion model implementation, and then we can proceed to extend it to handle cases involving across-trial variability in the parameters.
@kiante-fernandez, that sounds great! I welcome a PR to that effect.
@kiante-fernandez sounds good to me, too. Go ahead! ;)
I am also going to get started on the DDM.md file for the documentation as well. Otherwise, once @itsdfish reviews the PR, I think we can move to close this issue.
Hi @kiante-fernandez. Thanks for these changes!
So far I think this looks good. I just a few minor changes to request. First, can you please index the choices as 1 and 2 to be consistent with the other models? Second, can you add a bit of information in the doc strings about the parameterization of the model and suggest reasonable default parameters for the constructor? DDM(1.0, .5, .30, .25)
might be in the ballpark, but perhaps you can do better. In the docs, can you include information about the scaling of diffusion noise (some people set it to 0.10 while others set it to 1.0), and the how the starting point is parameterized relative to the decision boundaries? My guess is that one boundary is 0 and the other is alpha, but I am not certain.
Once you make those changes, I'll add some tests and then bump the version. Thanks again!
This is now implemented, so I'll close this issue.
A really big thank you to @itsdfish @t-alfers and @kiante-fernandez for your reactivity and impressive work. I think Julia + SequentialSamplingModels might have the potential of becoming the next go-to gold-standard approach when fitting these models ☺️ Looking forward to see how it evolves!
Side little question, does this package implements (or plans to add) tools for simple DDMs based on Wiener distributions? From my googling it doesn't seem to exist in Julia yet