calculateCAF {DMCfun}R Documentation

calculateCAF

Description

Calculate conditional accuracy function (CAF). The DataFrame should contain columns defining the participant, compatibility condition, RT and error (Default column names: "Subject", "Comp", "RT", "Error"). The "Comp" column should define compatibility condition (Default: c("comp", "incomp")) and the "Error" column should define if the trial was an error or not (Default: c(0, 1) ).

Usage

calculateCAF(
  dat,
  nCAF = 5,
  columns = c("Subject", "Comp", "RT", "Error"),
  compCoding = c("comp", "incomp"),
  errorCoding = c(0, 1)
)

Arguments

dat

DataFrame with columns containing the participant number, condition compatibility, RT data (in ms) and an Error column.

nCAF

Number of CAF bins.

columns

Name of required columns Default: c("Subject", "Comp", "RT", "Error")

compCoding

Coding for compatibility Default: c("comp", "incomp")

errorCoding

Coding for errors Default: c(0, 1))

Value

calculateCAF returns a DataFrame with conditional accuracy function (CAF) data (Bin, comp, incomp, effect)

Examples

# Example 1
dat <- createDF(nSubjects = 1, nTrl = 10000, design = list("Comp" = c("comp", "incomp")))
dat <- addDataDF(dat,
                 RT = list("Comp_comp"   = c(500, 80, 100),
                           "Comp_incomp" = c(600, 80, 140)),
                 Error = list("Comp_comp"   = c( 5, 4, 3, 2, 1),
                              "Comp_incomp" = c(20, 8, 6, 4, 2)))
caf <- calculateCAF(dat)

# Example 2
dat <- createDF(nSubjects = 1, nTrl = 10000, design = list("Congruency" = c("cong", "incong")))
dat <- addDataDF(dat,
                 RT = list("Congruency_cong"   = c(500, 80, 100),
                           "Congruency_incong" = c(600, 80, 140)),
                 Error = list("Congruency_cong"   = c( 5, 4, 3, 2, 1),
                              "Congruency_incong" = c(20, 8, 6, 4, 2)))
head(dat)
caf <- calculateCAF(dat, columns = c("Subject", "Congruency", "RT", "Error"),
                    compCoding = c("cong", "incong"))



[Package DMCfun version 2.0.2 Index]