Calculate model density for a given set of parameters
1 2 3 4 5
Time grid for density to be calculated on.
Parameter vector where (if
For which response option will the density be calculated? Either 'upper' or 'lower'.
Precision with which the density is calculated. Corresponds roughly to the number of decimals accurately calculated.
Other arguments, see
These functions are examples of what
fun.density should look like.
Voss.density is an adaptation of
LBA.density is an adaptation of
wiener.density is an adaptation of
To improve speed one can remove error handling.
Normally error handling is useful, however
because differential evolution can result in an incredible number of
function evaluations (more than 10.000) it is recommended to omit error handling in custom
estDstarM will apply some internal error checks
testFun) on the density functions before starting differential
evolution. A version of
ddifusion without error handling can be found in
the source code (commented out to pass R check). Note that for in
if DstarM == FALSE nondecision parameters are implemented manually and might differ
from from how they are implemented in other packages. The parameter
specifies the mean of a uniform distribution and
st0 specifies the relative
size of this uniform distribution. To obtain the lower and upper range of the
uniform distribution calculate a = t0 - t0*st0, and b = t0 + t0*st0.
A numeric vector of length
length(t) containing a density.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
t = seq(0, .75, .01) V.pars = c(1, 2, .5, .5, .5) L.pars = c(1, .5, 2, 1, 1, 1) W.pars = V.pars[1:3] V1 = Voss.density(t = t, pars = V.pars, boundary = 'upper', DstarM = TRUE) V2 = Voss.density(t = t, pars = V.pars, boundary = 'lower', DstarM = TRUE) L1 = LBA.density(t = t, pars = L.pars, boundary = 'upper', DstarM = TRUE) L2 = LBA.density(t = t, pars = L.pars, boundary = 'lower', DstarM = TRUE) W1 = Wiener.density(t = t, pars = W.pars, boundary = 'upper', DstarM = TRUE) W2 = Wiener.density(t = t, pars = W.pars, boundary = 'lower', DstarM = TRUE) densities = cbind(V1, V2, L1, L2, W1, W2) matplot(t, densities, type = 'b', ylab = 'Density', lty = 1, las = 1, bty = 'n', col = rep(1:3, each = 2), pch = c(0, 15, 1, 16, 2, 17), cex = .8, main = 'Model densities') legend('topright', legend = c('Voss', 'LBA', 'RWiener'), lty = 1, pch = 15:17, col = 1:3, bty = 'n')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.