Accuracy Analyses for the Discrimination Session

Data Files

#Data are in two files, one for the category-learning group, and one for the paired-associate-learning group
#Category Learning
data1<-read.table("TrialRep_StimPresentationA2_CAT.txt", header=T)

#Paired-Associate Learning
data2<-read.table("TrialRep_StimPresentationA2_PA.txt", header=T)

#Combine data into one data frame 
data<-rbind(data1, data2)
str(data)
## 'data.frame':    4608 obs. of  17 variables:
##  $ Sbj_name                   : chr  "aggfyt95" "aggfyt95" "aggfyt95" "aggfyt95" ...
##  $ Group                      : chr  "c" "c" "c" "c" ...
##  $ subcondition               : chr  "s4" "s4" "s4" "s4" ...
##  $ IP_LABEL                   : chr  "StimPresentation" "StimPresentation" "StimPresentation" "StimPresentation" ...
##  $ Trial_Number               : int  25 26 27 28 29 30 31 32 33 34 ...
##  $ condition                  : chr  "mixed" "mixed" "ideog" "label" ...
##  $ same_diff                  : chr  "diff" "diff" "same" "same" ...
##  $ cond_left                  : chr  "ideog" "ideog" "ideog" "label" ...
##  $ cond_right                 : chr  "label" "label" "ideog" "label" ...
##  $ Response                   : chr  "Correct" "Correct" "Correct" "Correct" ...
##  $ BLINK_COUNT                : int  1 1 1 1 1 1 1 1 1 2 ...
##  $ FIXATION_COUNT             : int  7 6 9 9 11 9 10 9 6 9 ...
##  $ FIXATION_DURATION_MIN      : chr  "87" "152" "110" "115" ...
##  $ FIXATION_DURATION_MAX      : chr  "756" "1264" "506" "459" ...
##  $ RUN_COUNT                  : int  4 3 6 6 5 4 6 5 3 4 ...
##  $ VISITED_INTEREST_AREA_COUNT: int  2 2 2 2 2 2 2 2 2 2 ...
##  $ RT                         : int  1316 1354 1347 1495 1074 936 1436 1428 1343 1355 ...
#Convert all chr columns to factor:
library(dplyr)
data <- mutate_if(data, is.character, as.factor)

#Rename Group levels
levels(data$Group)<-c("CAT", "PA")
#In Experiment Builder, no response is denoted by a negative RT.  Make necessary conversions 
data$RT<-ifelse(data$RT>0, data$RT, NA)

Preprocessing

#Count Non-Available Data (missing data points)
#Category learning
sum(is.na(data[data$Group=="CAT",]$RT))
## [1] 11
#Paired-Associate Learning
sum(is.na(data[data$Group=="PA",]$RT))
## [1] 5
#Calculate Percentage
(sum(is.na(data[data$Group=="CAT",]$RT)) + sum(is.na(data[data$Group=="PA",]$RT)))/length(data$RT)
## [1] 0.003472222
#Create 'Response' Column
data$Response<-as.factor(ifelse(is.na(data$RT),NA,data$Response))
levels(data$Response)<-c('Correct', 'Wrong')

#Check if there are trials with RT<250ms
sum(ifelse(data$RT<250,1,0), na.rm=TRUE)#no trials with RT< 250 ms
## [1] 0
#Create 'acc' column
data$acc<-ifelse(is.na(data$Response), NA, ifelse(data$Response=='Correct', 1,0))
colnames(data)[1] <- "sbj"
colnames(data)[6] <- "cnd"

Accuracy by Learning Group

# Calculate average performance by participant and group
data_av<-with(data,aggregate(acc,list(sbj, Group),mean, na.rm=TRUE))
colnames(data_av)<-c('sbj','Group', 'acc')
#Category Learning
mean(data_av[data_av$Group=="CAT",]$acc, na.rm=TRUE)
## [1] 0.9812062
sd(data_av[data_av$Group=="CAT",]$acc, na.rm=TRUE)
## [1] 0.01926479
#Paired-Associate Learning
mean(data_av[data_av$Group=="PA",]$acc, na.rm=TRUE)
## [1] 0.9826115
sd(data_av[data_av$Group=="PA",]$acc, na.rm=TRUE)
## [1] 0.01558775
#T-Test
t.test(data_av$acc~data_av$Group)#ns
## 
##  Welch Two Sample t-test
## 
## data:  data_av$acc by data_av$Group
## t = -0.27781, df = 44.08, p-value = 0.7825
## alternative hypothesis: true difference in means between group CAT and group PA is not equal to 0
## 95 percent confidence interval:
##  -0.011599379  0.008788845
## sample estimates:
## mean in group CAT  mean in group PA 
##         0.9812062         0.9826115

Accuracy by Group and Same/Different Trials

