Similarity Change Plots, by Group and Pair Type
# 600 ms
###########
#Between-category differences
################################
data_btw600<-droplevels(data[data$cnd=="between" & data$group=="600",])
data_btw_av600<-aggregate(data_btw600$z_resp, list(data_btw600$sbj, data_btw600$session), mean)
colnames(data_btw_av600)<-c("sbj", "session", "z_resp")
#Within-category differences, Relevant Dimension
#################################################
data_w_r600<-droplevels(data[data$cnd=="within" & data$dim=="rel" & data$group=="600",])
data_w_r_av600<-aggregate(data_w_r600$z_resp, list(data_w_r600$sbj, data_w_r600$session), mean)
colnames(data_w_r_av600)<-c("sbj", "session", "z_resp")
#Within-category differences, Irrelevant Dimension
#################################################
data_w_i600<-droplevels(data[data$cnd=="within" & data$dim=="irrel" & data$group=="600",])
data_w_i_av600<-aggregate(data_w_i600$z_resp, list(data_w_i600$sbj, data_w_i600$session), mean)
colnames(data_w_i_av600)<-c("sbj", "session", "z_resp")
#One graph 600 ms
###############################
par(mfrow=c(1,3), oma = c(0, 0, 3, 0))
ylb="Standardized Similarity Ratings"
xlb="Session"
clrs=c("grey25", "grey75")
#between
mn="Between Category Pairs\nRelevant Dimension"
boxplot(data=data_btw_av600, z_resp~session, frame.plot=F, xlab=xlb, ylim=c(-1.5,1.5), ylab=ylb, boxwex=0.5, col=clrs, main =mn, las=1, range=0)
#within, rel
mn="Within Category Pairs\n Relevant Dimension"
boxplot(data=data_w_r_av600, z_resp~session, frame.plot=F, ylim=c(-1.5,1.5), xlab=xlb, ylab="", boxwex=0.5, col=clrs, main =mn, las=1, range=0)
#within, irrel
mn="Within Category Pairs\n Irrelevant Dimension"
boxplot(data=data_w_i_av600, z_resp~session, frame.plot=F, ylim=c(-1.5,1.5), xlab=xlb, ylab="", boxwex=0.5, col=clrs, main =mn, las=1, range=0)
mtext("Group: 600 ms", outer = TRUE, cex = 1.5, font = 1.5)

par(mfrow=c(1,1), oma = c(0, 0, 0, 0))
# 1100 ms
###########
#Between-category differences
################################
data_btw1100<-droplevels(data[data$cnd=="between" & data$group=="1100",])
data_btw_av1100<-aggregate(data_btw1100$z_resp, list(data_btw1100$sbj, data_btw1100$session), mean)
colnames(data_btw_av1100)<-c("sbj", "session", "z_resp")
#Within-category differences, Relevant Dimension
#################################################
data_w_r1100<-droplevels(data[data$cnd=="within" & data$dim=="rel" & data$group=="1100",])
data_w_r_av1100<-aggregate(data_w_r1100$z_resp, list(data_w_r1100$sbj, data_w_r1100$session), mean)
colnames(data_w_r_av1100)<-c("sbj", "session", "z_resp")
#Within-category differences, Irrelevant Dimension
#################################################
data_w_i1100<-droplevels(data[data$cnd=="within" & data$dim=="irrel" & data$group=="1100",])
data_w_i_av1100<-aggregate(data_w_i1100$z_resp, list(data_w_i1100$sbj, data_w_i1100$session), mean)
colnames(data_w_i_av1100)<-c("sbj", "session", "z_resp")
#One graph 1100 ms
###############################
par(mfrow=c(1,3), oma = c(0, 0, 3, 0))
ylb="Standardized Similarity Ratings"
xlb="Session"
clrs=c("grey25", "grey75")
#between
mn="Between Category Pairs\nRelevant Dimension"
boxplot(range=0, data=data_btw_av1100, z_resp~session, frame.plot=F, xlab=xlb, ylim=c(-1.5,1.5), ylab=ylb, boxwex=0.5, col=clrs, main =mn, las=1)
#within, rel
mn="Within Category Pairs\nRelevant Dimension"
boxplot(data=data_w_r_av1100, z_resp~session, frame.plot=F, ylim=c(-1.5,1.5), xlab=xlb, ylab="", boxwex=0.5, col=clrs, main =mn, las=1, range=0)
#within, irrel
mn="Within Category Pairs\nIrrelevant Dimension"
boxplot(data=data_w_i_av1100, z_resp~session, frame.plot=F, ylim=c(-1.5,1.5), xlab=xlb, ylab="", boxwex=0.5, col=clrs, main =mn, las=1, range=0)
mtext("Group: 1100ms", outer = TRUE, cex = 1.5, font = 1.5)

