dmcFitDE {DMCfun}R Documentation

dmcFitDE

Description

Fit theoretical data generated from dmcSim to observed data by minimizing the root-mean-square error (RMSE) between a weighted combination of the CAF and CDF functions using the R-package DEoptim. Alternative cost functions include squared percentage error ("SPE"), and g-squared statistic ("GS").

Usage

dmcFitDE(
  resOb,
  nTrl = 1e+05,
  minVals = list(),
  maxVals = list(),
  fixedFit = list(),
  freeCombined = list(),
  nCAF = 5,
  nDelta = 19,
  pDelta = vector(),
  tDelta = 1,
  deltaErrors = FALSE,
  costFunction = "RMSE",
  spDist = 1,
  drOnset = 0,
  drDist = 0,
  drShape = 3,
  drLim = c(0.1, 0.7),
  bndsRate = 0,
  bndsSaturation = 0,
  rtMax = 5000,
  deControl = list(),
  numCores = 2
)

Arguments

resOb

Observed data (see flankerData and simonTask for data format)

nTrl

The number of trials to use within dmcSim.

minVals

Minimum values for the to-be estimated parameters. This is a list with values specified individually for amp, tau, drc, bnds, resMean, resSD, aaShape, spShape, sigm (e.g., minVals = list(amp = 10, tau = 5, drc = 0.1, bnds = 20, bndsRate=0, bndsSaturation=0, resMean = 200, resSD = 5, aaShape = 1, spShape = 2, spBias = -20, sigm = 1)).

maxVals

Maximum values for the to-be estimated parameters. This is a list with values specified individually for amp, tau, drc, bnds, resMean, resSD, aaShape, spShape, sigm (e.g., maxVals = list(amp = 40, tau = 300, drc = 1.0, bnds = 150, bndsRate=1, bndsSaturation=500, resMean = 800, resSD = 100, aaShape = 3, spShape = 4, spBias = 20, sigm = 10))

fixedFit

Fix parameter to starting value. This is a list with bool values specified individually for amp, tau, drc, bnds, resMean, resSD, aaShape, spShape, spBias, sigm (e.g., fixedFit = list(amp = F, tau = F, drc = F, bnds = F, bndsRate=T, bndsSaturation=T, resMean = F, resSD = F, aaShape = F, spShape = F, spBias = T, sigm = T)) NB. Value if fixed at startVals.

freeCombined

If fitting 2+ datasets at once, which parameters are allowed to vary between both fits (default = all parameters fixed between the two fits e.g. parameter = F). This is a list with bool values specified individually for amp, tau, drc, bnds, resMean, resSD, aaShape, spShape, spBias, sigm (e.g., freeCombined = list(amp = F, tau = F, drc = F, bnds = F, bndsRate=F, bndsSaturation=F, resMean = F, resSD = F, aaShape = F, spShape = F, spBias = F, sigm = F))

nCAF

The number of CAF bins.

nDelta

The number of delta bins.

pDelta

An alternative option to nDelta (tDelta = 1 only) by directly specifying required percentile values (vector of values 0-100)

tDelta

The type of delta calculation (1=direct percentiles points, 2=percentile bounds (tile) averaging)

deltaErrors

TRUE/FALSE Calculate delta bins for error trials

costFunction

The cost function to minimise: root mean square error ("RMSE": default), squared percentage error ("SPE"), or likelihood-ratio chi-square statistic ("GS")

spDist

The starting point distribution (0 = constant, 1 = beta, 2 = uniform)

drOnset

The starting point of controlled drift rate (i.e., "target" information) relative to automatic ("distractor" information) (> 0 ms)

drDist

The drift rate (dr) distribution type (0 = constant, 1 = beta, 2 = uniform)

drShape

The drift rate (dr) shape parameter

drLim

The drift rate (dr) range

bndsRate

Collapsing bounds rate. 0 (default) = fixed bounds

bndsSaturation

Collapsing bounds saturation

rtMax

The limit on simulated RT (decision + non-decisional components)

deControl

Additional control parameters passed to DEoptim (see DEoptim.control)

numCores

Number of cores to use

Value

dmcfit returns an object of class "dmcfit" with the following components:

sim

Individual trial data points (RTs for all trial types e.g., correct/error trials) and activation vectors from the simulation

summary

Condition means for reaction time and error rate

caf

Conditional Accuracy Function (CAF) data per bin

delta

DataFrame with distributional delta analysis data correct trials (Bin, meanComp, meanIncomp, meanBin, meanEffect)

delta_errs

Optional: DataFrame with distributional delta analysis data incorrect trials (Bin, meanComp, meanIncomp, meanBin, meanEffect)

par

The fitted model parameters + final cost value of the fit

Examples


# The code below can exceed CRAN check time limit, hence donttest
# NB. The following code when using numCores = 2 (default) takes approx 20 minutes on
# a standard desktop, whilst when increasing the number of cores used, (numCores = 12),
# the code takes approx 5 minutes.

# Example 1: Flanker data from Ulrich et al. (2015)
fit <- dmcFitDE(flankerData, nTrl = 1000);
plot(fit, flankerData)
summary(fit)

# Example 2: Simon data from Ulrich et al. (2015)
fit <- dmcFitDE(simonData, nTrl = 5000, deControl = list(itermax=30))
plot(fit, simonData)
summary(fit)


[Package DMCfun version 3.5.4 Index]