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: 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 57 2.9180733 4.179359e-02 * 0.009906707
## 3 session 1 57 13.1225571 6.220974e-04 * 0.048932436
## 5 condition 2 114 42.3330979 1.780369e-14 * 0.288107750
## 4 group:session 3 57 0.8059441 4.957776e-01 0.009390649
## 6 group:condition 6 114 2.3418151 3.602935e-02 * 0.062936624
## 7 session:condition 2 114 10.0766925 9.338633e-05 * 0.028583838
## 8 group:session:condition 6 114 0.8783103 5.132696e-01 0.007635503
##
## $`Mauchly's Test for Sphericity`
## Effect W p p<.05
## 5 condition 0.1464522 4.360026e-24 *
## 6 group:condition 0.1464522 4.360026e-24 *
## 7 session:condition 0.4552354 2.695317e-10 *
## 8 group:session:condition 0.4552354 2.695317e-10 *
##
## $`Sphericity Corrections`
## Effect GGe p[GG] p[GG]<.05 HFe
## 5 condition 0.5395059 6.936719e-09 * 0.5416811
## 6 group:condition 0.5395059 7.736925e-02 0.5416811
## 7 session:condition 0.6473478 9.223859e-04 * 0.6560627
## 8 group:session:condition 0.6473478 4.786980e-01 0.6560627
## p[HF] p[HF]<.05
## 5 6.525744e-09 *
## 6 7.708394e-02
## 7 8.713289e-04 *
## 8 4.797683e-01
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) 4.511 1 6.661 57 38.5996 6.430e-08 ***
## group 1.023 3 6.661 57 2.9181 0.0417936 *
## session 5.260 1 22.848 57 13.1226 0.0006221 ***
## group:session 0.969 3 22.848 57 0.8059 0.4957776
## condition 41.376 2 55.712 114 42.3331 1.780e-14 ***
## group:condition 6.867 6 55.712 114 2.3418 0.0360293 *
## session:condition 3.008 2 17.017 114 10.0767 9.339e-05 ***
## group:session:condition 0.787 6 17.017 114 0.8783 0.5132696
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
##
## Mauchly Tests for Sphericity
##
## Test statistic p-value
## condition 0.14645 0.0000e+00
## group:condition 0.14645 0.0000e+00
## session:condition 0.45524 2.6953e-10
## group:session:condition 0.45524 2.6953e-10
##
##
## Greenhouse-Geisser and Huynh-Feldt Corrections
## for Departure from Sphericity
##
## GG eps Pr(>F[GG])
## condition 0.53951 6.937e-09 ***
## group:condition 0.53951 0.0773693 .
## session:condition 0.64735 0.0009224 ***
## group:session:condition 0.64735 0.4786980
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## HF eps Pr(>F[HF])
## condition 0.5416811 6.525744e-09
## group:condition 0.5416811 7.708394e-02
## session:condition 0.6560627 8.713289e-04
## group:session:condition 0.6560627 4.797683e-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.188 57 2.271 0.0269
##
## condition = within_irrel, group = 1100:
## contrast estimate SE df t.ratio p.value
## Pre - Post 0.0378 0.161 57 0.235 0.8149
##
## condition = within_rel, group = 1100:
## contrast estimate SE df t.ratio p.value
## Pre - Post 0.1993 0.179 57 1.112 0.2709
##
## condition = between, group = 1600:
## contrast estimate SE df t.ratio p.value
## Pre - Post 0.2748 0.188 57 1.465 0.1485
##
## condition = within_irrel, group = 1600:
## contrast estimate SE df t.ratio p.value
## Pre - Post -0.2779 0.161 57 -1.728 0.0895
##
## condition = within_rel, group = 1600:
## contrast estimate SE df t.ratio p.value
## Pre - Post 0.2501 0.179 57 1.395 0.1686
##
## condition = between, group = 600:
## contrast estimate SE df t.ratio p.value
## Pre - Post 0.4273 0.182 57 2.352 0.0222
##
## condition = within_irrel, group = 600:
## contrast estimate SE df t.ratio p.value
## Pre - Post 0.2695 0.156 57 1.730 0.0891
##
## condition = within_rel, group = 600:
## contrast estimate SE df t.ratio p.value
## Pre - Post 0.3693 0.174 57 2.127 0.0377
##
## condition = between, group = RD:
## contrast estimate SE df t.ratio p.value
## Pre - Post 0.5111 0.188 57 2.723 0.0086
##
## condition = within_irrel, group = RD:
## contrast estimate SE df t.ratio p.value
## Pre - Post -0.0754 0.161 57 -0.469 0.6409
##
## condition = within_rel, group = RD:
## contrast estimate SE df t.ratio p.value
## Pre - Post 0.4663 0.179 57 2.600 0.0118