par(mfrow=c(1,1), oma = c(0, 0, 0, 0))
# 1600 ms
###########
#Between-category differences
################################
data_btw1600<-droplevels(data[data$cnd=="between" & data$group=="1600",])
data_btw_av1600<-aggregate(data_btw1600$z_resp, list(data_btw1600$sbj, data_btw1600$session), mean)
colnames(data_btw_av1600)<-c("sbj", "session", "z_resp")
#Within-category differences, Relevant Dimension
#################################################
data_w_r1600<-droplevels(data[data$cnd=="within" & data$dim=="rel" & data$group=="1600",])
data_w_r_av1600<-aggregate(data_w_r1600$z_resp, list(data_w_r1600$sbj, data_w_r1600$session), mean)
colnames(data_w_r_av1600)<-c("sbj", "session", "z_resp")
#Within-category differences, Irrelevant Dimension
#################################################
data_w_i1600<-droplevels(data[data$cnd=="within" & data$dim=="irrel" & data$group=="1600",])
data_w_i_av1600<-aggregate(data_w_i1600$z_resp, list(data_w_i1600$sbj, data_w_i1600$session), mean)
colnames(data_w_i_av1600)<-c("sbj", "session", "z_resp")
#One graph 1600 ms
###############################
par(mfrow=c(1,3), oma = c(0, 0, 3, 0))
ylb="Standardized Similarity Ratings"
xlb="Session"
clrs=c("grey25", "grey75")
#between
mn="Between Category Pairs\nRelevant Dimension"
boxplot(range=0, data=data_btw_av1600, z_resp~session, frame.plot=F, xlab=xlb, ylim=c(-1.5,1.5), ylab=ylb, boxwex=0.5, col=clrs, main =mn, las=1)
#within, rel
mn="Within Category Pairs\nRelevant Dimension"
boxplot(data=data_w_r_av1600, z_resp~session, frame.plot=F, ylim=c(-1.5,1.5), xlab=xlb, ylab="", boxwex=0.5, col=clrs, main =mn, las=1, range=0)
#within, irrel
mn="Within Category Pairs\nIrrelevant Dimension"
boxplot(data=data_w_i_av1600, z_resp~session, frame.plot=F, ylim=c(-1.5,1.5), xlab=xlb, ylab="", boxwex=0.5, col=clrs, main =mn, las=1, range=0)
mtext("Group: 1600ms", outer = TRUE, cex = 1.5, font = 1.5)

