cdf: Find cumulative distribution function (CDF) values for a...

Description Usage Arguments Details Examples

Description

cdf takes a data frame for a single experimental condition and returns a vector of requested CDF values.

Usage

1
2
cdf(data, quantiles = c(0.1, 0.3, 0.5, 0.7, 0.9), correctTrials = 1,
  multipleSubjects = TRUE)

Arguments

data

A data frame containing the data to be passed to the function. At the very least, the data frame must contain columns named "accuracy" logging the accuracy (1 for correct, 0 for error) and "rt" containing the response time data. If the user wishes to find the average CDFs across multiple subjects, then another column must be included ("subject") with numbers identifying unique subjects. See ?exampleData for a data frame formatted correctly.

quantiles

The quantile values to be found by the function. By default, the function finds the .1, .3, .5, .7, and .9 CDF values.

correctTrials

If set to 1, the function will find the CDFs of correct trials. Set to 2 to find the CDFs of error trials. Set to 3 to find CDFs of ALL trials. Note, though, that CDFs of error trials may be less accurate due to usually-low number of error trials.

multipleSubjects

Inform the function whether the data frame contains data from multiple subjects. If set to TRUE, the function returns the average CDF values across all subjects. If set to FALSE, the function assumes all data being passed is just from one subject.

Details

The function only deals with one experimental condition. There is another function (cdfAll) which will return CDFs for all experimental conditions. If there are more than one subject in the data frame being passed to this function, the function first finds the CDF values for each subject, and then takes the average for each quantile. This average is then returned to the user.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
### example of multiple subjects and default quantile values

# only select the congruent data from the example data set
data <- subset(exampleData, exampleData$congruency == "congruent")

# get the CDFs
getCDF <- cdf(data)

### example of single subject and different quantile values

# only select subject 1 from the example data. Also, select only the
# "absent" condition and incongruent trials. This is an example when working
# with multiple conditions (besides target congruency).
data <- subset(exampleData, exampleData$subject == 1 &
    exampleData$condition == "absent" &
    exampleData$congruency == "incongruent")

# set new quantile values
newQuantiles <- c(.1, .2, .3, .4, .5, .6, .7, .8,  .9)

# get the CDFs
getCDF <- cdf(data, quantiles = newQuantiles, multipleSubjects = FALSE)

JimGrange/flankr documentation built on May 7, 2019, 10:51 a.m.