Fit a drift diffusion model for a single subject using maximum likelihood estimation.
Arguments
- data
A data frame with columns
val_imm
andval_del
for the values of the immediate and delayed rewards,del
for the delays,imm_chosen
(Boolean) for whether the immediate rewards were chosen, andrt
for the reaction times (in seconds). Other columns can also be present but will be ignored.- discount_function
A string specifying the name of the discount functions to use, or an object of class
td_fn
(used for creating custom discount functions), or a list of objects of classtd_fn
.- v_par_starts
A vector of starting values to try for the "v" parameter (drift rate multiplier) during optimization.
- beta_par_starts
A vector of starting values to try for the "beta" parameter (bias) during optimization.
- alpha_par_starts
A vector of starting values to try for the "alpha" parameter (boundary separation) during optimization.
- tau_par_starts
A vector of starting values to try for the "tau" parameter (non-decision time) during optimization.
- drift_transform
A transform to apply to drift rates. Either
"none"
(no transform),"sigmoid"
(sigmoidal transform described by Peters & D'Esposito, 2020, doi:10.1371/journal.pcbi.1007615 , and Fontanesi et al., 2019, doi:10.3758/s13423-018-1554-2 ), or"bias-correct"
(experimental; see note below).- silent
Boolean (true by default). The call to
optim()
occurs within atry()
wrapper. The value ofsilent
is passed along totry()
.- optim_args
Additional arguments to pass to
optim()
. Default islist(silent = T)
.
Value
An object of class td_bcnm
with components data
(containing the data used for fitting), config
(containing the internal configuration of the model, including the discount_function
), and optim
(the output of optim()
).
Note
Drift rates are computed based on the difference in subjective values between the immediate and delayed rewards. In theory, when they are equally valued, they should have equal probability of being chosen. However, this is only true when the bias parameter of the drift diffusion model (beta
) is 0.5 (i.e., no bias). To make sure the immediate and delayed reward have equal probability of being chosen when they are equally valued, we can set drift_transform = "bias-correct"
to add a bias correction factor to the drift rate. However, this feature is experimental and its effects on model fit etc. have not been tested.
See also
Other drift diffusion model functions:
coef.td_ddm()
,
deviance.td_ddm()
,
fitted.td_ddm()
,
logLik.td_ddm()
,
predict.td_ddm()
Examples
if (FALSE) { # \dontrun{
data("td_bc_single_ptpt")
mod <- td_ddm(td_bc_single_ptpt, discount_function = "hyperbolic")
} # }