Fits Wagenmaker et al.'s (2007) EZ-diffusion model for two-choice response time tasks. To use the function, ensure your dataframe is in long form, has single-trial reaction time (in seconds) and responses (coded as 0 or 1) on each row. You can use the function to fit the EZ-diffusion model to just a single subject or multiple subjects, and separately for each experimental condition (see below for examples).

fit_ezddm(data, rts, responses, id = NULL, group = NULL, decimal = 4)

## Arguments

data data object with reaction time and accuracy variables (long form data expected) specify in characters the name of the reaction time column (reaction time must be in seconds) specify in characters the name of the accuracy column (coded as 0/1) specify in characters the name of your subject/id column (if not specified, assumes data [all rows] belong to a single subject) specify in characters the name of your column(s) indicating various conditions (default = NULL) round parameter estimates (default = 4)

A datatable

## Details

Details to follow

Notes to follow

## See also

ezddm

Hause Lin

## Examples

if (FALSE) {
library(rtdists) # load package to simulate data with diffusion parameters
data1 <- rdiffusion(n = 100, a = 2, v = 0.3, t0 = 0.5, z = 0.5 * 2) # simulate data
data2 <- rdiffusion(n = 100, a = 2, v = -0.3, t0 = 0.5, z = 0.5 * 2) # simulate data
dataAll <- rbind(data1, data2) # join data

dataAll$response <- ifelse(dataAll$response == "upper", 1, 0) # convert responses to 1 and 0
dataAll$subject <- rep(c(1, 2), each = 100) # assign subject id dataAll$cond1 <- base::sample(c("a", "b"), 200, replace = TRUE) # randomly assign conditions a/b
dataAll\$cond2 <- base::sample(c("y", "z"), 200, replace = TRUE) # randomly assign conditions y/z

# fit model to just entire data set (assumes all data came from 1 subject)
fit_ezddm(data = dataAll, rts = "rt", responses = "response")
# fit model to just entire data set (assumes all data came from 1 subject)
fit_ezddm(data = dataAll, rts = "rt", responses = "response", id = "subject")
# fit model to each subject by cond1
fit_ezddm(data = dataAll, rts = "rt", responses = "response", id = "subject", group = "cond1")
# fit model to each subject by cond1,cond2
fit_ezddm(data = dataAll, rts = "rt", responses = "response",
id = "subject", group = c("cond1", "cond2"))
}