# Calculate average performance by participant, group, and same/different
data_samediff2<-with(data,aggregate(acc,list(sbj, same_diff, Group),mean, na.rm=TRUE))
colnames(data_samediff2)<-c('sbj', 'same_diff','Group', 'acc')
#Category Learning
data_samediff_CAT<-droplevels(data_samediff2[data_samediff2$Group=="CAT",] )
#"Same" Trials
mean(data_samediff_CAT[data_samediff_CAT$same_diff=='same',]$acc)
## [1] 0.9720351
sd(data_samediff_CAT[data_samediff_CAT$same_diff=='same',]$acc)
## [1] 0.03307939
#"Different" Trials
mean(data_samediff_CAT[data_samediff_CAT$same_diff=='diff',]$acc)
## [1] 0.9904514
sd(data_samediff_CAT[data_samediff_CAT$same_diff=='diff',]$acc)
## [1] 0.01370844
#Paired-Associate Learning
data_samediff_PA<-droplevels(data_samediff2[data_samediff2$Group=="PA",] )
#"Same" Trials
mean(data_samediff_PA[data_samediff_PA$same_diff=='same',]$acc)
## [1] 0.9791667
sd(data_samediff_PA[data_samediff_PA$same_diff=='same',]$acc)
## [1] 0.02298655
#"Different" Trials
mean(data_samediff_PA[data_samediff_PA$same_diff=='diff',]$acc)
## [1] 0.9860926
sd(data_samediff_PA[data_samediff_PA$same_diff=='diff',]$acc)
## [1] 0.02353335
library(ez)
ezANOVA(data=data_samediff2, dv=acc, wid=sbj, within=c('same_diff'), between=Group, type=3)
## $ANOVA
##            Effect DFn DFd          F          p p<.05          ges
## 2           Group   1  46 0.07525626 0.78506024       0.0008475726
## 3       same_diff   1  46 6.76974821 0.01243223     * 0.0661707338
## 4 Group:same_diff   1  46 1.39169676 0.24418399       0.0143578639
# Thus, there is only an effect of condition.
# Sbjs in both groups were more accurate in 'Different' trials compared to 'Same' trials.

Accuracy by Group and Condition (label vs. ideogram shape)

# Next we explore if accuracy is dependent on whether the shape(s) was(were) label or ideogram.
# This analysis is only possible for trials presenting the same shape, or trials presenting two different label or two different ideogram shapes.

# First, we analyse trials in which the same shape was presented twice ("Same" trials)
# In these trials the type of shape is coded in cnd (: "label" vs. "ideog")

#
temp<-droplevels(data[data$same_diff=='same',])
data_same<-with(temp,aggregate(acc,list(sbj, cnd, Group),mean, na.rm=TRUE))
colnames(data_same)<-c('sbj', 'cnd',"Group", 'acc')

ezANOVA(data=data_same, dv=acc, wid=sbj, within=c('cnd'), between=Group, type=3) #No effect
## $ANOVA
##      Effect DFn DFd           F         p p<.05          ges
## 2     Group   1  46 0.752887419 0.3900678       1.140914e-02
## 3       cnd   1  46 0.001350695 0.9708419       8.658410e-06
## 4 Group:cnd   1  46 0.379152742 0.5410919       2.424626e-03
# Next, we analyse trial presenting two different shapes from the same type (either label or ideogram) 
# Again, the type of shape is coded in cnd (: "label" vs. "ideog")

temp<-droplevels(data[data$same_diff=='diff'& data$cnd!='mixed',])
data_diff<-with(temp,aggregate(acc,list(sbj, cnd, Group),mean, na.rm=TRUE))
colnames(data_diff)<-c('sbj', 'cnd', "Group", 'acc')

ezANOVA(data=data_diff, dv=acc, wid=sbj, within=c('cnd'), between=Group, type=3) #No effect
## $ANOVA
##      Effect DFn DFd         F         p p<.05         ges
## 2     Group   1  46 0.2771084 0.6011319       0.002849003
## 3       cnd   1  46 1.0000000 0.3225420       0.011299435
## 4 Group:cnd   1  46 1.0000000 0.3225420       0.011299435

Session Information

sessionInfo()
## R version 4.2.1 (2022-06-23 ucrt)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 19044)
## 
## Matrix products: default
## 
## locale:
## [1] LC_COLLATE=Greek_Greece.utf8  LC_CTYPE=Greek_Greece.utf8   
## [3] LC_MONETARY=Greek_Greece.utf8 LC_NUMERIC=C                 
## [5] LC_TIME=Greek_Greece.utf8    
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] ez_4.4-0    dplyr_1.0.9
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_1.0.8.3     plyr_1.8.7       nloptr_2.0.3     pillar_1.7.0    
##  [5] bslib_0.3.1      compiler_4.2.1   jquerylib_0.1.4  tools_4.2.1     
##  [9] boot_1.3-28      lme4_1.1-29      digest_0.6.29    gtable_0.3.0    
## [13] jsonlite_1.8.0   evaluate_0.15    lifecycle_1.0.1  tibble_3.1.7    
## [17] nlme_3.1-157     lattice_0.20-45  mgcv_1.8-40      pkgconfig_2.0.3 
## [21] rlang_1.0.2      Matrix_1.4-1     cli_3.3.0        rstudioapi_0.13 
## [25] yaml_2.3.5       xfun_0.31        fastmap_1.1.0    stringr_1.4.0   
## [29] knitr_1.39       generics_0.1.2   vctrs_0.4.1      sass_0.4.1      
## [33] grid_4.2.1       tidyselect_1.1.2 glue_1.6.2       R6_2.5.1        
## [37] fansi_1.0.3      rmarkdown_2.14   minqa_1.2.4      carData_3.0-5   
## [41] reshape2_1.4.4   ggplot2_3.3.6    car_3.1-0        purrr_0.3.4     
## [45] magrittr_2.0.3   MASS_7.3-57      scales_1.2.0     ellipsis_0.3.2  
## [49] htmltools_0.5.2  splines_4.2.1    abind_1.4-5      colorspace_2.0-3
## [53] utf8_1.2.2       stringi_1.7.6    munsell_0.5.0    crayon_1.5.1