fitMultipleDSTP_fixed: Fit the DSTP model to human data with mutiple starting...

Description Usage Arguments Details Value Examples

View source: R/dstpFunctions.R

Description

fitMultipleDSTP_fixed fits the DSTP model to a single experimental condition of human data (besides congruency, which it accounts for simutaneously). This function explores multiple starting parameters and allows user to fix model parameters.

Usage

1
2
3
4
5
fitMultipleDSTP_fixed(data, conditionName = NULL, parms = c(0.145, 0.08,
  0.1, 0.07, 0.325, 1.3, 0.24), var = 10, nParms = 20, cdfs = c(0.1, 0.3,
  0.5, 0.7, 0.9), cafs = c(0.25, 0.5, 0.75), maxParms = c(1, 1, 1, 1, 1, 2,
  1), nTrials = 50000, multipleSubjects = TRUE, fixed = c(FALSE, FALSE,
  FALSE, FALSE, FALSE, FALSE, FALSE))

Arguments

data

A data frame containing human data. See ?exampleData for data formatted correctly.

conditionName

If there is an additional experimental manipulation (i.e., other than target congruency) the model can only be fit to one at a time. Tell the function which condition is currently being fit by passing a string to the function (e.g., "present"). The function by default assumes no additional condition (e.g., conditionName is set to NULL).

parms

A vector of starting parameters to use in the minimisation routine. Must be in the order: A, C, driftTarget, driftFlanker, diftStimSelection, driftRS2, ter. These parameters will be the starting point for the random parameters.

var

An integer stating the percentage of each parameter value that should be used for finding random parameter starting points.

nParms

An integer stating how many random starting points to explore

cdfs

A vector of quantile values for cumulative distribution functions to be estimated from the human data. The model will attempt to find the best-fitting parameters that match this distributional data.

cafs

A vector of quantiles for conditional accuracy functions to be estimated from the human data. The model will attempt to find the best- fitting parameters that match this distributional data.

maxParms

A vector containing upper limits on possible parameter values.

nTrials

An integer stating how many trials to simulate per iteration of the fitting cycle for each congruency type.

multipleSubjects

A boolean stating whether the fit is to multiple subjects (multipleSubjects = TRUE) or to a single subject (multipleSubjects = FALSE).

fixed

A vector of TRUE/FALSE stating whether each parameter should be fixed (TRUE) or free (FALSE) during the fitting routine. Must be in the order: A, C, driftTarget, driftFlanker, diftStimSelection, driftRS2, ter.

Details

This function can be employed by the user to find the best-fitting parameters of the DSTP model to fit the human data of a single experimental condition. The fitting procedure accounts for congruent and incongruent trials simultaneously. The fit is obtained by a gradient-descent method (using the Nelder-Mead method contained in R's optim function) and is fit to the proportion of data contained in human CDF and CAF distributional data. Multiple starting points of parameters are used.

Value

bestParameters A vector of the best-fitting parameters found by the current fit run.

g2 The value of Wilks likelihood ratio (G2) obtained by the current fit run.

bBIC The value of the Bayesian Information Criterion (BIC) obtained by the current fit run. This is calculated using the BIC equation for binned data, hence bBIC (binned BIC).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Load the example data the comes with the \code{flankr} package
data(exampleData)

# Fit the model to the condition "present" in the example data set using
# the default settings in the model.

fit <- fitMultipleDSTP(data = exampleData, conditionName = "present")

# Fit the model whilst fixing the first parameter (A)

parms <- c(0.145, 0.08, 0.1, 0.07, 0.325, 1.3, 0.24)
fixed <- c(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)
fit <- fitMultipleDSTP_fixed(exampleData, conditionName = "present",
                             parms = parms, fixed = fixed)

JimGrange/flankr documentation built on May 8, 2017, 11:29 p.m.