Accuracy Analyses for Learning Session
Data Files
#Libraries
library(itsadug)
library(sciplot)
library(gplots)
library(boot)
library(parallel)
library(dplyr)
library(mgcv)
#Data are in two files, one for the category-learning group, and one for the paired-associate-learning group
#Category learning
dat1<-read.table("train_cat.txt", header=T)
#convert to factor
dat1$sbj<-as.factor(dat1$sbj); dat1$group<-as.factor(dat1$group);dat1$sub<-as.factor(dat1$sub);
dat1$stim<-as.factor(dat1$stim);dat1$corr_resp<-as.factor(dat1$corr_resp);
dat1$cnd<-as.factor(dat1$cnd); dat1$item<-as.factor(dat1$item)
#change name of "stim" to "shape"
names(dat1)[names(dat1) == "stim"] <- "shape"
#re-order based on trial
dat1<-dat1[order(dat1$sbj,dat1$trial),]
#in the DMDX scipt, no response is coded as -10000. Make necessary conversions
dat1$rt<-ifelse(dat1$rt==-10000,NA, dat1$rt)
str(dat1)
## 'data.frame': 6912 obs. of 11 variables:
## $ sbj : Factor w/ 24 levels "aggfyt95","agkxri94",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ trial : int 1 2 3 4 5 6 7 8 9 10 ...
## $ item : Factor w/ 288 levels "11013124","11021423",..: 5 78 222 77 73 2 147 220 145 74 ...
## $ rt : num -4741 -2159 -2570 -3123 2215 ...
## $ group : Factor w/ 1 level "CAT": 1 1 1 1 1 1 1 1 1 1 ...
## $ sub : Factor w/ 8 levels "s1","s2","s3",..: 4 4 4 4 4 4 4 4 4 4 ...
## $ acc : int 0 0 0 0 1 0 0 0 0 1 ...
## $ shape : Factor w/ 4 levels "rand21","rand22",..: 2 3 4 3 3 2 1 4 1 3 ...
## $ stim_ : chr "s4rand22" "s4rand23" "s4rand30" "s4rand23" ...
## $ corr_resp: Factor w/ 4 levels "ideo1","ideo2",..: 2 1 3 1 1 2 4 3 4 1 ...
## $ cnd : Factor w/ 2 levels "ideo","pseudo": 1 1 2 1 1 1 2 2 2 1 ...
# Paired-associate learning
dat2<-read.table("train_pa.txt", header=T)
#convert to factor
dat2$sbj<-as.factor(dat2$sbj); dat2$group<-as.factor(dat2$group);dat2$sub<-as.factor(dat2$sub);
dat2$stim<-as.factor(dat2$stim);dat2$corr_resp<-as.factor(dat2$corr_resp);
dat2$cnd<-as.factor(dat2$cnd); dat2$item<-as.factor(dat2$item)
#change name of "stim" variable to "shape"
names(dat2)[names(dat2) == "stim"] <- "shape"
#re-order based on trial
dat2<-dat2[order(dat2$sbj,dat2$trial),]
#in the DMDX scipt, no response is coded as -10000. Make necessary conversions
dat2$rt<-ifelse(dat2$rt==-10000,NA, dat2$rt)
str(dat2)
## 'data.frame': 6912 obs. of 11 variables:
## $ sbj : Factor w/ 24 levels "agkart97","anakou97",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ trial : int 1 2 3 4 5 6 7 8 9 10 ...
## $ item : Factor w/ 288 levels "11013124","11021423",..: 5 78 222 77 73 2 147 220 145 74 ...
## $ rt : num -1092 -2465 -1631 -1894 699 ...
## $ group : Factor w/ 1 level "PA": 1 1 1 1 1 1 1 1 1 1 ...
## $ sub : Factor w/ 8 levels "s1","s2","s3",..: 3 3 3 3 3 3 3 3 3 3 ...
## $ acc : int 0 0 0 0 1 0 0 0 0 1 ...
## $ shape : Factor w/ 4 levels "rand21","rand22",..: 2 3 4 3 3 2 1 4 1 3 ...
## $ stim_ : chr "s3rand22" "s3rand23" "s3rand30" "s3rand23" ...
## $ corr_resp: Factor w/ 4 levels "ideo1","ideo2",..: 2 1 4 1 1 2 3 4 3 1 ...
## $ cnd : Factor w/ 2 levels "ideo","pseudo": 1 1 2 1 1 1 2 2 2 1 ...
#Combine data into one data frame
dat<-rbind(dat1, dat2)
str(dat)
## 'data.frame': 13824 obs. of 11 variables:
## $ sbj : Factor w/ 48 levels "aggfyt95","agkxri94",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ trial : int 1 2 3 4 5 6 7 8 9 10 ...
## $ item : Factor w/ 288 levels "11013124","11021423",..: 5 78 222 77 73 2 147 220 145 74 ...
## $ rt : num -4741 -2159 -2570 -3123 2215 ...
## $ group : Factor w/ 2 levels "CAT","PA": 1 1 1 1 1 1 1 1 1 1 ...
## $ sub : Factor w/ 8 levels "s1","s2","s3",..: 4 4 4 4 4 4 4 4 4 4 ...
## $ acc : int 0 0 0 0 1 0 0 0 0 1 ...
## $ shape : Factor w/ 4 levels "rand21","rand22",..: 2 3 4 3 3 2 1 4 1 3 ...
## $ stim_ : chr "s4rand22" "s4rand23" "s4rand30" "s4rand23" ...
## $ corr_resp: Factor w/ 4 levels "ideo1","ideo2",..: 2 1 3 1 1 2 4 3 4 1 ...
## $ cnd : Factor w/ 2 levels "ideo","pseudo": 1 1 2 1 1 1 2 2 2 1 ...
Preprocessing
#Count Non-Available Data (missing data points)
#Category learning
sum(is.na(dat[dat$group=="CAT",]$rt))
## [1] 3
#Paired-Associate Learning
sum(is.na(dat[dat$group=="PA",]$rt))
## [1] 4
#Calculate Percentage
(sum(is.na(dat[dat$group=="CAT",]$rt)) + sum(is.na(dat[dat$group=="PA",]$rt)))/length(dat$rt)
## [1] 0.0005063657
#Calculate number of trials with |rt|<250.
# (In DMDX, an incorrect response has a negative rt. Thus, RTs may be positive or negative)
#Category Learning
sum(ifelse((dat[dat$group=="CAT",]$rt<250)&(dat[dat$group=="CAT",]$rt>-250),1,0), na.rm=TRUE)
## [1] 0
#Paired-Associate Learning
sum(ifelse((dat[dat$group=="PA",]$rt<250)&(dat[dat$group=="PA",]$rt>-250),1,0), na.rm=TRUE)
## [1] 5
#Calculate Percentage
sum(ifelse((dat[dat$group=="PA",]$rt<250)&(dat[dat$group=="PA",]$rt>-250),1,0), na.rm=TRUE)/length(dat$rt)
## [1] 0.0003616898
#Convert trials with |rt|<250 to NA
dat$rt<-ifelse(((dat$rt<250)&(dat$rt>-250)),NA, dat$rt)
#... and accordingly adjust the acc column
dat$acc<-NA
dat$acc<-ifelse(dat$rt>0, 1,0)
Descriptive Statistics
#Calculate average performance by participant and group
temp2<-aggregate(acc~sbj+group, data=dat, mean, na.rm=T)
temp2<-temp2[order(temp2$sbj, temp2$group),]
#Category Learning
mean(temp2[temp2$group=='CAT',]$acc)
## [1] 0.8882482
sd(temp2[temp2$group=='CAT',]$acc)
## [1] 0.0574847
#Calculate average performance by condition (label or ideogram categories)
t1<-aggregate(acc~sbj+cnd, data=dat1, mean, na.rm=T)
#Label Categories
mean(t1[t1$cnd=='pseudo',]$acc)
## [1] 0.9050926
sd(t1[t1$cnd=='pseudo',]$acc)
## [1] 0.05728976
#Ideogram Categories
mean(t1[t1$cnd=='ideo',]$acc)
## [1] 0.8706597
sd(t1[t1$cnd=='ideo',]$acc)
## [1] 0.06760277
#Paired-Associate Learning
mean(temp2[temp2$group=='PA',]$acc)
## [1] 0.8826085
sd(temp2[temp2$group=='PA',]$acc)
## [1] 0.0556735
#Calculate average performance by condition (label or ideogram pairings)
t2<-aggregate(acc~sbj+cnd, data=dat2, mean, na.rm=T)
#Label pairs
mean(t2[t2$cnd=='pseudo',]$acc)
## [1] 0.8790509
sd(t2[t2$cnd=='pseudo',]$acc)
## [1] 0.06468979
#Ideogram pairs
mean(t2[t2$cnd=='ideo',]$acc)
## [1] 0.8842593
sd(t2[t2$cnd=='ideo',]$acc)
## [1] 0.06564698
#Create new data frames, average performance by block of trials, for graphs
#12 blocks of 24 trials
n_blocks<-12
n_parts<-length(levels(dat$sbj))
n_cnds<-2
n_trials_in_block<-24
n_trials_in_block_per_cnd<-n_trials_in_block/n_cnds
block<-rep(1:n_blocks,n_parts)
sbjs<-dat[dat$trial<(n_blocks+1),]$sbj
groups<-dat[dat$trial<(n_blocks+1),]$group
perf_ps<-0; perf_ps[1:(n_parts*n_blocks)]<-0
perf_id<-0; perf_id[1:(n_parts*n_blocks)]<-0
for (i in 1:(n_parts*n_blocks)){
perf_ps[i]<-mean(dat[dat$cnd=="pseudo",]$acc[((i-1)*n_trials_in_block_per_cnd+1):(i*n_trials_in_block_per_cnd)], na.rm=TRUE)
perf_id[i]<-mean(dat[dat$cnd=="ideo",]$acc[((i-1)*n_trials_in_block_per_cnd+1):(i*n_trials_in_block_per_cnd)], na.rm=TRUE)
}
data_bl<-data.frame(sbj=sbjs, block=block, group=groups, perf_ps= perf_ps, perf_id= perf_id)
#First calculate average
with(data_bl,aggregate(perf_ps,list(block,group),mean, na.rm=TRUE, na.action=NULL))->data_gr_ps
with(data_bl,aggregate(perf_id,list(block,group),mean, na.rm=TRUE, na.action=NULL))->data_gr_id
names(data_gr_ps)<-c("block","group", "perf_ps")
names(data_gr_id)<-c("block", "group", "perf_id")
#Then calculate se
with(data_bl,aggregate(perf_ps,list(block, group),se))->data_gr_ps_se
with(data_bl,aggregate(perf_id,list(block, group),se))->data_gr_id_se
names(data_gr_ps_se)<-c("block","group", "perf_ps_se")
names(data_gr_id_se)<-c("block","group", "perf_id_se")
#Data frames for graphs
data_gr<-data.frame(block=data_gr_ps$block, group=data_gr_ps$group, perf_ps=data_gr_ps$perf_ps, perf_id=data_gr_id$perf_id, perf_ps_se=data_gr_ps_se$perf_ps_se, perf_id_se=data_gr_id_se$perf_id_se )
data_gr_CAT<-droplevels(data_gr[data_gr$group=="CAT",])
data_gr_PA<-droplevels(data_gr[data_gr$group=="PA",])
Inferential Statistics - Model Comparison
data<-dat
data$igc <- as.factor(paste(as.character(data$group),as.character(data$cnd),sep=".")) # create variable, "treatment coding".
data$igc<-relevel(data$igc, ref="CAT.pseudo")
levels(data$igc)
## [1] "CAT.pseudo" "CAT.ideo" "PA.ideo" "PA.pseudo"
nc <- detectCores()
cl <- makeCluster(nc-1) # change to nc to use all the cores
#Null Model with no fixed effects
#We thank an anonymous reviewer for suggesting including this null model in the list of models compared
m0<-bam(acc~1 + s(trial) + s(trial, sbj, bs="fs", m=1), data=data, family=binomial)
## Warning in gam.side(sm, X, tol = .Machine$double.eps^0.5): model has repeated 1-
## d smooths of same variable.
gam.check(m0)
##
## Method: fREML Optimizer: perf newton
## full convergence after 4 iterations.
## Gradient range [-4.196447e-08,-1.608689e-10]
## (score 17768.19 & scale 1).
## Hessian positive definite, eigenvalue range [1.239479,26.95136].
## Model rank = 442 / 442
##
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
##
## k' edf k-index p-value
## s(trial) 9.00 4.88 0.95 0.095 .
## s(trial,sbj) 432.00 157.54 0.95 0.085 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#edf is not close to k', so we are ok. We do not need to increase k
summary(m0)
##
## Family: binomial
## Link function: logit
##
## Formula:
## acc ~ 1 + s(trial) + s(trial, sbj, bs = "fs", m = 1)
##
## Parametric coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.3476 0.1321 25.34 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Approximate significance of smooth terms:
## edf Ref.df Chi.sq p-value
## s(trial) 4.884 5.751 315.7 <2e-16 ***
## s(trial,sbj) 157.537 431.000 773.1 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## R-sq.(adj) = 0.373 Deviance explained = 42%
## fREML = 17768 Scale est. = 1 n = 13812
#model with a simple smooth term of trial
m1<- bam(acc~ 1 + group*cnd + s(trial) + s(trial, sbj, bs="fs", m=1), data=data, family=binomial )
## Warning in gam.side(sm, X, tol = .Machine$double.eps^0.5): model has repeated 1-
## d smooths of same variable.
gam.check(m1)
##
## Method: fREML Optimizer: perf newton
## full convergence after 4 iterations.
## Gradient range [-3.042735e-08,-7.040768e-11]
## (score 17724.44 & scale 1).
## Hessian positive definite, eigenvalue range [1.245976,27.287].
## Model rank = 445 / 445
##
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
##
## k' edf k-index p-value
## s(trial) 9.00 4.88 0.94 <2e-16 ***
## s(trial,sbj) 432.00 157.46 0.94 0.01 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#edf is not close to k' and p is not low so we are ok. We do not need to increase k
#plot.gam(m1,pages=1)
summary(m1)
##
## Family: binomial
## Link function: logit
##
## Formula:
## acc ~ 1 + group * cnd + s(trial) + s(trial, sbj, bs = "fs", m = 1)
##
## Parametric coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.21648 0.19243 16.715 < 2e-16 ***
## groupPA 0.07052 0.26693 0.264 0.792
## cndpseudo 0.54875 0.09708 5.653 1.58e-08 ***
## groupPA:cndpseudo -0.63142 0.13420 -4.705 2.54e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Approximate significance of smooth terms:
## edf Ref.df Chi.sq p-value
## s(trial) 4.882 5.747 313.7 <2e-16 ***
## s(trial,sbj) 157.458 430.000 777.1 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## R-sq.(adj) = 0.376 Deviance explained = 42.4%
## fREML = 17724 Scale est. = 1 n = 13812
compareML(m0,m1)
## m0: acc ~ 1 + s(trial) + s(trial, sbj, bs = "fs", m = 1)
##
## m1: acc ~ 1 + group * cnd + s(trial) + s(trial, sbj, bs = "fs", m = 1)
##
## Chi-square test of fREML scores
## -----
## Model Score Edf Difference Df p.value Sig.
## 1 m0 17768.19 5
## 2 m1 17724.44 8 43.747 3.000 < 2e-16 ***
##
## AIC difference: 31.09, model m1 has lower AIC.
#m1 is preferred
# add a term modeling four smooth terms of trial, one for each igc level
m2 <- bam(acc~ 1 + group*cnd + s(trial) + s(trial,by=igc) + s(trial, sbj, bs="fs", m=1), data=data, family=binomial )
## Warning in gam.side(sm, X, tol = .Machine$double.eps^0.5): model has repeated 1-
## d smooths of same variable.
gam.check(m2)
##
## Method: fREML Optimizer: perf newton
## full convergence after 10 iterations.
## Gradient range [-3.341551e-05,6.949634e-06]
## (score 17828.13 & scale 1).
## Hessian positive definite, eigenvalue range [5.764332e-06,27.10877].
## Model rank = 480 / 481
##
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
##
## k' edf k-index p-value
## s(trial) 9.00e+00 4.87e+00 0.93 0.035 *
## s(trial):igcCAT.pseudo 9.00e+00 2.79e-05 0.93 0.025 *
## s(trial):igcCAT.ideo 9.00e+00 1.00e+00 0.93 0.010 **
## s(trial):igcPA.ideo 9.00e+00 1.00e+00 0.93 0.045 *
## s(trial):igcPA.pseudo 9.00e+00 1.00e+00 0.93 0.035 *
## s(trial,sbj) 4.32e+02 1.57e+02 0.93 0.035 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#p is not low, so we do not need to increase k
#plot.gam(m2,pages=1)
summary(m2)
##
## Family: binomial
## Link function: logit
##
## Formula:
## acc ~ 1 + group * cnd + s(trial) + s(trial, by = igc) + s(trial,
## sbj, bs = "fs", m = 1)
##
## Parametric coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.1408 0.1995 15.742 < 2e-16 ***
## groupPA 0.1408 0.2824 0.498 0.618153
## cndpseudo 0.8479 0.1985 4.272 1.93e-05 ***
## groupPA:cndpseudo -0.9417 0.2481 -3.796 0.000147 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Approximate significance of smooth terms:
## edf Ref.df Chi.sq p-value
## s(trial) 4.868e+00 5.730e+00 183.617 <2e-16 ***
## s(trial):igcCAT.pseudo 2.793e-05 5.409e-05 0.000 0.5000
## s(trial):igcCAT.ideo 1.000e+00 1.000e+00 3.070 0.0798 .
## s(trial):igcPA.ideo 1.000e+00 1.000e+00 1.215 0.2704
## s(trial):igcPA.pseudo 1.000e+00 1.000e+00 1.319 0.2507
## s(trial,sbj) 1.571e+02 4.300e+02 769.756 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Rank: 480/481
## R-sq.(adj) = 0.376 Deviance explained = 42.5%
## fREML = 17828 Scale est. = 1 n = 13812
compareML(m1,m2)
## m1: acc ~ 1 + group * cnd + s(trial) + s(trial, sbj, bs = "fs", m = 1)
##
## m2: acc ~ 1 + group * cnd + s(trial) + s(trial, by = igc) + s(trial,
## sbj, bs = "fs", m = 1)
##
## Model m1 preferred: lower fREML score (103.685), and lower df (8.000).
## -----
## Model Score Edf Difference Df
## 1 m2 17828.13 16
## 2 m1 17724.44 8 103.685 -8.000
##
## AIC difference: -0.85, model m1 has lower AIC.
# m1 is preferred
fm<-m1
# to check the difference in accuracy between the label and ideogram pairings we need to re-level the group factor
levels(data$group)
## [1] "CAT" "PA"
data$group_<-relevel(data$group, ref="PA")
levels(data$group_)
## [1] "PA" "CAT"
m1_<- bam(acc~ 1 + group_*cnd + s(trial) + s(trial, sbj, bs="fs", m=1), data=data, family=binomial )
## Warning in gam.side(sm, X, tol = .Machine$double.eps^0.5): model has repeated 1-
## d smooths of same variable.
summary(m1_)
##
## Family: binomial
## Link function: logit
##
## Formula:
## acc ~ 1 + group_ * cnd + s(trial) + s(trial, sbj, bs = "fs",
## m = 1)
##
## Parametric coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.28699 0.18947 17.348 < 2e-16 ***
## group_CAT -0.07052 0.26693 -0.264 0.792
## cndpseudo -0.08267 0.09264 -0.892 0.372
## group_CAT:cndpseudo 0.63142 0.13420 4.705 2.54e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Approximate significance of smooth terms:
## edf Ref.df Chi.sq p-value
## s(trial) 4.882 5.747 313.7 <2e-16 ***
## s(trial,sbj) 157.458 430.000 777.1 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## R-sq.(adj) = 0.376 Deviance explained = 42.4%
## fREML = 17724 Scale est. = 1 n = 13812
gam.check(m1_)
##
## Method: fREML Optimizer: perf newton
## full convergence after 4 iterations.
## Gradient range [-3.042745e-08,-7.036505e-11]
## (score 17724.44 & scale 1).
## Hessian positive definite, eigenvalue range [1.245976,27.287].
## Model rank = 445 / 445
##
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
##
## k' edf k-index p-value
## s(trial) 9.00 4.88 0.96 0.24
## s(trial,sbj) 432.00 157.46 0.96 0.18
Graph
par(mfrow=c(1,2), oma = c(0, 0, 2, 0))
offs<-1
color<-c("red", "blue", "red" ,"blue"); colorsmooth<-c("#D0A0A0","#A0A0D0","#D0A0A0","#A0A0D0")
lintyp<-c("solid", "solid", "solid", "solid"); linwid=c(2,2, 2,2);pchar=c(15,17,15,17)
#CAT
#model estimates
plot_smooth(fm, view="trial", cond=list(group="CAT",cnd="pseudo"), rm.ranef=c("s(trial,sbj)"),shade=T,se=1.96,#1.96,#0
print.summary=F, ylim=c(0,1),transform=inv.logit, xlab="Trial", ylab="Proportion Correct", lwd=2, las=2, rug=FALSE, col=colorsmooth[1], lty=lintyp[1], add=F, hide.label=T, main="Category Learning", yaxs="i",xaxt="n", yaxt="n")
plot_smooth(fm, view="trial", cond=list(group="CAT",cnd="ideo"), rm.ranef=c("s(trial,sbj)"),shade=T, se=1.96,#1.96,#0,
print.summary=F,ylim=c(0,1),transform=inv.logit, xlab="Trial", ylab="Proportion Correct",xaxt="n",lwd=2, las=2, rug=FALSE, col=colorsmooth[2], lty=lintyp[2], add=T )
axis(side = 2, at = 0:10/10, labels = c("0.0", 1:9/10.0, "1.0"), las=2, cex.axis = 0.8)
axis(side = 1, at= c(0, 50,100,150,200,250, 288), cex.axis=0.8)
leg<-c("Label Categories", "Ideogram Categories")
legend(x=80, y=0.65, legend=leg, lty=lintyp, bty="n", col=colorsmooth, lwd=linwid, seg.len=2.0)
legend(x=70, y=0.65, legend=c("", ""), bty="n", col=color, pch=pchar)
#Data
plotCI(data_gr_CAT$block*24-12-offs, data_gr_CAT$perf_ps, uiw=data_gr_CAT$perf_ps_se, gap=0, col=color[1], pch=pchar[1],add=T)
plotCI(data_gr_CAT$block*24-12+offs, data_gr_CAT$perf_id, uiw=data_gr_CAT$perf_id_se, gap=0, col=color[2], pch=pchar[2],add=T)
#PA
#model estimates
plot_smooth(fm, view="trial", cond=list(group="PA",cnd="pseudo"), rm.ranef=c("s(trial,sbj)"),shade=T,se=1.96,#1.96,#0
print.summary=F, ylim=c(0,1),transform=inv.logit, xlab="Trial", ylab="Proportion Correct", lwd=2, las=2, rug=FALSE, col=colorsmooth[3], lty=lintyp[1], add=F, hide.label=T, main="Paired-Associate Learning", yaxs="i", xaxt="n", yaxt="n")
plot_smooth(fm, view="trial", cond=list(group="PA",cnd="ideo"), rm.ranef=c("s(trial,sbj)"),shade=T, se=1.96,#1.96,#0,
print.summary=F,ylim=c(0,1),transform=inv.logit, xlab="Trial", ylab="Proportion Correct",xaxt="n",lwd=2, las=2, rug=FALSE, col=colorsmooth[4], lty=lintyp[2], add=T )
axis(side = 2, at = 0:10/10, labels = c("0.0", 1:9/10.0, "1.0"), las=2, cex.axis = 0.8)
axis(side = 1, at= c(0, 50,100,150,200,250, 288), cex.axis=0.8)
leg<-c("Label Pairings", "Ideogram Pairings")
legend(x=80, y=0.65, legend=leg, lty=lintyp, bty="n", col=colorsmooth, lwd=linwid, seg.len=2.0)
legend(x=70, y=0.65, legend=c("", ""), bty="n", col=color, pch=pchar)
#Data
plotCI(data_gr_PA$block*24-12-offs, data_gr_PA$perf_ps, uiw=data_gr_PA$perf_ps_se, gap=0, col=color[3], pch=pchar[3],add=T)
plotCI(data_gr_PA$block*24-12+offs, data_gr_PA$perf_id, uiw=data_gr_PA$perf_id_se, gap=0, col=color[4], pch=pchar[4],add=T)
mtext('Learning Session, Accuracy', outer = TRUE, cex = 1.2, font =2)

