ddm_dr_lm: Fit linear predictors of DDM drift rate

View source: R/ddm_dr_lm.R

ddm_dr_lmR Documentation

Fit linear predictors of DDM drift rate

Description

Essentially fits a generalized linear model for a Wiener process, using the density estimation function from the RWiener package. First fits a standard 4-parameter Wiener model to the entire RT+response-category vector. Then uses the boundary separation, bias, and non-decision time from this overall model, and finds the best set of parameters to create a drift rate vector as a linear function of the right-hand side of formIn. Only numeric predictors have been tested.

Usage

ddm_dr_lm(formIn, data, respVar, nBoots = 2, fixBias = NA)

Arguments

formIn

formula. Left hand side should be response time.

data

data

respVar

name of the "boundary" column (argument is character; data must be binary 0 and 1)

nBoots

number of bootstrapped samples for CI of drift rate parameters. Must be an integer >1

fixBias

Optional scalar value to fix the bias [beta] parameter of the Wiener function

Details

Note that, for parameters other than drift rate, the RWiener labeling conventions are used: alpha is boundary separation, tau is non-decision time, and beta is bias.

rt ~ 1 will cause an error; in principle, if a unconditional point estimate of drift rate is desired, a dummy constant numeric variable (e.g., all 0s) could be included as a predictor.

See Also

wdm for the method upon which this is based; brm with family "wiener" for a much better (but slower) option.

Examples

d <- data.frame(rt = .2 + exp(rnorm(50,-.5,.5))
,corr = rbinom(50,1,.5)
,totalTrialNum = 1:50
)
d$stimStr <- d$rt+rnorm(50,d$corr)
m <- ddm_dr_lm(rt ~ totalTrialNum * stimStr, data = d,respVar='corr',nBoots = 30)
m$model


akcochrane/ACmisc documentation built on Nov. 24, 2024, 11:22 a.m.