par(mfrow=c(1,1), oma = c(0, 0, 0, 0))
# RD
###########
#Between-category differences
################################
data_btwRD<-droplevels(data[data$cnd=="between" & data$group=="RD",])
data_btw_avRD<-aggregate(data_btwRD$z_resp, list(data_btwRD$sbj, data_btwRD$session), mean)
colnames(data_btw_avRD)<-c("sbj", "session", "z_resp")
#Within-category differences, Relevant Dimension
#################################################
data_w_rRD<-droplevels(data[data$cnd=="within" & data$dim=="rel" & data$group=="RD",])
data_w_r_avRD<-aggregate(data_w_rRD$z_resp, list(data_w_rRD$sbj, data_w_rRD$session), mean)
colnames(data_w_r_avRD)<-c("sbj", "session", "z_resp")
#Within-category differences, Irrelevant Dimension
#################################################
data_w_iRD<-droplevels(data[data$cnd=="within" & data$dim=="irrel" & data$group=="RD",])
data_w_i_avRD<-aggregate(data_w_iRD$z_resp, list(data_w_iRD$sbj, data_w_iRD$session), mean)
colnames(data_w_i_avRD)<-c("sbj", "session", "z_resp")
#One graph RD
###############################
par(mfrow=c(1,3), oma = c(0, 0, 3, 0))
ylb="Standardized Similarity Ratings"
xlb="Session"
clrs=c("grey25", "grey75")
#between
mn="Between Category Pairs\nRelevant Dimension"
boxplot(range=0, data=data_btw_avRD, z_resp~session, frame.plot=F, xlab=xlb, ylim=c(-1.5,1.5), ylab=ylb, boxwex=0.5, col=clrs, main =mn, las=1)
#within, rel
mn="Within Category Pairs\nRelevant Dimension"
boxplot(data=data_w_r_avRD, z_resp~session, frame.plot=F, ylim=c(-1.5,1.5), xlab=xlb, ylab="", boxwex=0.5, col=clrs, main =mn, las=1, range=0)
#within, irrel
mn="Within Category Pairs\nIrrelevant Dimension"
boxplot(data=data_w_i_avRD, z_resp~session, frame.plot=F, ylim=c(-1.5,1.5), xlab=xlb, ylab="", boxwex=0.5, col=clrs, main =mn, las=1, range=0)
mtext("Group: RD", outer = TRUE, cex = 1.5, font = 1.5)