par(mfrow=c(1,1))
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] parallel stats graphics grDevices utils datasets methods
## [8] base
##
## other attached packages:
## [1] dplyr_1.0.9 boot_1.3-28 gplots_3.1.3 sciplot_1.2-0
## [5] itsadug_2.4.1 plotfunctions_1.4 mgcv_1.8-40 nlme_3.1-157
##
## loaded via a namespace (and not attached):
## [1] highr_0.9 pillar_1.7.0 bslib_0.3.1 compiler_4.2.1
## [5] jquerylib_0.1.4 bitops_1.0-7 tools_4.2.1 digest_0.6.29
## [9] tibble_3.1.7 lifecycle_1.0.1 jsonlite_1.8.0 evaluate_0.15
## [13] lattice_0.20-45 pkgconfig_2.0.3 rlang_1.0.2 Matrix_1.4-1
## [17] cli_3.3.0 rstudioapi_0.13 yaml_2.3.5 xfun_0.31
## [21] fastmap_1.1.0 stringr_1.4.0 knitr_1.39 generics_0.1.2
## [25] sass_0.4.1 vctrs_0.4.1 gtools_3.9.2.2 caTools_1.18.2
## [29] tidyselect_1.1.2 grid_4.2.1 glue_1.6.2 R6_2.5.1
## [33] fansi_1.0.3 rmarkdown_2.14 purrr_0.3.4 magrittr_2.0.3
## [37] ellipsis_0.3.2 htmltools_0.5.2 splines_4.2.1 utf8_1.2.2
## [41] KernSmooth_2.23-20 stringi_1.7.6 crayon_1.5.1