Stan Math Library
4.9.0
Automatic Differentiation
|
|
inline |
The log of the first passage time density function for a (Wiener) drift diffusion model with up to 7 parameters, where \(y\in \mathbb{R}_{+}\) is the reacion time, \(a \in \mathbb{R}_{+}\) the boundary separation, \(t_0 \in \mathbb{R}_{\geq 0}\) the non-decision time, \(w \in (0, 1)\) the relative starting point (aka a-priori bias), \(v \in \mathbb{R}\) the drifte rate, \(s_v \in \mathbb{R}_{\geq 0}\) the inter-trial variability of the drift rate, \(s_w \in [0, 1)\) the inter-trial variability of the relative starting point, and \(s_{t_0} \in \mathbb{R}_{\geq 0}\) the inter-trial variability of the non-decision time.
\begin{eqnarray*} y &\sim& \text{wiener_full}(a,t_0,w,v,s_v,s_w,s_{t_0}) \\ \log(p(y|a,v,w,t_0,s_v,s_w,s_{t_0})) &=& \log(\frac{1}{s_{t_0}} \int_{t_0}^{t_o + s_{t_0}} \frac{1}{s_{w}}\int_{w -0.5s_w}^{w + 0.5s_{w}} \int_{-\infty}^{\infty} p_3(y-\tau_0|a,\nu,\omega) \\ &&\times\frac{1}{\sqrt{2\pi s_\nu^2}} \mathbb{e}^{-\frac{(\nu-v)^2}{2s_\nu^2}} \ d\nu \ d\omega \ d\tau_0) \\ &=& \log(\frac{1}{s_{t_0}} \int_{t_0}^{t_o + s_{t_0}} \frac{1}{s_{w}}\int_{w -0.5s_w}^{w + 0.5s_{w}} M \times p_3(y-\tau_0|a,v,\omega) \ d\omega \ d\tau_0), \end{eqnarray*}
where \(M\) and \(p_3()\) are defined, by using \(t:=y-\tau_0\), as
\begin{eqnarray*} M &:=& \frac{1}{\sqrt{1+s^2_v t}} \mathbb{e}^{av\omega+\frac{v^2t}{2}+\frac{s^2_v a^2 \omega^2-2av\omega-v^2t}{2(1+s^2_vt)}} \text{ and} \\ p_3(t|a,v,w) &:=& \frac{1}{a^2} \mathbb{e}^{-a v w -\frac{v^2t}{2}} f(\frac{t}{a^2}|0,1,w), \end{eqnarray*}
where \(f(t^*=\frac{t}{a^2}|0,1,w)\) has two forms
\begin{eqnarray*} f_l(t^*|0,1,w) &=& \sum_{k=1}^{\infty} k\pi \mathbb{e}^{-\frac{k^2\pi^2t^*}{2}} \sin{(k \pi w)}\text{ and} \\ f_s(t^*|0,1,w) &=& \sum_{k=-\infty}^{\infty} \frac{1}{\sqrt{2\pi (t^*)^3}} (w+2k) \mathbb{e}^{-\frac{(w+2k)^2}{2t^*}}, \end{eqnarray*}
which are selected depending on the number of components \(k\), needed to guarantee a certain precision.
Note that the parameterization for non-decision time and relative starting point is as follows: t0
is the lower bound of the variability interval; w
is the mean of the variability interval.
See Details below for more details on how to use wiener_lpdf()
.
T_y | type of scalar |
T_a | type of boundary separation |
T_t0 | type of non-decision time |
T_w | type of relative starting point |
T_v | type of drift rate |
T_sv | type of inter-trial variability of drift rate |
T_sw | type of inter-trial variability of relative starting point |
T_st0 | type of inter-trial variability of non-decision time |
y | A scalar variable; the reaction time in seconds |
a | The boundary separation |
t0 | The non-decision time |
w | The relative starting point |
v | The drift rate |
sv | The inter-trial variability of the drift rate |
sw | The inter-trial variability of the relative starting point |
st0 | The inter-trial variability of the non-decision time |
precision_derivatives | Level of precision in estimation of partial derivatives |
std::domain_error | if non-decision time t0 is greater than reaction time y . |
std::domain_error | if 1-sw/2 is smaller than or equal to w . |
std::domain_error | if sw/2 is larger than or equal to w . |
Details
The function can be called by
or
By default wiener_lpdf()
gives the log of the Wiener first-passage time probability density function for the upper response boundary. To use the lower response boundary v
and w
must be changed to -v
and (1-w), respectively.
sv
, sw
, st0
, and t0
can be set to zero, indicating no inter-trial variability in \(v\), no inter-trial variability in \(w\), no inter-trial variability in \(t_0\), and no non-decision time, respectively. If t0
is zero, st0
must be zero as well. For example, when no inter-trial variability for the relative starting point is needed one can write something like:
If no inter-trial variability is needed at all one can write something like:
If for some reason no non-decision time is assumed one can write something like:
If only inter-trial variability for the drift rate is needed can write something like:
To also control the precision in the estimation of the partial derivatives:
References
Definition at line 320 of file wiener_full_lpdf.hpp.