| cswald | R Documentation |
Censored-Shifted Wald Model
cswald(rt, response, links = NULL, version = c("simple", "crisk"), ...)
rt |
The name of the variable in the dataset containing the response times. Response times should be coded in seconds (not milliseconds). |
response |
The name of the variable in the dataset containing the response/decision. Responses should be coded as 0 (lower boundary) or 1 (upper boundary). Alternatively, character values "lower" and "upper" or logical values (FALSE/TRUE) are accepted and will be converted automatically. |
links |
A named list of link functions for the model parameters.
Available parameters depend on the version: "simple" has |
version |
A character string specifying which version of the cswald model to use. Options are:
For more details, see Miller et al. (2018). |
... |
Additional arguments passed internally (for testing purposes). |
Domain: Decision Making / Response times
Task: Choice Reaction Time tasks (with few errors)
Name: Censored-Shifted Wald Model
Citation:
Miller, R., Scherbaum, S., Heck, D. W., Goschke, T., & Enge, S. (2018). On the relation between the (censored) shifted Wald and the Wiener distribution as measurement models for choice response times. Applied Psychological Measurement, 42(2), 116-135. https://doi.org/10.1177/0146621617710465
Version: simple
Requirements:
Reaction times should be passed in seconds
The response variable should be passed numerically: 0 = lower response, 1 = upper response
Parameters:
drift: drift rate
bound: boundary (distance from starting point to correct boundary, half the boundary separation bound of version "crisk", ddm() and ezdm())
ndt: non-decision time
s: diffusion constant
Fixed parameters:
mu = 0
s = 0
Default parameter links:
drift = log; bound = log; ndt = log; s = log
Default priors:
drift:
main: normal(0,1)
effects: normal(0,0.3)
sd: exponential(2)
bound:
main: normal(0,0.3)
effects: normal(0,0.3)
sd: exponential(2)
ndt:
main: normal(-2,0.3)
effects: normal(0,0.3)
sd: exponential(2)
s:
main: normal(0,0.3)
effects: normal(0,0.2)
sd: exponential(2)
ndt and the fastest responsendt has to stay below every response the model fits: all responses in
version "crisk", the correct ones in "simple", which censors errors.
bmm() and update() warn when more than half of the prior for ndt lies
at or above the fastest of these responses. Sampling can then fail to
start, and the data pull ndt down against the prior. With the default
prior, normal(-2, 0.3) on the log scale, this happens when the fastest
response is faster than 0.135 s. Set a prior with a lower location, as the
warning suggests, or filter out anticipations. The check reads normal()
and student_t() priors on the intercept of ndt, or on each cell of a
formula without an intercept such as ndt ~ 0 + cond; other priors and
designs are not checked, and neither are truncated priors or the links
"inverse" and "logm1". In a formula with other fixed effects, such as
ndt ~ 1 + cond, the prior on the intercept is the prior on the centred
intercept (the grand mean), and the check compares it with the fastest
response overall. update() with init or inits skips the check, while
bmm() with init still runs it.
An object of class bmmodel
dcswald() and rcswald() for the density and random generation
functions.
# generate simulated data from the diffusion model
dat <- rcswald(n = 500, drift = 2, bound = 1.5, ndt = 0.3, zr = 0.5, s = 1)
# specify the model
model <- cswald(rt = "rt", response = "response", version = "simple")
# specify the formula
formula <- bmf(
drift ~ 1,
bound ~ 1,
ndt ~ 1
)
# fit the model
fit <- bmm(
formula = formula,
data = dat,
model = model,
cores = 4,
backend = "cmdstanr"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.