par(mfrow=c(1,1), oma = c(0, 0, 0, 0))
Inferential Statistics - ANOVA
#create new factor, condition (pair type) with three levels
data$condition<-as.factor(ifelse(data$cnd=="between", "between", ifelse(data$dim=="rel","within_rel","within_irrel" )))
ezANOVA(data=data, dv=z_resp,wid=sbj, within=.(session,condition), between=group, type=3)
## Warning: Converting "sbj" to factor for ANOVA.
## Warning: Data is unbalanced (unequal N per group). Make sure you specified a
## well-considered value for the type argument to ezANOVA().
## Warning: Collapsing data to cell means. *IF* the requested effects are a subset
## of the full design, you must use the "within_full" argument, else results may
## be inaccurate.
## $ANOVA
## Effect DFn DFd F p p<.05 ges
## 2 group 3 62 3.7559012 1.520923e-02 * 0.011874357
## 3 session 1 62 16.0662403 1.666830e-04 * 0.054446854
## 5 condition 2 124 50.0838474 1.139244e-16 * 0.306755089
## 4 group:session 3 62 0.7917551 5.031027e-01 0.008441181
## 6 group:condition 6 124 3.0500102 8.111371e-03 * 0.074794261
## 7 session:condition 2 124 10.7750489 4.845843e-05 * 0.027694708
## 8 group:session:condition 6 124 0.9414590 4.680054e-01 0.007410834
##
## $`Mauchly's Test for Sphericity`
## Effect W p p<.05
## 5 condition 0.1532633 1.431743e-25 *
## 6 group:condition 0.1532633 1.431743e-25 *
## 7 session:condition 0.4754269 1.415969e-10 *
## 8 group:session:condition 0.4754269 1.415969e-10 *
##
## $`Sphericity Corrections`
## Effect GGe p[GG] p[GG]<.05 HFe
## 5 condition 0.5414957 4.018405e-10 * 0.5435958
## 6 group:condition 0.5414957 3.096786e-02 * 0.5435958
## 7 session:condition 0.6559213 5.552497e-04 * 0.6644302
## 8 group:session:condition 0.6559213 4.432638e-01 0.6644302
## p[HF] p[HF]<.05
## 5 3.749292e-10 *
## 6 3.077382e-02 *
## 7 5.225694e-04 *
## 8 4.440504e-01
#Post-hoc comparisons:
aov_model <- aov_ez(id = "sbj", dv = "z_resp", data = data, within = c("session", "condition"), between = "group", type = 3)
## Warning: More than one observation per design cell, aggregating data using `fun_aggregate = mean`.
## To turn off this warning, pass `fun_aggregate = mean` explicitly.
## Contrasts set to contr.sum for the following variables: group
summary(aov_model)
##
## Univariate Type III Repeated-Measures ANOVA Assuming Sphericity
##
## Sum Sq num Df Error SS den Df F value Pr(>F)
## (Intercept) 5.110 1 7.029 62 45.0764 6.708e-09 ***
## group 1.277 3 7.029 62 3.7559 0.0152092 *
## session 6.121 1 23.620 62 16.0662 0.0001667 ***
## group:session 0.905 3 23.620 62 0.7918 0.5031027
## condition 47.035 2 58.226 124 50.0838 < 2.2e-16 ***
## group:condition 8.593 6 58.226 124 3.0500 0.0081114 **
## session:condition 3.028 2 17.421 124 10.7750 4.846e-05 ***
## group:session:condition 0.794 6 17.421 124 0.9415 0.4680054
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
##
## Mauchly Tests for Sphericity
##
## Test statistic p-value
## condition 0.15326 0.000e+00
## group:condition 0.15326 0.000e+00
## session:condition 0.47543 1.416e-10
## group:session:condition 0.47543 1.416e-10
##
##
## Greenhouse-Geisser and Huynh-Feldt Corrections
## for Departure from Sphericity
##
## GG eps Pr(>F[GG])
## condition 0.54150 4.018e-10 ***
## group:condition 0.54150 0.0309679 *
## session:condition 0.65592 0.0005552 ***
## group:session:condition 0.65592 0.4432638
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## HF eps Pr(>F[HF])
## condition 0.5435958 3.749292e-10
## group:condition 0.5435958 3.077382e-02
## session:condition 0.6644302 5.225694e-04
## group:session:condition 0.6644302 4.440504e-01
emms <- emmeans(aov_model, ~ session |condition*group)
comparisons <- contrast(emms, method = "pairwise", adjust = "bonferroni")
summary(comparisons)
## condition = between, group = 1100:
## contrast estimate SE df t.ratio p.value
## Pre - Post 0.4262 0.181 62 2.350 0.0220
##
## condition = within_irrel, group = 1100:
## contrast estimate SE df t.ratio p.value
## Pre - Post 0.0378 0.158 62 0.240 0.8113
##
## condition = within_rel, group = 1100:
## contrast estimate SE df t.ratio p.value
## Pre - Post 0.1993 0.175 62 1.142 0.2579
##
## condition = between, group = 1600:
## contrast estimate SE df t.ratio p.value
## Pre - Post 0.2905 0.170 62 1.705 0.0932
##
## condition = within_irrel, group = 1600:
## contrast estimate SE df t.ratio p.value
## Pre - Post -0.2067 0.148 62 -1.395 0.1680
##
## condition = within_rel, group = 1600:
## contrast estimate SE df t.ratio p.value
## Pre - Post 0.2454 0.164 62 1.497 0.1396
##
## condition = between, group = 600:
## contrast estimate SE df t.ratio p.value
## Pre - Post 0.4262 0.166 62 2.574 0.0125
##
## condition = within_irrel, group = 600:
## contrast estimate SE df t.ratio p.value
## Pre - Post 0.2660 0.144 62 1.847 0.0695
##
## condition = within_rel, group = 600:
## contrast estimate SE df t.ratio p.value
## Pre - Post 0.3698 0.159 62 2.320 0.0236
##
## condition = between, group = RD:
## contrast estimate SE df t.ratio p.value
## Pre - Post 0.5037 0.176 62 2.868 0.0056
##
## condition = within_irrel, group = RD:
## contrast estimate SE df t.ratio p.value
## Pre - Post -0.0738 0.153 62 -0.483 0.6307
##
## condition = within_rel, group = RD:
## contrast estimate SE df t.ratio p.value
## Pre - Post 0.5062 0.169 62 2.995 0.0039