Title: | Derivatives of the First-Passage Time Density and Cumulative Distribution Function, and Random Sampling from the (Truncated) First-Passage Time Distribution |
---|---|
Description: | First, we provide functions to calculate the partial derivative of the first-passage time diffusion probability density function (PDF) and cumulative distribution function (CDF) with respect to the first-passage time t (only for PDF), the upper barrier a, the drift rate v, the relative starting point w, the non-decision time t0, the inter-trial variability of the drift rate sv, the inter-trial variability of the rel. starting point sw, and the inter-trial variability of the non-decision time st0. In addition the PDF and CDF themselves are also provided. Most calculations are done on the logarithmic scale to make it more stable. Since the PDF, CDF, and their derivatives are represented as infinite series, we give the user the option to control the approximation errors with the argument 'precision'. For the numerical integration we used the C library cubature by Johnson, S. G. (2005-2013) <https://github.com/stevengj/cubature>. Numerical integration is required whenever sv, sw, and/or st0 is not zero. Note that numerical integration reduces speed of the computation and the precision cannot be guaranteed anymore. Therefore, whenever numerical integration is used an estimate of the approximation error is provided in the output list. Note: The large number of contributors (ctb) is due to copying a lot of C/C++ code chunks from the GNU Scientific Library (GSL). Second, we provide methods to sample from the first-passage time distribution with or without user-defined truncation from above. The first method is a new adaptive rejection sampler building on the works of Gilks and Wild (1992; <doi:10.2307/2347565>) and Hartmann and Klauer (in press). The second method is a rejection sampler provided by Drugowitsch (2016; <doi:10.1038/srep20490>). The third method is an inverse transformation sampler. The fourth method is a "pseudo" adaptive rejection sampler that builds on the first method. For more details see the corresponding help files. |
Authors: | Raphael Hartmann [aut, cre], Karl C. Klauer [cph, aut, ctb, ths], Steven G. Johnson [ctb], Jean M. Linhart [ctb], Brian Gough [ctb], Gerard Jungman [ctb], Rudolf Schuerer [ctb], Przemyslaw Sliwa [ctb], Jason H. Stover [ctb] |
Maintainer: | Raphael Hartmann <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.3-16 |
Built: | 2025-01-20 04:55:17 UTC |
Source: | https://github.com/raphaelhartmann/wienr |
Calculates the partial derivative of the first-passage time cumulative distribution function of the diffusion model with respect to the upper barrier a.
daWienerCDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
daWienerCDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the partial derivative. Numeric value. Default is |
K |
Optional. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral if sv, sw, and/or st0 are not zero. Default is |
A list of the class Diffusion_deriv
containing
deriv
: the derivatives of the CDF with respect to a,
call
: the function call,
err
: the absolute error. Only provided if sv, sw, or st0 is non-zero. If numerical integration is used, the precision cannot always be guaranteed.
Raphael Hartmann
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
daWienerCDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
daWienerCDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
Calculates the partial derivative of the first-passage time probability density function of the diffusion model with respect to the upper barrier a.
daWienerPDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
daWienerPDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the partial derivative. Numeric value. Default is |
K |
Optional. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral if sv, sw, and/or st0 are not zero. Default is |
A list of the class Diffusion_deriv
containing
deriv
: the derivatives of the PDF with respect to a,
call
: the function call,
err
: the absolute error. Only provided if sv, sw, or st0 is non-zero. If numerical integration is used, the precision cannot always be guaranteed.
Raphael Hartmann
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
daWienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
daWienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
Calculates the partial derivative of the first-passage time probability density function of the diffusion model with respect to one of t, a, v, w, t0, sv, sw, or st0, or calculate the gradient.
ddWDM( wrt, t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
ddWDM( wrt, t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
wrt |
partial derivative w.r.t. one of the following:
|
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the partial derivative. Numeric value. Default is |
K |
Optional. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral if sv, sw, and/or st0 are not zero. Default is |
A list of the class Diffusion_deriv
containing
deriv
: the derivatives of the PDF with respect to the chosen wrt
,
call
: the function call,
err
: the absolute error. Only provided if sv, sw, or st0 is non-zero. If numerical integration is used, the precision cannot always be guaranteed.
Raphael Hartmann
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
ddWDM(wrt = "a", t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
ddWDM(wrt = "a", t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
Calculates the partial derivative of the first-passage time cumulative distribution function of the diffusion model with respect to one of a, v, w, t0, sv, sw, or st0, or calculate the gradient.
dpWDM( wrt, t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
dpWDM( wrt, t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
wrt |
partial derivative w.r.t. one of the following:
|
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the partial derivative. Numeric value. Default is |
K |
Optional. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral if sv, sw, and/or st0 are not zero. Default is |
A list of the class Diffusion_deriv
containing
deriv
: the derivatives of the CDF with respect to the chosen wrt
,
call
: the function call,
err
: the absolute error. Only provided if sv, sw, or st0 is non-zero. If numerical integration is used, the precision cannot always be guaranteed.
Raphael Hartmann
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
dpWDM(wrt = "a", t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
dpWDM(wrt = "a", t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
Calculates the partial derivative of the first-passage time cumulative distribution function of the diffusion model with respect to the inter-trial variability of the non-decision time st0.
dst0WienerCDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
dst0WienerCDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the partial derivative. Numeric value. Default is |
K |
Optional. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral. Default is |
A list of the class Diffusion_deriv
containing
deriv
: the derivatives of the CDF with respect to w,
call
: the function call,
err
: the absolute error.
Raphael Hartmann
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
dst0WienerCDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, t0 = .3, st0 = .1)
dst0WienerCDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, t0 = .3, st0 = .1)
Calculates the partial derivative of the first-passage time probability density function of the diffusion model with respect to the inter-trial variability of the non-decision time st0.
dst0WienerPDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
dst0WienerPDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the partial derivative. Numeric value. Default is |
K |
Optional numeric value. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral. Default is |
A list of the class Diffusion_deriv
containing
deriv
: the derivatives of the PDF with respect to a,
call
: the function call,
err
: the absolute error.
Raphael Hartmann
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
dst0WienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, st0 = .2)
dst0WienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, st0 = .2)
Calculates the partial derivative of the first-passage time cumulative distribution function of the diffusion model with respect to the inter-trial variability of the drift rate sv.
dsvWienerCDF( t, response, a, v, w, t0 = 0, sv, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
dsvWienerCDF( t, response, a, v, w, t0 = 0, sv, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the partial derivative. Numeric value. Default is |
K |
Optional. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral. Default is |
A list of the class Diffusion_deriv
containing
deriv
: the derivatives of the CDF with respect to w,
call
: the function call,
err
: the absolute error.
Raphael Hartmann
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
dsvWienerCDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, sv = .1)
dsvWienerCDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, sv = .1)
Calculates the partial derivative of the first-passage time probability density function of the diffusion model with respect to the inter-trial variability of the drift rate sv.
dsvWienerPDF( t, response, a, v, w, t0 = 0, sv, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
dsvWienerPDF( t, response, a, v, w, t0 = 0, sv, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the partial derivative. Numeric value. Default is |
K |
Optional numeric value. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral. Default is |
A list of the class Diffusion_deriv
containing
deriv
: the derivatives of the PDF with respect to a,
call
: the function call,
err
: the absolute error.
Raphael Hartmann
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
dsvWienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, sv = .2)
dsvWienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, sv = .2)
Calculates the partial derivative of the first-passage time cumulative distribution function of the diffusion model with respect to the inter-trial variability of the relative starting point sw.
dswWienerCDF( t, response, a, v, w, t0 = 0, sv = 0, sw, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
dswWienerCDF( t, response, a, v, w, t0 = 0, sv = 0, sw, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the partial derivative. Numeric value. Default is |
K |
Optional. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral. Default is |
A list of the class Diffusion_deriv
containing
deriv
: the derivatives of the CDF with respect to w,
call
: the function call,
err
: the absolute error.
Raphael Hartmann
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
dswWienerCDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, sw = .1)
dswWienerCDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, sw = .1)
Calculates the partial derivative of the first-passage time probability density function of the diffusion model with respect to the inter-trial variability of the relative starting point sw.
dswWienerPDF( t, response, a, v, w, t0 = 0, sv = 0, sw, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
dswWienerPDF( t, response, a, v, w, t0 = 0, sv = 0, sw, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the partial derivative. Numeric value. Default is |
K |
Optional numeric value. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral. Default is |
A list of the class Diffusion_deriv
containing
deriv
: the derivatives of the PDF with respect to a,
call
: the function call,
err
: the absolute error.
Raphael Hartmann
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
dswWienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, sw = .2)
dswWienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, sw = .2)
Calculates the partial derivative of the first-passage time cumulative distribution function of the diffusion model with respect to the non-decision time t0.
dt0WienerCDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
dt0WienerCDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the partial derivative. Numeric value. Default is |
K |
Optional. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral if sv, sw, and/or st0 are not zero. Default is |
A list of the class Diffusion_deriv
containing
deriv
: the derivatives of the CDF with respect to w,
call
: the function call,
err
: the absolute error. Only provided if sv, sw, or st0 is non-zero. If numerical integration is used, the precision cannot always be guaranteed.
Raphael Hartmann
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
dt0WienerCDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
dt0WienerCDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
Calculates the partial derivative of the first-passage time probability density function of the diffusion model with respect to the non-decision time t0.
dt0WienerPDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
dt0WienerPDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the partial derivative. Numeric value. Default is |
K |
Optional. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral if sv, sw, and/or st0 are not zero. Default is |
A list of the class Diffusion_deriv
containing
deriv
: the derivatives of the PDF with respect to w,
call
: the function call,
err
: the absolute error. Only provided if sv, sw, or st0 is non-zero. If numerical integration is used, the precision cannot always be guaranteed.
Raphael Hartmann
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
dt0WienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6)
dt0WienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6)
Calculates the partial derivative of the first-passage time probability density function of the diffusion model with respect to the first-passage time t.
dtWienerPDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
dtWienerPDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the partial derivative. Numeric value. Default is |
K |
Optional numeric value. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral if sv, sw, and/or st0 are not zero. Default is |
A list of the class Diffusion_deriv
containing
deriv
: the derivatives of the PDF with respect to a,
call
: the function call,
err
: the absolute error. Only provided if sv, sw, or st0 is non-zero. If numerical integration is used, the precision cannot always be guaranteed.
Raphael Hartmann
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
dtWienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
dtWienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
Calculates the partial derivative of the first-passage time cumulative distribution function of the diffusion model with respect to the drift rate v.
dvWienerCDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
dvWienerCDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the partial derivative. Numeric value. Default is |
K |
Optional. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral if sv, sw, and/or st0 are not zero. Default is |
A list of the class Diffusion_deriv
containing
deriv
: the derivatives of the CDF with respect to v,
call
: the function call,
err
: the absolute error. Only provided if sv, sw, or st0 is non-zero. If numerical integration is used, the precision cannot always be guaranteed.
Raphael Hartmann
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
dvWienerCDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
dvWienerCDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
Calculates the partial derivative of the first-passage time probability density function of the diffusion model with respect to the drift rate v.
dvWienerPDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
dvWienerPDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the partial derivative. Numeric value. Default is |
K |
Optional. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral if sv, sw, and/or st0 are not zero. Default is |
A list of the class Diffusion_deriv
containing
deriv
: the derivatives of the PDF with respect to v,
call
: the function call,
err
: the absolute error. Only provided if sv, sw, or st0 is non-zero. If numerical integration is used, the precision cannot always be guaranteed.
Raphael Hartmann
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
dvWienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
dvWienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
Calculates the partial derivative of the first-passage time cumulative distribution function of the diffusion model with respect to the relative starting point w.
dwWienerCDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
dwWienerCDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the partial derivative. Numeric value. Default is |
K |
Optional. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral if sv, sw, and/or st0 are not zero. Default is |
A list of the class Diffusion_deriv
containing
deriv
: the derivatives of the CDF with respect to w,
call
: the function call,
err
: the absolute error. Only provided if sv, sw, or st0 is non-zero. If numerical integration is used, the precision cannot always be guaranteed.
Raphael Hartmann
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
dwWienerCDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
dwWienerCDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
Calculates the partial derivative of the first-passage time probability density function of the diffusion model with respect to the relative starting point w.
dwWienerPDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
dwWienerPDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the partial derivative. Numeric value. Default is |
K |
Optional. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral if sv, sw, and/or st0 are not zero. Default is |
A list of the class Diffusion_deriv
containing
deriv
: the derivatives of the PDF with respect to w,
call
: the function call,
err
: the absolute error. Only provided if sv, sw, or st0 is non-zero. If numerical integration is used, the precision cannot always be guaranteed.
Raphael Hartmann
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
dwWienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
dwWienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
Calculates the gradient of the first-passage time cumulative distribution function.
gradWienerCDF( t, response, a, v, w, t0, sv, sw, st0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
gradWienerCDF( t, response, a, v, w, t0, sv, sw, st0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the partial derivative. Numeric value. Default is |
K |
Optional. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral if sv, sw, and/or st0 are not zero. Default is |
A list of the class Diffusion_deriv
containing
deriv
: the derivatives of the CDF with respect to a, v, w, t0, sv, sw, and st0,
call
: the function call,
err
: the absolute error. Only provided if sv, sw, or st0 is non-zero. If numerical integration is used, the precision cannot always be guaranteed.
Raphael Hartmann
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
gradWienerCDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, t0 = .3, sv = .1, sw = .1, st0 = .1)
gradWienerCDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, t0 = .3, sv = .1, sw = .1, st0 = .1)
Calculates the gradient of the first-passage time probability density function.
gradWienerPDF( t, response, a, v, w, t0, sv, sw, st0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
gradWienerPDF( t, response, a, v, w, t0, sv, sw, st0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the partial derivative. Numeric value. Default is |
K |
Optional. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral if sv, sw, and/or st0 are not zero. Default is |
A list of the class Diffusion_deriv
containing
deriv
: the derivatives of the PDF with respect to a, v, w, t0, sv, sw, and st0,
call
: the function call,
err
: the absolute error. Only provided if sv, sw, or st0 is non-zero. If numerical integration is used, the precision cannot always be guaranteed.
Raphael Hartmann
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
gradWienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, t0 = .3, sv = .1, sw = .1, st0 = .1)
gradWienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, t0 = .3, sv = .1, sw = .1, st0 = .1)
Draws random samples from the (truncated) first-passage time distribution of the Wiener diffusion model with up to 7 parameters.
sampWiener( N, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, response = "both", bound = Inf, method = "ars", precision = NULL, n.threads = 1, ars_list = NULL, ARS_STORE = FALSE ) rWDM( N, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, response = "both", bound = Inf, method = "ars", precision = NULL, n.threads = 1, ars_list = NULL, ARS_STORE = FALSE )
sampWiener( N, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, response = "both", bound = Inf, method = "ars", precision = NULL, n.threads = 1, ars_list = NULL, ARS_STORE = FALSE ) rWDM( N, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, response = "both", bound = Inf, method = "ars", precision = NULL, n.threads = 1, ars_list = NULL, ARS_STORE = FALSE )
N |
Number of samples. Numeric value (integer). |
a |
Upper barrier. Numeric value. |
v |
Drift rate. Numeric value. |
w |
Relative starting point. Numeric value. |
t0 |
Non-decision time. Numeric value. |
sv |
Inter-trial variability of drift rate. Numeric value. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric value. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric value. Range of uniform distribution |
response |
Response boundary. Character string, either |
bound |
Boundary for the first-passage time. Numeric value. Default is Inf. |
method |
Sampling method. Either "ars", "rs", "its", or "p-ars". The method "ars" stands for adaptive rejection sampling, "rs" stands for rejection sampling, "its" stands for inverse transform sampling, and "p-ars" stands for pseudo adaptive rejection sampling. Default is "ars". |
precision |
Optional numeric value. Precision of the infinite series approximation. Numeric value. Default is |
n.threads |
Optional numeric or logic value. Number of threads to use. If not provided ( |
ars_list |
Optional list for method "ars". For |
ARS_STORE |
Optional flag for method "ars". If |
The following methods
can be used:
"ars"
: adaptive rejection sampling method. This method builds on Gilks and Wild (1992) as well as Hartmann and Klauer (in press). The former provides
a method for an adaptive rejection sampling method which assumes that the density is log-concave. This method is fastest for cases where sv = 0
. This is
the only method where the integral needs to be calculated. The advantage, though, is that after each rejection the upper and lower hull functions will be adapted
(or updated), which leads to fewer and fewer rejections in the proceeding sampling steps.
"rs"
: rejection sampling method by Drugowitsch (2016). This method uses different proposal distributions in different conditions.
"its"
: inverse transform (a.k.a. probability integral transform) sampling method. A random sample u is sampled from a uniform
distribution and the corresponding first-passage time, for which CDF(t) = u, is approximated.
"p-ars"
: pseudo-adaptive rejection sampling. A variation of "ars". In this method the hull functions will be adapted until the current sample is drawn,
but the information from this adaptation will be discarded for the next sample.
Note: The speed of the methods do not depend on t0
or st0
.
ars_store
, one of the returned list objects if method "ars"
and ARS_STORE = TRUE
, consists of twelve vectors and three scalars:
hstore_x
: vector of alpha values – change of variable alpha = (log(t)-start)/scale
, where t is the first-passage time – relevant for the upper and
lower hull functions.
hstore_h
: vector of log-density of change of variable A = (log(T)-start)/scale
at the alpha points hstore_x
hstore_dh
: vector of partial derivative of log-density of A with respect to alpha.
upperstore_z
: vector of alpha values at which the piece-wise linear upper hull transitions from one linear segment to the next.
upperstore_slope
: same as hstore_dh
. Gives the slope of the piece-wise linear functions for the upper hull.
upperstore_absc
: same as hstore_h
. Gives the evaluation of the function h() at hstore_x
, where the piece-wise linear function touches h().
upperstore_center
: same as hstore_x
. Gives the alpha values, where the piece-wise linear function touches h().
lowerstore_z
: same as hstore_x
but with an additional leading element (=-Inf) in the vector.
lowerstore_slope
: vector of zeros since not needed.
lowerstore_absc
: vector of zeros since not needed.
lowerstore_center:
: vector of zeros since not needed.
startstore
: scalar representing the "start" value for the change of variable A = (log(T)-start)/scale
.
scalestore
: scalar representing the "scale" value for the change of variable A = (log(T)-start)/scale
.
normstore
: scalar. Gives the value of h() at alpha = 0.
sstore
: vector of values at log(s_k(hstore_x))
, where s_k() is the function defined in equation 3 in Gilks and Wild (1992).
A list of the class Diffusion_samp
containing
q
: first-passage time sample(s),
response
: response(s) "lower" and/or "upper",
call
: the function call,
ars_store
: if ARS_STORE = TRUE
is used with the method "ars" then either a list with upper hull, etc. is stored (either from the upper
or lower boundary) or a list of two lists with corresponding upper hull, etc. is stored (from both boundaries) and can be used as function argument to
(ars_list
) for further sampling with the same parameters.
Raphael Hartmann
Drugowitsch, J. (2016). Fast and accurate Monte Carlo sampling of first-passage times from Wiener diffusion models. Scientific Reports, 6(1). doi:10.1038/srep20490
Gilks, W. R., & Wild, P. (1992). Adaptive Rejection Sampling for Gibbs Sampling. Applied Statistics, 41(2), 337. doi:10.2307/2347565
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
sample_list1 <- sampWiener(N = 100000, a = 1, v = .3, w = .5) hist(sample_list1$q, 200) sample_list2 <- sampWiener(N = 100000, a = 1, v = .3, w = .5, ARS_STORE = TRUE) hist(sample_list2$q, 200) sample_list2$ars_store sample_list3 <- sampWiener(N = 100000, a = 1, v = .3, w = .5, ars_list = sample_list2$ars_store) hist(sample_list3$q, 200) sample_list1 <- rWDM(N = 100000, a = 1, v = .3, w = .5) hist(sample_list1$q, 200) sample_list2 <- rWDM(N = 100000, a = 1, v = .3, w = .5, ARS_STORE = TRUE) hist(sample_list2$q, 200) sample_list2$ars_store sample_list3 <- rWDM(N = 100000, a = 1, v = .3, w = .5, ars_list = sample_list2$ars_store) hist(sample_list3$q, 200)
sample_list1 <- sampWiener(N = 100000, a = 1, v = .3, w = .5) hist(sample_list1$q, 200) sample_list2 <- sampWiener(N = 100000, a = 1, v = .3, w = .5, ARS_STORE = TRUE) hist(sample_list2$q, 200) sample_list2$ars_store sample_list3 <- sampWiener(N = 100000, a = 1, v = .3, w = .5, ars_list = sample_list2$ars_store) hist(sample_list3$q, 200) sample_list1 <- rWDM(N = 100000, a = 1, v = .3, w = .5) hist(sample_list1$q, 200) sample_list2 <- rWDM(N = 100000, a = 1, v = .3, w = .5, ARS_STORE = TRUE) hist(sample_list2$q, 200) sample_list2$ars_store sample_list3 <- rWDM(N = 100000, a = 1, v = .3, w = .5, ars_list = sample_list2$ars_store) hist(sample_list3$q, 200)
Calculates the first-passage time cumulative distribution function of the diffusion model.
WienerCDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 ) pWDM( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
WienerCDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 ) pWDM( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the CDF. Numeric value. Default is |
K |
Optional. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral if sv, sw, and/or st0 are not zero. Default is |
A list of the class Diffusion_cdf
containing
cdf
: the CDF,
logcdf
: the log-transformed CDF,
call
: the function call,
err
: the absolute error. Only provided if sv, sw, or st0 is non-zero. If numerical integration is used, the precision cannot always be guaranteed.
Raphael Hartmann
Blurton, S. P., Kesselmeier, M., & Gondan, M. (2012). Fast and accurate calculations for cumulative first-passage time distributions in Wiener diffusion models. Journal of Mathematical Psychology, 56(6), 470–475. doi:10.1016/j.jmp.2012.09.002
Gondan, M., Blurton, S. P., & Kesselmeier, M. (2014). Even faster and even more accurate first-passage time densities and distributions for the Wiener diffusion model. Journal of Mathematical Psychology, 60, 20–22. doi:10.1016/j.jmp.2014.05.002
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
WienerCDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL) pWDM(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
WienerCDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL) pWDM(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
Calculate the first-passage time probability density function of the diffusion model.
WienerPDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 ) dWDM( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
WienerPDF( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 ) dWDM( t, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
t |
First-passage time. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the PDF. Numeric value. Default is |
K |
Optional. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral if sv, sw, and/or st0 are not zero. Default is |
A list of the class Diffusion_pdf
containing
pdf
: the PDF,
logpdf
: the log-transformed PDF,
call
: the function call,
err
: the absolute error. Only provided if sv, sw, or st0 is non-zero. If numerical integration is used, the precision cannot always be guaranteed.
Raphael Hartmann
Blurton, S. P., Kesselmeier, M., & Gondan, M. (2017). The first-passage time distribution for the diffusion model with variable drift. Journal of Mathematical Psychology, 76, 7–12. doi:10.1016/j.jmp.2016.11.003
Foster, K., & Singmann, H. (2021). Another Approximation of the First-Passage Time Densities for the Ratcliff Diffusion Decision Model. arXiv preprint arXiv:2104.01902.
Gondan, M., Blurton, S. P., & Kesselmeier, M. (2014). Even faster and even more accurate first-passage time densities and distributions for the Wiener diffusion model. Journal of Mathematical Psychology, 60, 20–22. doi:10.1016/j.jmp.2014.05.002
Hartmann, R., & Klauer, K. C. (2021). Partial derivatives for the first-passage time distribution in Wiener diffusion models. Journal of Mathematical Psychology, 103, 102550. doi:10.1016/j.jmp.2021.102550
Navarro, D. J., & Fuss, I. G. (2009). Fast and accurate calculations for first-passage times in Wiener diffusion models. Journal of Mathematical Psychology, 53(4), 222–230. doi:10.1016/j.jmp.2009.02.003
Wabersich, D., & Vandekerckhove, J. (2014). The RWiener Package: an R Package Providing Distribution Functions for the Wiener Diffusion Model. The R Journal, 6(1), 49. doi:10.32614/rj-2014-005
WienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL) dWDM(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
WienerPDF(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL) dWDM(t = 1.2, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
Calculates the first-passage time quantile function of the diffusion model.
WienerQuant( p, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 ) qWDM( p, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
WienerQuant( p, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 ) qWDM( p, response, a, v, w, t0 = 0, sv = 0, sw = 0, st0 = 0, precision = NULL, K = NULL, n.threads = FALSE, n.evals = 6000 )
p |
Probability. Numeric vector. |
response |
Response boundary. Character vector with |
a |
Upper barrier. Numeric vector. |
v |
Drift rate. Numeric vector. |
w |
Relative starting point. Numeric vector. |
t0 |
Non-decision time. Numeric vector |
sv |
Inter-trial variability of drift rate. Numeric vector. Standard deviation of a normal distribution |
sw |
Inter-trial variability of relative starting point. Numeric vector. Range of uniform distribution |
st0 |
Inter-trial variability of non-decision time. Numeric vector. Range of uniform distribution |
precision |
Optional numeric value. Precision of the CDF. Numeric value. Default is |
K |
Optional. Number of iterations to calculate the infinite sums. Numeric value (integer). Default is
We recommend using either default ( |
n.threads |
Optional numerical or logical value. Number of threads to use. If not provided (or 1 or |
n.evals |
Optional. Number of maximal function evaluations in the numeric integral if sv, sw, and/or st0 are not zero. Default is |
A list of the class Diffusion_cdf
containing
q
: the quantile,
logq
: the log-transformed quantile,
call
: the function call,
err
: the absolute error. Only provided if sv, sw, or st0 is non-zero. If numerical integration is used, the precision cannot always be guaranteed.
Raphael Hartmann
WienerQuant(p = .3, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL) qWDM(p = .3, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)
WienerQuant(p = .3, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL) qWDM(p = .3, response = "upper", a = 1.1, v = 2, w = .6, precision = NULL, K = NULL)