7. Main analysis
Transform into factors.
data$TrialType <- as.factor(data$TrialType)
data$OnsetType <- as.factor(data$OnsetType)
data$InterferenceType <- as.factor(data$InterferenceType)
data$OnsetTimePoint <- as.factor(data$OnsetTimePoint)
7.1 Interference has a detrimental impact on working-memory performance
7.1.1 Reproduction errors as a function of Trial Type and Interference Type
Collapse reproduction errors by factors Trial Type, Interference Type, and SubjectNo. Calculate summary statistics.
agg_Int <- aggregate(data = data, DevTargetvsReport ~ SubjectNo + TrialType + InterferenceType, mean)
summary_Int <- summarySEwithin(data = agg_Int, measurevar = "DevTargetvsReport", withinvars = c("InterferenceType","TrialType"), idvar = "SubjectNo")
Plot reproduction errors as a function of Trial Type and Interference Type.
ggplot(summary_Int, aes(x = InterferenceType, y = DevTargetvsReport, fill = interaction(TrialType, InterferenceType))) +
geom_bar(stat = "identity", position = position_dodge(width=0.9), color = "black", width = 0.8, size=0.9) +
scale_fill_manual(values=c("#DDE8F8", "#4582D9", "#98BBEB","#235BA9")) +
geom_point(data=agg_Int,aes(group =TrialType), position =position_dodge(width=0.9), size = 1, color = "#1F1F1F", shape = 1, alpha = 0.4) +
geom_errorbar(data=summary_Int, aes(ymin=DevTargetvsReport-se, ymax=DevTargetvsReport+se), width=0.1, position=position_dodge(0.9), size=0.6)+
labs(fill = "Onset Type", x = "Onset Type", y = "Error (in degrees)") +
coord_cartesian(ylim= c(6,36.03))+
labs(fill = "Onset Type", y = "Error (degrees)") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.line = element_line(colour = "black"),
axis.text.x = element_text(size = 15, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 15, color = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
7.1.2 Interference cost (in degrees)
The interference cost of each Interference Type is calculated by taking the difference in reproduction errors between trials with and without interference (Interference - No Interference).
aggDev_DisRand <- agg_Int[agg_Int$InterferenceType == 'Distraction' & agg_Int$TrialType == 'DelayTrial',]
aggDev_DisFix <- agg_Int[agg_Int$InterferenceType == 'Distraction' & agg_Int$TrialType == 'InterferenceTrial',]
aggDev_IntRand <- agg_Int[agg_Int$InterferenceType == 'Interruption' & agg_Int$TrialType == 'DelayTrial',]
aggDev_IntFix <- agg_Int[agg_Int$InterferenceType == 'Interruption' & agg_Int$TrialType == 'InterferenceTrial',]
aggDev_DisDiff <- merge(aggDev_DisFix, aggDev_DisRand, by = 'SubjectNo', sort = F)
aggDev_IntDiff <- merge(aggDev_IntFix, aggDev_IntRand, by = 'SubjectNo', sort = F)
aggDev_DisDiff$diff <- aggDev_DisDiff$DevTargetvsReport.x - aggDev_DisDiff$DevTargetvsReport.y #fixed-random for distractors
aggDev_IntDiff$diff <- aggDev_IntDiff$DevTargetvsReport.x - aggDev_IntDiff$DevTargetvsReport.y #fixed-random for interrupters
aggDev_DisDiff$cond <- 'difference'
aggDev_IntDiff$cond <- 'difference'
aggDev_AllDiff <- rbind(aggDev_DisDiff, aggDev_IntDiff)
names(aggDev_AllDiff )[names(aggDev_AllDiff ) == "InterferenceType.x"] <- "InterferenceType"
names(aggDev_AllDiff )[names(aggDev_AllDiff ) == "TrialType.x"] <- "TrialType"
sum.aggDev_Dis <- data.frame("InterferenceType" = "Distraction", "cond" = 'difference',
"diff" = mean(aggDev_AllDiff$diff[aggDev_AllDiff$InterferenceType == 'Distraction']),
"se" = sd(aggDev_AllDiff$diff[aggDev_AllDiff$InterferenceType == 'Distraction']) / sqrt(length(aggDev_AllDiff$SubjectNo[aggDev_AllDiff$InterferenceType == 'Distraction'])))
sum.aggDev_Int <- data.frame("InterferenceType" = "Interruption", "cond" = 'difference',
"diff" = mean(aggDev_AllDiff$diff[aggDev_AllDiff$InterferenceType == 'Interruption']),
"se" = sd(aggDev_AllDiff$diff[aggDev_AllDiff$InterferenceType == 'Interruption']) / sqrt(length(aggDev_AllDiff$SubjectNo[aggDev_AllDiff$InterferenceType == 'Interruption'])))
sum.aggDev_AllDiff <- rbind(sum.aggDev_Dis, sum.aggDev_Int)
Violin plot depicting the cost of interference for both Interference Types.
ggplot(sum.aggDev_AllDiff, aes(x = InterferenceType, y = diff, fill = InterferenceType, color = InterferenceType)) +
geom_hline(yintercept=0, linetype="dashed", color = "black") +
geom_violin(data = aggDev_AllDiff, size = 1) +
geom_point(size = 2) +
geom_errorbar(data = sum.aggDev_AllDiff, aes(ymin=(diff-se), ymax=(diff+se)), width = .1, size = 0.6) +
geom_point(data = aggDev_AllDiff, size = 1.5, alpha = .3, shape = 1) +
scale_fill_manual(values=c("#FFFFFF", "#FFFFFF")) +
scale_color_manual(values=c("#2868C0", "#2868C0"))+
labs(y = "Interference Cost (degrees)", x= "Interference Type") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.line = element_line(colour = "black"),
axis.text.x = element_text(size = 15, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 15, color = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
7.1.3 Stats (reproduction error)
Repeated-measures ANOVA with factors Trial Type and Interference Type.
ezANOVA(data = agg_Int,
dv = DevTargetvsReport,
wid = SubjectNo,
within = .(InterferenceType, TrialType),
detailed = TRUE,
type = 3)
## $ANOVA
## Effect DFn DFd SSn SSd F
## 1 (Intercept) 1 53 47644.97369 4853.5959 520.27067
## 2 InterferenceType 1 53 514.84415 370.4075 73.66681
## 3 TrialType 1 53 223.70311 220.0991 53.86786
## 4 InterferenceType:TrialType 1 53 48.67688 233.5954 11.04420
## p p<.05 ges
## 1 4.516436e-29 * 0.893521879
## 2 1.326422e-11 * 0.083139387
## 3 1.282077e-09 * 0.037906780
## 4 1.617936e-03 * 0.008500471
Pairwise comparisons to break down interaction effect between Interference Type and Trial Type.
#distraction: interference vs no interference
(DisInt <- pairedSamplesTTest(data = agg_Int[agg_Int$InterferenceType == "Distraction",], DevTargetvsReport ~ TrialType, id = "SubjectNo"))
##
## Paired samples t-test
##
## Outcome variable: DevTargetvsReport
## Grouping variable: TrialType
## ID variable: SubjectNo
##
## Descriptive statistics:
## DelayTrial InterferenceTrial difference
## mean 12.765 13.851 -1.086
## std dev. 4.552 4.380 2.457
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -3.248
## degrees of freedom: 53
## p-value: 0.002
##
## Other information:
## two-sided 95% confidence interval: [-1.756, -0.415]
## estimated effect size (Cohen's d): 0.442
#interruption: interference vs no interference
(IrInt <- pairedSamplesTTest(data = agg_Int[agg_Int$InterferenceType == "Interruption",], DevTargetvsReport ~ TrialType, id = "SubjectNo"))
##
## Paired samples t-test
##
## Outcome variable: DevTargetvsReport
## Grouping variable: TrialType
## ID variable: SubjectNo
##
## Descriptive statistics:
## DelayTrial InterferenceTrial difference
## mean 14.903 17.888 -2.985
## std dev. 5.503 6.078 3.329
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -6.588
## degrees of freedom: 53
## p-value: <.001
##
## Other information:
## two-sided 95% confidence interval: [-3.894, -2.076]
## estimated effect size (Cohen's d): 0.897
#bonferroni correction
p.adjust(c(DisInt$p.value, IrInt$p.value), method = "bonferroni")
## [1] 4.037828e-03 4.150309e-08
7.2 Temporal expectations mitigate interference
Subset data into trials in which interference was presented.
data_noDelay <- data[data$TrialType != "DelayTrial", ]
7.2.1 Reproduction errors as a function of Onset Type and Interference Type
Collapse reproduction errors by factors Onset Type, Interference Type, and SubjectNo. Calculate summary statistics.
aggDev <- aggregate(data = data_noDelay ,DevTargetvsReport ~ SubjectNo + OnsetType + InterferenceType, mean)
summaryDev <- summarySEwithin(data = aggDev, measurevar = "DevTargetvsReport", withinvars = c("OnsetType", "InterferenceType"), idvar = "SubjectNo")
Plot reproduction errors as a function of Interference Type and Onset Type.
ggplot(summaryDev, aes(x = InterferenceType, y = DevTargetvsReport, fill = interaction(OnsetType, InterferenceType))) +
geom_bar(stat = "identity", position = position_dodge(width=0.9), color = "black", width = 0.8, size=0.9) +
scale_fill_manual(values=c("#E66062","#A3A3A3", "#B01C1E", "#666666")) +
geom_point(data=aggDev,aes(group =OnsetType), position =position_dodge(width=0.9), size = 1, color = "#1F1F1F", shape = 1, alpha = 0.4) +
coord_cartesian(ylim = c(8, 37))+
geom_errorbar(data=summaryDev, aes(ymin=DevTargetvsReport-se, ymax=DevTargetvsReport+se), width=0.1, position=position_dodge(0.9), size=0.6)+
labs(fill = "Onset Type", y = "Error (degrees)") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.line = element_line(colour = "black"),
axis.text.x = element_text(size = 15, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 15, color = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
7.2.2 Temporal expectation benefit (in degrees)
The temporal expectation benefit of each Interference Type is calculated by taking the difference in reproduction errors between variable-onset blocks and fixed-onset blocks (Fixed - Variable).
aggDev_DisRand <- aggDev[aggDev$InterferenceType == 'Distraction' & aggDev$OnsetType == 'Random',]
aggDev_DisFix <- aggDev[aggDev$InterferenceType == 'Distraction' & aggDev$OnsetType == 'Fixed',]
aggDev_IntRand <- aggDev[aggDev$InterferenceType == 'Interruption' & aggDev$OnsetType == 'Random',]
aggDev_IntFix <- aggDev[aggDev$InterferenceType == 'Interruption' & aggDev$OnsetType == 'Fixed',]
aggDev_DisDiff <- merge(aggDev_DisFix, aggDev_DisRand, by = 'SubjectNo', sort = F)
aggDev_IntDiff <- merge(aggDev_IntFix, aggDev_IntRand, by = 'SubjectNo', sort = F)
aggDev_DisDiff$diff <- aggDev_DisDiff$DevTargetvsReport.x - aggDev_DisDiff$DevTargetvsReport.y #fixed-random for distractors
aggDev_IntDiff$diff <- aggDev_IntDiff$DevTargetvsReport.x - aggDev_IntDiff$DevTargetvsReport.y #fixed-random for interrupters
aggDev_DisDiff$cond <- 'difference'
aggDev_IntDiff$cond <- 'difference'
aggDev_AllDiff <- rbind(aggDev_DisDiff, aggDev_IntDiff)
names(aggDev_AllDiff )[names(aggDev_AllDiff ) == "InterferenceType.x"] <- "InterferenceType"
names(aggDev_AllDiff )[names(aggDev_AllDiff ) == "OnsetType.x"] <- "OnsetType"
sum.aggDev_Dis <- data.frame("InterferenceType" = "Distraction", "cond" = 'difference',
"diff" = mean(aggDev_AllDiff$diff[aggDev_AllDiff$InterferenceType == 'Distraction']),
"se" = sd(aggDev_AllDiff$diff[aggDev_AllDiff$InterferenceType == 'Distraction']) / sqrt(length(aggDev_AllDiff$SubjectNo[aggDev_AllDiff$InterferenceType == 'Distraction'])))
sum.aggDev_Int <- data.frame("InterferenceType" = "Interruption", "cond" = 'difference',
"diff" = mean(aggDev_AllDiff$diff[aggDev_AllDiff$InterferenceType == 'Interruption']),
"se" = sd(aggDev_AllDiff$diff[aggDev_AllDiff$InterferenceType == 'Interruption']) / sqrt(length(aggDev_AllDiff$SubjectNo[aggDev_AllDiff$InterferenceType == 'Interruption'])))
sum.aggDev_AllDiff <- rbind(sum.aggDev_Dis, sum.aggDev_Int)
Violin plots depicting the temporal expectation benefit for both distractors and interrupters.
ggplot(sum.aggDev_AllDiff, aes(x = InterferenceType, y = diff, fill = InterferenceType, color = InterferenceType)) +
geom_hline(yintercept=0, linetype="dashed", color = "black") +
geom_violin(data = aggDev_AllDiff, size = 1) +
geom_point(size = 2) +
geom_errorbar(data = sum.aggDev_AllDiff, aes(ymin=(diff-se), ymax=(diff+se)), width = .1, size = 0.6) +
geom_point(data = aggDev_AllDiff, size = 1.5, alpha = .3, shape = 1) +
scale_fill_manual(values=c("#FFFFFF", "#FFFFFF")) +
scale_color_manual(values=c("#DE2B2E", "#DE2B2E"))+
labs(y = "Temporal Expectation Benefit (degrees)", x= "Interference Type") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.line = element_line(colour = "black"),
axis.text.x = element_text(size = 15, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 15, color = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
7.2.3 Reproduction errors as a function of Onset Type, Interference Type, and Onset Time Point
Collapse reproduction errors by factors Onset Type, Interference Type, Onset Time Point, and SubjectNo. Calculate summary statistics.
agg_Dev_TP <- aggregate(data = data_noDelay, DevTargetvsReport ~ SubjectNo + OnsetType + InterferenceType + OnsetTimePoint, mean)
agg_Dev_TP[] <- lapply(agg_Dev_TP, function(x) if(is.factor(x)) factor(x) else x)
summary_Dev_TP <- summarySEwithin(data = agg_Dev_TP, measurevar = "DevTargetvsReport", withinvars = c("OnsetType", "InterferenceType", "OnsetTimePoint"), idvar = "SubjectNo")
Plot reproduction errors as a function of Onset Type, Interference Type, and Onset Time Point.
label_names =c('0' = "500 ms", "1" = "1250 ms",'2' = "2000 ms") #change labels for onset time point
ggplot(summary_Dev_TP, aes(x = InterferenceType, y = DevTargetvsReport, fill = interaction(OnsetType, InterferenceType))) +
geom_bar(stat = "identity", position = position_dodge(0.9), color= "black", size = 0.9, width =0.8) +
geom_point(data=aggDev,aes(group =OnsetType), position = position_dodge(0.9), size = 1, color = "#1F1F1F", shape = 1, alpha = 0.4) +
geom_errorbar(data=summary_Dev_TP,aes(ymin=DevTargetvsReport-se, ymax=DevTargetvsReport+se), width=0.1, position=position_dodge(0.9), size=0.6)+
scale_fill_manual("Onset Type", values=c("#E66062", "#A3A3A3","#B01C1E","#666666")) +
facet_wrap(~OnsetTimePoint, scales="free_x", labeller = as_labeller(label_names)) +
coord_cartesian(ylim = c(8, 37))+
labs(fill = "Onset Type", x = "Interference Type", y = "Error (degrees)") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.text.x = element_text(size = 15, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 15, color = "black"),
strip.text.x = element_text(size = 15),
strip.background = element_blank(),
axis.line = element_line(colour = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
7.2.4 Stats (reproduction error)
Repeated-measures ANOVA with factors Interference Type, Onset Type, and Onset Time Point.
ezANOVA(data = agg_Dev_TP,
dv = DevTargetvsReport,
wid = SubjectNo,
within = .(OnsetType, InterferenceType, OnsetTimePoint),
detailed = TRUE,
type = 3)
## $ANOVA
## Effect DFn DFd SSn SSd
## 1 (Intercept) 1 53 1.636379e+05 16175.8625
## 2 OnsetType 1 53 1.137356e+02 686.9912
## 3 InterferenceType 1 53 2.726460e+03 1919.3080
## 4 OnsetTimePoint 2 106 1.154915e+02 1803.0091
## 5 OnsetType:InterferenceType 1 53 5.703386e+00 602.6364
## 6 OnsetType:OnsetTimePoint 2 106 3.093759e+00 1583.5413
## 7 InterferenceType:OnsetTimePoint 2 106 1.101176e+02 1480.0605
## 8 OnsetType:InterferenceType:OnsetTimePoint 2 106 1.071849e+01 1369.4309
## F p p<.05 ges
## 1 536.1574481 2.185874e-29 * 0.8646253339
## 2 8.7744729 4.564823e-03 * 0.0044195631
## 3 75.2887902 9.427470e-12 * 0.0961805860
## 4 3.3949083 3.723117e-02 * 0.0044874896
## 5 0.5015951 4.819034e-01 0.0002225578
## 6 0.1035459 9.017257e-01 0.0001207371
## 7 3.9432401 2.229389e-02 * 0.0042795772
## 8 0.4148293 6.615205e-01 0.0004181755
##
## $`Mauchly's Test for Sphericity`
## Effect W p p<.05
## 4 OnsetTimePoint 0.9198161 0.113821877
## 6 OnsetType:OnsetTimePoint 0.9832806 0.645081022
## 7 InterferenceType:OnsetTimePoint 0.9929855 0.832752525
## 8 OnsetType:InterferenceType:OnsetTimePoint 0.7986064 0.002888365 *
##
## $`Sphericity Corrections`
## Effect GGe p[GG] p[GG]<.05
## 4 OnsetTimePoint 0.9257683 0.04103452 *
## 6 OnsetType:OnsetTimePoint 0.9835555 0.89883630
## 7 InterferenceType:OnsetTimePoint 0.9930344 0.02256113 *
## 8 OnsetType:InterferenceType:OnsetTimePoint 0.8323667 0.62441903
## HFe p[HF] p[HF]<.05
## 4 0.9578291 0.03934636 *
## 6 1.0211454 0.90172570
## 7 1.0315586 0.02229389 *
## 8 0.8560937 0.63010303
Pairwise comparisons to break down main effect of Onset Time Point.
agg_Dev_TP_sep <- aggregate(data = data_noDelay, DevTargetvsReport ~ SubjectNo + OnsetTimePoint, mean)
agg_Dev_TP_sep$OnsetTimePoint <- as.factor(agg_Dev_TP_sep$OnsetTimePoint)
agg_Dev_TP_sep$SubjectNo <- as.factor(agg_Dev_TP_sep$SubjectNo)
#500 ms vs 1250 ms
(Del500_1250 <- pairedSamplesTTest(data = agg_Dev_TP_sep[agg_Dev_TP_sep$OnsetTimePoint != 2,], DevTargetvsReport ~ OnsetTimePoint, id = "SubjectNo"))
##
## Paired samples t-test
##
## Outcome variable: DevTargetvsReport
## Grouping variable: OnsetTimePoint
## ID variable: SubjectNo
##
## Descriptive statistics:
## 0 1 difference
## mean 15.894 15.265 0.628
## std dev. 4.907 5.366 2.386
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: 1.936
## degrees of freedom: 53
## p-value: 0.058
##
## Other information:
## two-sided 95% confidence interval: [-0.023, 1.28]
## estimated effect size (Cohen's d): 0.263
#500 ms vs 2000 ms
(Del500_2000 <- pairedSamplesTTest(data = agg_Dev_TP_sep[agg_Dev_TP_sep$OnsetTimePoint != 1,], DevTargetvsReport ~ OnsetTimePoint, id = "SubjectNo"))
##
## Paired samples t-test
##
## Outcome variable: DevTargetvsReport
## Grouping variable: OnsetTimePoint
## ID variable: SubjectNo
##
## Descriptive statistics:
## 0 2 difference
## mean 15.894 16.190 -0.297
## std dev. 4.907 5.415 3.022
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -0.722
## degrees of freedom: 53
## p-value: 0.474
##
## Other information:
## two-sided 95% confidence interval: [-1.122, 0.528]
## estimated effect size (Cohen's d): 0.098
#1250 ms vs 2000 ms
(Del1250_2000 <- pairedSamplesTTest(data = agg_Dev_TP_sep[agg_Dev_TP_sep$OnsetTimePoint != 0,], DevTargetvsReport ~ OnsetTimePoint, id = "SubjectNo"))
##
## Paired samples t-test
##
## Outcome variable: DevTargetvsReport
## Grouping variable: OnsetTimePoint
## ID variable: SubjectNo
##
## Descriptive statistics:
## 1 2 difference
## mean 15.265 16.190 -0.925
## std dev. 5.366 5.415 3.102
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -2.192
## degrees of freedom: 53
## p-value: 0.033
##
## Other information:
## two-sided 95% confidence interval: [-1.772, -0.079]
## estimated effect size (Cohen's d): 0.298
#bonferroni correction
p.adjust(c(Del500_1250$p.value, Del500_2000$p.value, Del1250_2000$p.value), method = "bonferroni")
## [1] 0.17475373 1.00000000 0.09839738
Pairwise comparisons to break down interaction effect of Interference Type and Onset Time Point.
agg_Dev_TPI <- aggregate(data = data_noDelay, DevTargetvsReport ~ SubjectNo + InterferenceType + OnsetTimePoint, mean)
agg_Dev_TPI[] <- lapply(agg_Dev_TPI, function(x) if(is.factor(x)) factor(x) else x)
#500 ms: distraction vs interruption
(Int500 <- pairedSamplesTTest(data = agg_Dev_TPI[agg_Dev_TPI$OnsetTimePoint == 0,], DevTargetvsReport ~ InterferenceType, id = "SubjectNo"))
##
## Paired samples t-test
##
## Outcome variable: DevTargetvsReport
## Grouping variable: InterferenceType
## ID variable: SubjectNo
##
## Descriptive statistics:
## Distraction Interruption difference
## mean 14.087 17.953 -3.866
## std dev. 4.474 6.338 4.657
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -6.101
## degrees of freedom: 53
## p-value: <.001
##
## Other information:
## two-sided 95% confidence interval: [-5.137, -2.595]
## estimated effect size (Cohen's d): 0.83
#1250 ms: distraction vs interruption
(Int1250 <- pairedSamplesTTest(data = agg_Dev_TPI[agg_Dev_TPI$OnsetTimePoint == 1,], DevTargetvsReport ~ InterferenceType, id = "SubjectNo"))
##
## Paired samples t-test
##
## Outcome variable: DevTargetvsReport
## Grouping variable: InterferenceType
## ID variable: SubjectNo
##
## Descriptive statistics:
## Distraction Interruption difference
## mean 13.711 16.918 -3.207
## std dev. 4.952 6.570 4.230
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -5.572
## degrees of freedom: 53
## p-value: <.001
##
## Other information:
## two-sided 95% confidence interval: [-4.362, -2.053]
## estimated effect size (Cohen's d): 0.758
#2000 ms: distraction vs interruption
(Int2000 <- pairedSamplesTTest(data = agg_Dev_TPI[agg_Dev_TPI$OnsetTimePoint == 2,], DevTargetvsReport ~ InterferenceType, id = "SubjectNo"))
##
## Paired samples t-test
##
## Outcome variable: DevTargetvsReport
## Grouping variable: InterferenceType
## ID variable: SubjectNo
##
## Descriptive statistics:
## Distraction Interruption difference
## mean 13.747 18.871 -5.124
## std dev. 4.680 7.082 4.803
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -7.839
## degrees of freedom: 53
## p-value: <.001
##
## Other information:
## two-sided 95% confidence interval: [-6.435, -3.813]
## estimated effect size (Cohen's d): 1.067
#bonferroni correction
p.adjust(c(Int500$p.value, Int1250$p.value, Int2000$p.value), method = "bonferroni")
## [1] 3.744715e-07 2.582430e-06 6.066810e-10
7.3 The benefit on the working-memory task does not occur at the expense of the intervening task
Subset data in only interrupter-trials.
data_onlyIR <- data[data$InterferenceType == "Interruption" & data$TrialType == "InterferenceTrial", ]
7.3.1 Reaction time to interrupter task as a function of Onset Type
Collapse reaction time to interrupter by factor Onset Type and SubjectNo. Calculate summary statistics.
agg_RT_IR <- aggregate(data = data_onlyIR, IntRT ~ SubjectNo + OnsetType, mean)
summary_RT_IR <- summarySEwithin(data = agg_RT_IR, measurevar = "IntRT", withinvars = c("OnsetType"), idvar = "SubjectNo")
Plot reaction time to interrupter as a function of Onset Type.
ggplot(summary_RT_IR, aes(x = OnsetType, y = IntRT, fill = OnsetType)) +
geom_bar(stat = "identity", position = position_dodge(0.9), color= "black", size = 0.9, width = 0.75) +
geom_point(data=agg_RT_IR,aes(group =OnsetType), position = position_dodge(0.9), size = 1.5, color = "#1F1F1F", shape=1, alpha = 0.4) +
geom_errorbar(data=summary_RT_IR, aes(ymin=IntRT-se, ymax=IntRT+se), width=0.1, position=position_dodge(0.5), size=0.6)+
scale_fill_manual("Onset Type", values=c("#B01C1E", "#666666")) +
scale_x_discrete(breaks=c("Fixed","Random"), labels=c("Fixed", "Variable"))+
coord_cartesian(ylim= c(430,740))+
labs(x = "Onset Type", y = "RT to interrupter (ms)") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.text.x = element_text(size = 15, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 15, color = "black"),
strip.text.x = element_text(size = 15),
strip.background = element_blank(),
axis.line = element_line(colour = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
7.3.2 Temporal expectation benefit in the interrupter task (in ms)
The temporal expectation benefit in the interrupter task is calculated by taking the difference in reproduction errors between variable-onset blocks and fixed-onset blocks (Fixed - Variable).
aggFixRan_Fix <- agg_RT_IR[agg_RT_IR$OnsetType == 'Fixed',]
aggFixRan_Ran <- agg_RT_IR[agg_RT_IR$OnsetType == 'Random',]
aggFixRan_Diff <- merge(aggFixRan_Fix, aggFixRan_Ran, by = 'SubjectNo', sort = F)
aggFixRan_Diff$diff <- aggFixRan_Diff$IntRT.x - aggFixRan_Diff$IntRT.y
aggFixRan_Diff$cond <- 'difference'
names(aggFixRan_Diff)[names(aggFixRan_Diff ) == "OnsetType.x"] <- "OnsetType"
sum.aggFixRan <- data.frame("cond" = 'difference',
"diff" = mean(aggFixRan_Diff$diff),
"se" = sd(aggFixRan_Diff$diff) / sqrt(length(aggFixRan_Diff$SubjectNo)))
Violin plots depicting the temporal expectation benefit for fixed as compared to random onsets of the interrupter.
ggplot(sum.aggFixRan, aes(x = cond, y = diff, fill = cond, color = cond)) +
geom_hline(yintercept=0, linetype="dashed", color = "black") +
geom_violin(data = aggFixRan_Diff, size = 1) +
scale_fill_manual("cond", values="#FFFFFF") +
scale_color_manual("cond", values="#B01C1E") +
geom_point(size = 2) +
geom_errorbar(data = sum.aggFixRan, aes(ymin=(diff-se), ymax=(diff+se)), width = .1, size = 0.6) +
geom_point(data = aggFixRan_Diff, size = 1.5, alpha = .3, shape =1) +
labs(y = "Temporal Expectation Benefit (ms)") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.text.x = element_text(size = 15, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 15, color = "black"),
axis.ticks.x=element_blank(),
axis.line = element_line(colour = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
7.3.3 Reaction time to interrupter task as a function of Onset Type and Onset Time Point
Collapse reaction times to the interrupter by factors Onset Type, Onset Time Point, and SubjectNo. Calculate summary statistics.
agg_RT_IR_TP <- aggregate(data = data_onlyIR, IntRT ~ SubjectNo + OnsetTimePoint + OnsetType, mean)
agg_RT_IR_TP[] <- lapply(agg_RT_IR_TP, function(x) if(is.factor(x)) factor(x) else x)
summary_RT_IR_TP <- summarySEwithin(data = agg_RT_IR_TP, measurevar = "IntRT", withinvars = c("OnsetTimePoint", "OnsetType"), idvar = "SubjectNo")
Plot reaction times to interrupter as a function of Onset Type and Onset Time Point.
label_names =c('0' = "500 ms", "1" = "1250 ms",'2' = "2000 ms")
ggplot(summary_RT_IR_TP, aes(x = OnsetType, y = IntRT, fill = OnsetType)) +
geom_bar(stat = "identity", position = position_dodge(0.9), color= "black", width = 0.85, size = 0.9) +
geom_point(data=agg_RT_IR_TP,aes(group =OnsetType), position = position_dodge(0.9), size = 1, color = "#1F1F1F", shape = 1, alpha = 0.4) +
geom_errorbar(data = summary_RT_IR_TP, aes(ymin=IntRT-se, ymax=IntRT+se), width=0.1, position=position_dodge(0.9), size=0.6)+
scale_fill_manual("Onset Type", values=c("#B01C1E", "#666666")) +
facet_wrap(~OnsetTimePoint, scales="free_x", labeller = as_labeller(label_names)) +
scale_x_discrete(breaks=c("Fixed","Random"), labels=c("Fixed", "Variable"))+
coord_cartesian(ylim= c(420,830))+
labs(x = "Onset Type", y = "RT to interrupter (ms)") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.text.x = element_text(size = 15, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 15, color = "black"),
strip.text.x = element_text(size = 15),
strip.background = element_blank(),
axis.line = element_line(colour = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
7.3.4 Stats (interrupter task)
Repeated-measures ANOVA with factors Onset Type and Onset Time Point.
ezANOVA(data = agg_RT_IR_TP,
dv = IntRT,
wid = SubjectNo,
within = .(OnsetType, OnsetTimePoint),
detailed = TRUE,
type = 3)
## $ANOVA
## Effect DFn DFd SSn SSd F
## 1 (Intercept) 1 53 103774089.98 1456781.62 3775.46415
## 2 OnsetType 1 53 46028.32 76146.68 32.03687
## 3 OnsetTimePoint 2 106 74613.71 252611.52 15.65458
## 4 OnsetType:OnsetTimePoint 2 106 52135.12 175048.76 15.78510
## p p<.05 ges
## 1 6.078957e-51 * 0.98145747
## 2 6.254886e-07 * 0.02293827
## 3 1.104428e-06 * 0.03666157
## 4 9.986675e-07 * 0.02590277
##
## $`Mauchly's Test for Sphericity`
## Effect W p p<.05
## 3 OnsetTimePoint 0.8959843 0.05751893
## 4 OnsetType:OnsetTimePoint 0.8425218 0.01161741 *
##
## $`Sphericity Corrections`
## Effect GGe p[GG] p[GG]<.05 HFe
## 3 OnsetTimePoint 0.9057842 2.995524e-06 * 0.9359996
## 4 OnsetType:OnsetTimePoint 0.8639471 4.276799e-06 * 0.8904090
## p[HF] p[HF]<.05
## 3 2.174652e-06 *
## 4 3.221678e-06 *
Pairwise comparisons to break down main effect of Onset Time Point.
agg_Dev_IR_TP_sep <- aggregate(data = data_onlyIR, IntRT ~ SubjectNo + OnsetTimePoint, mean)
agg_Dev_IR_TP_sep[] <- lapply(agg_Dev_IR_TP_sep, function(x) if(is.factor(x)) factor(x) else x)
agg_Dev_IR_TP_sep$OnsetTimePoint <- as.factor(agg_Dev_IR_TP_sep$OnsetTimePoint)
agg_Dev_IR_TP_sep$SubjectNo <- as.factor(agg_Dev_IR_TP_sep$SubjectNo)
#500 ms vs 1250 ms
(IntRT500_1250 <- pairedSamplesTTest(data = agg_Dev_IR_TP_sep[agg_Dev_IR_TP_sep$OnsetTimePoint != 2,], IntRT ~ OnsetTimePoint, id = "SubjectNo"))
##
## Paired samples t-test
##
## Outcome variable: IntRT
## Grouping variable: OnsetTimePoint
## ID variable: SubjectNo
##
## Descriptive statistics:
## 0 1 difference
## mean 586.411 553.756 32.655
## std dev. 83.456 73.333 46.845
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: 5.123
## degrees of freedom: 53
## p-value: <.001
##
## Other information:
## two-sided 95% confidence interval: [19.869, 45.442]
## estimated effect size (Cohen's d): 0.697
#500 ms vs 2000 ms
(IntRT500_2000 <- pairedSamplesTTest(data = agg_Dev_IR_TP_sep[agg_Dev_IR_TP_sep$OnsetTimePoint != 1,], IntRT ~ OnsetTimePoint, id = "SubjectNo"))
##
## Paired samples t-test
##
## Outcome variable: IntRT
## Grouping variable: OnsetTimePoint
## ID variable: SubjectNo
##
## Descriptive statistics:
## 0 2 difference
## mean 586.411 555.827 30.584
## std dev. 83.456 59.842 54.965
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: 4.089
## degrees of freedom: 53
## p-value: <.001
##
## Other information:
## two-sided 95% confidence interval: [15.582, 45.587]
## estimated effect size (Cohen's d): 0.556
#1250 ms vs 2000 ms
(IntRT1250_2000 <- pairedSamplesTTest(data = agg_Dev_IR_TP_sep[agg_Dev_IR_TP_sep$OnsetTimePoint != 0,], IntRT ~ OnsetTimePoint, id = "SubjectNo"))
##
## Paired samples t-test
##
## Outcome variable: IntRT
## Grouping variable: OnsetTimePoint
## ID variable: SubjectNo
##
## Descriptive statistics:
## 1 2 difference
## mean 553.756 555.827 -2.071
## std dev. 73.333 59.842 41.372
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -0.368
## degrees of freedom: 53
## p-value: 0.714
##
## Other information:
## two-sided 95% confidence interval: [-13.363, 9.221]
## estimated effect size (Cohen's d): 0.05
#bonferroni correction
p.adjust(c(IntRT500_1250$p.value, IntRT500_2000$p.value, IntRT1250_2000$p.value), method = "bonferroni") #bonferroni correction
## [1] 1.291806e-05 4.436956e-04 1.000000e+00
Pairwise comparisons to break down interaction effect of Onset Type and Onset Time Point.
agg_Dev_IR_TPI <- aggregate(data = data_noDelay, IntRT ~ SubjectNo + OnsetType + OnsetTimePoint, mean)
agg_Dev_IR_TPI[] <- lapply(agg_Dev_IR_TPI, function(x) if(is.factor(x)) factor(x) else x)
agg_Dev_IR_TPI$OnsetTimePoint <- as.factor(agg_Dev_IR_TPI$OnsetTimePoint)
agg_Dev_IR_TPI$OnsetType <- as.factor(agg_Dev_IR_TPI$OnsetType)
agg_Dev_IR_TPI$SubjectNo <- as.factor(agg_Dev_IR_TPI$SubjectNo)
#500 ms: fixed vs random
(IntRT_Int500 <- pairedSamplesTTest(data = agg_Dev_IR_TPI[agg_Dev_IR_TPI$OnsetTimePoint == 0,], IntRT ~ OnsetType, id = "SubjectNo")) #change sign of t-value in text for consistency
##
## Paired samples t-test
##
## Outcome variable: IntRT
## Grouping variable: OnsetType
## ID variable: SubjectNo
##
## Descriptive statistics:
## Fixed Random difference
## mean 557.715 616.968 -59.253
## std dev. 97.288 86.078 71.794
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -6.065
## degrees of freedom: 53
## p-value: <.001
##
## Other information:
## two-sided 95% confidence interval: [-78.849, -39.657]
## estimated effect size (Cohen's d): 0.825
#1250 ms: fixed vs random
(IntRT_Int1250 <- pairedSamplesTTest(data = agg_Dev_IR_TPI[agg_Dev_IR_TPI$OnsetTimePoint == 1,], IntRT ~ OnsetType, id = "SubjectNo")) #change sign of t-value in text for consistency
##
## Paired samples t-test
##
## Outcome variable: IntRT
## Grouping variable: OnsetType
## ID variable: SubjectNo
##
## Descriptive statistics:
## Fixed Random difference
## mean 553.255 554.407 -1.152
## std dev. 81.678 71.808 45.200
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -0.187
## degrees of freedom: 53
## p-value: 0.852
##
## Other information:
## two-sided 95% confidence interval: [-13.489, 11.185]
## estimated effect size (Cohen's d): 0.025
#2000 ms: fixed vs random
(IntRT_Int2000 <- pairedSamplesTTest(data = agg_Dev_IR_TPI[agg_Dev_IR_TPI$OnsetTimePoint == 2,], IntRT ~ OnsetType, id = "SubjectNo")) #change sign of t-value in text for consistency
##
## Paired samples t-test
##
## Outcome variable: IntRT
## Grouping variable: OnsetType
## ID variable: SubjectNo
##
## Descriptive statistics:
## Fixed Random difference
## mean 551.099 562.208 -11.109
## std dev. 63.170 65.573 47.767
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -1.709
## degrees of freedom: 53
## p-value: 0.093
##
## Other information:
## two-sided 95% confidence interval: [-24.147, 1.929]
## estimated effect size (Cohen's d): 0.233
#bonferroni correction
p.adjust(c(IntRT_Int500$p.value, IntRT_Int1250$p.value, IntRT_Int2000$p.value), method = "bonferroni") #bonferroni correction
## [1] 4.281413e-07 1.000000e+00 2.799406e-01
7.4 Temporal expectations shield internal representations instead of averting external interference
7.4.1 Angular difference between interference and report
Collapse the angular difference between the orientation of the interfering item and the reported orientation by factor SubjectNo. Calculate summary statistics.
data_noDelay$InterferencevsReport <- as.numeric(data_noDelay$InterferencevsReport)
agg_IntDev <- aggregate(data = data_noDelay, InterferencevsReport ~ SubjectNo, mean)
agg_IntDevChance <- aggregate(data = data_noDelay, InterferencevsReport ~ SubjectNo, mean)
agg_IntDevChance$InterferencevsReport <- 45
agg_IntDevChance$cond <- 'chance'
agg_IntDev$cond <- 'error'
aggChanceError <- rbind(agg_IntDevChance, agg_IntDev)
aggChanceError$cond <- as.factor(aggChanceError$cond)
sum_ChanceError <- summarySEwithin(data = aggChanceError, measurevar = 'InterferencevsReport', withinvars = 'cond', idvar = 'SubjectNo')
Plot angular difference between interference and report and chance level (dashed line = chance level).
ggplot(sum_ChanceError[sum_ChanceError$cond == "error",], aes(x =cond, y = InterferencevsReport)) +
geom_bar(stat = "identity", position = position_dodge(width=0.9), color= "black", width = 0.8, size=0.9, fill = "white")+
geom_hline(yintercept=sum_ChanceError$InterferencevsReport[sum_ChanceError$cond == "chance"], color = "#979797", linetype = "dashed") +
geom_point(data=agg_IntDev, position =position_dodge(width=0.9), size = 1, color = "#1F1F1F", shape = 1, alpha = 0.4) +
geom_errorbar(data=sum_ChanceError[sum_ChanceError$cond == "error",], aes(ymin=InterferencevsReport-se, ymax=InterferencevsReport+se), width=0.1, position=position_dodge(0.9), size=0.6)+
coord_cartesian(ylim = c(40, 49))+
labs(fill = "Onset Type", y = "Interference vs. Report (degrees)") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.line = element_line(colour = "black"),
axis.text.x = element_text(size = 15, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 15, color = "black"),
axis.ticks.x=element_blank(),
legend.text=element_text(size=11),
legend.title=element_text(size=13),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
7.4.2 Stats (angular difference between interference and report)
Pairwise comparisons to compare angular difference between interference and report versus chance level.
agg_allChance <- rbind(agg_IntDevChance, agg_IntDev)
#actual error vs chance error
(ErrorChance <- pairedSamplesTTest(data = agg_allChance, InterferencevsReport ~ cond, id = "SubjectNo"))
##
## Paired samples t-test
##
## Outcome variable: InterferencevsReport
## Grouping variable: cond
## ID variable: SubjectNo
##
## Descriptive statistics:
## chance error difference
## mean 45.000 44.121 0.879
## std dev. 0.000 1.478 1.478
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: 4.372
## degrees of freedom: 53
## p-value: <.001
##
## Other information:
## two-sided 95% confidence interval: [0.476, 1.282]
## estimated effect size (Cohen's d): 0.595
7.4.3 Swaps between memory target and interfering item
Fit mixture model to data. Here, we are only interested in the swaps.
data_noDelay$IntOri<- as.numeric(as.character(data_noDelay$IntOri))
MM.data <- NULL
MM.data <-data.frame(data_noDelay$participant, data_noDelay$InterferenceType, data_noDelay$OnsetType, data_noDelay$TargetOri, data_noDelay$ReportOri, data_noDelay$IntOri)
names(MM.data)[names(MM.data) == "data_noDelay.participant"] <- "id"
names(MM.data)[names(MM.data) == "data_noDelay.InterferenceType"] <- "InterferenceType"
names(MM.data)[names(MM.data) == "data_noDelay.OnsetType"] <- "OnsetType"
names(MM.data)[names(MM.data) == "data_noDelay.TargetOri"] <- "TargetOri"
names(MM.data)[names(MM.data) == "data_noDelay.ReportOri"] <- "ReportOri"
names(MM.data)[names(MM.data) == "data_noDelay.IntOri"] <- "IntOri"
#convert factors into characters (model doesn't like conditions as factors)
MM.data$InterferenceType <- as.character(MM.data$InterferenceType)
MM.data$OnsetType <- as.character(MM.data$OnsetType)
MM.data$id <- as.character(MM.data$id)
#subset into different conditions
MM.data_IF <- MM.data[MM.data$InterferenceType == 'Interruption' & MM.data$OnsetType == 'Fixed',]
MM.data_IR <- MM.data[MM.data$InterferenceType == 'Interruption' & MM.data$OnsetType == 'Random',]
MM.data_DF <- MM.data[MM.data$InterferenceType == 'Distraction' & MM.data$OnsetType == 'Fixed',]
MM.data_DR<- MM.data[MM.data$InterferenceType == 'Distraction' & MM.data$OnsetType == 'Random',]
#fit model to each condition
#fixed interruption
estimates_IF <- fit_mixtur(data = MM.data_IF,
components = 3,
unit = "degrees_180",
id_var = "id",
response_var = "ReportOri",
target_var = "TargetOri",
non_target_var = "IntOri",
set_size_var = NULL,
condition_var = NULL,
return_fit = FALSE)
estimates_IF$InterferenceType <- "Interruption"
estimates_IF$OnsetType <- "Fixed"
#random interruption
estimates_IR <- fit_mixtur(data = MM.data_IR,
components = 3,
unit = "degrees_180",
id_var = "id",
response_var = "ReportOri",
target_var = "TargetOri",
non_target_var = "IntOri",
set_size_var = NULL,
condition_var = NULL,
return_fit = FALSE)
estimates_IR$InterferenceType <- "Interruption"
estimates_IR$OnsetType <- "Random"
#fixed distraction
estimates_DF <- fit_mixtur(data = MM.data_DF,
components = 3,
unit = "degrees_180",
id_var = "id",
response_var = "ReportOri",
target_var = "TargetOri",
non_target_var = "IntOri",
set_size_var = NULL,
condition_var = NULL,
return_fit = FALSE)
estimates_DF$InterferenceType <- "Distraction"
estimates_DF$OnsetType <- "Fixed"
#random distraction
estimates_DR <- fit_mixtur(data = MM.data_DR,
components = 3,
unit = "degrees_180",
id_var = "id",
response_var = "ReportOri",
target_var = "TargetOri",
non_target_var = "IntOri",
set_size_var = NULL,
condition_var = NULL,
return_fit = FALSE)
estimates_DR$InterferenceType <- "Distraction"
estimates_DR$OnsetType <- "Random"
#bind into one data frame
estimates_allCond <- rbind(estimates_IF, estimates_IR, estimates_DF, estimates_DR)
#convert into factors
estimates_allCond$InterferenceType <- as.factor(estimates_allCond$InterferenceType)
estimates_allCond$OnsetType <- as.factor(estimates_allCond$OnsetType)
estimates_allCond$id <- as.factor(estimates_allCond$id)
Calculate summary statistics for swaps.
MM_Pn <- summarySEwithin(data = estimates_allCond , measurevar ="p_n", withinvars = c("InterferenceType", "OnsetType"), idvar = "id")
Plot probability of swaps as a function of Onset Type and Interference Type.
ggplot(MM_Pn, aes(x = InterferenceType, y = p_n, fill = interaction(OnsetType,InterferenceType))) +
geom_bar(stat = "identity", position = position_dodge(width=0.9), color= "black", width = 0.8, size=0.9) +
geom_point(data=estimates_allCond, aes(group =OnsetType), position =position_dodge(width=0.9), size = 1, color = "#1F1F1F", shape = 1, alpha = 0.4)+
geom_errorbar(data=MM_Pn,aes(ymin=p_n-se, ymax=p_n+se), width=0.1, position=position_dodge(0.9), size=0.6, color="#172A3A")+
scale_y_continuous(limits = c(0,0.22), expand = c(0, 0)) +
scale_fill_manual(values=c("#E66062","#A3A3A3", "#B01C1E", "#666666")) +
labs(fill = "Onset Type", x = "Interference Type", y = "Probability of Swaps") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.line = element_line(colour = "black"),
axis.text.x = element_text(size = 15, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 15, color = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
7.4.4 Stats (swaps)
Repeated-measures ANOVA with factors Onset Type and Interference Type.
ezANOVA(data = estimates_allCond,
dv = p_n,
wid = id,
within = .(InterferenceType, OnsetType),
detailed = TRUE,
type = 3)
## $ANOVA
## Effect DFn DFd SSn SSd F
## 1 (Intercept) 1 53 0.1305866713 0.14507558 47.7068135
## 2 InterferenceType 1 53 0.0091650417 0.07459621 6.5116876
## 3 OnsetType 1 53 0.0008205602 0.05717969 0.7605793
## 4 InterferenceType:OnsetType 1 53 0.0009167824 0.05992247 0.8108723
## p p<.05 ges
## 1 6.365918e-09 * 0.279413085
## 2 1.363670e-02 * 0.026493232
## 3 3.870811e-01 0.002430609
## 4 3.719361e-01 0.002714858
7.4.5 Response bias
Transform reproduction errors into -90 to +90 space.
data_noDelay$DevReportvsTargetNew <- NULL
tempTargetDev <- data_noDelay$ReportOri - data_noDelay$TargetOri
TargetDev <- NULL
for (i in 1:length(tempTargetDev)) {
if (0 <= tempTargetDev[i] && tempTargetDev[i] <= 90){
TargetDev[i] <- tempTargetDev[i]
} else if (-90 <= tempTargetDev[i] && tempTargetDev[i] < 0) {
TargetDev[i] <- tempTargetDev[i]
} else if (90 < tempTargetDev[i] && tempTargetDev[i] <= 270) {
TargetDev[i] <- tempTargetDev[i] - 180
} else if (-270 < tempTargetDev[i] && tempTargetDev[i] <= -90) {
TargetDev[i] <- tempTargetDev[i] + 180
}
}
data_noDelay$DevReportvsTargetNew <- TargetDev
Transform angular difference between interference and memory target into -90 to +90 space.
data_noDelay$DevIntvsTargetNew <- NULL
data_noDelay$IntOri <- as.numeric(as.character(data_noDelay$IntOri))
tempIntDev <- data_noDelay$IntOri - data_noDelay$TargetOri
IntDev <- NULL
for (i in 1:length(tempIntDev)) {
if (0 <= tempIntDev[i] && tempIntDev[i] <= 90){
IntDev[i] <- tempIntDev[i]
} else if (-90 <= tempIntDev[i] && tempIntDev[i] < 0) {
IntDev[i] <- tempIntDev[i]
} else if (90 < tempIntDev[i] && tempIntDev[i] <= 270) {
IntDev[i] <- tempIntDev[i] - 180
} else if (-270 < tempIntDev[i] && tempIntDev[i] <= -90) {
IntDev[i] <- tempIntDev[i] + 180
}
}
data_noDelay$DevIntvsTargetNew <- IntDev
Add column with all conditions.
data_noDelay$allCond <- NULL
data_noDelay$allCond <- ifelse(data_noDelay$InterferenceType == "Distraction" & data_noDelay$OnsetType == "Fixed", "Fixed Distraction",
ifelse(data_noDelay$InterferenceType == "Distraction" & data_noDelay$OnsetType == "Random", "Random Distraction",
ifelse(data_noDelay$InterferenceType == "Interruption" & data_noDelay$OnsetType == "Fixed", "Fixed Interruption", "Random Interruption")))
Demeaning of reproduction errors by subtracting the overall mean response error of a participant from each individual response error.
for(s in unique(data_noDelay$SubjectNo)){
data_noDelay$MeanError[s == data_noDelay$SubjectNo] <- mean(data_noDelay$DevReportvsTargetNew[s == data_noDelay$SubjectNo])
}
data_noDelay$DMeanDevReportvsTargetNew <- data_noDelay$DevReportvsTargetNew - data_noDelay$MeanError
Bin reproduction errors (i.e., moving-window approach, step size = 1, bin width = 45 degrees) according to the relative orientation of the target angle with respect to the interference angle per subject.
range <- c(-90, 90)
binwidth <- 45
halfbinwidth <- binwidth / 2
stepsize <- 5
bincentres <- seq(range[1]+halfbinwidth, range[2]-halfbinwidth, by = stepsize)
conditions <- c("Fixed Distraction", "Random Distraction", "Fixed Interruption", "Random Interruption") # conditions
bindata_x <- array(0, dim = c(length(unique(data_noDelay$SubjectNo)), length(bincentres)))
bindata_dev_y <- array(0, dim = c(length(unique(data_noDelay$SubjectNo)), length(conditions), length(bincentres)))
DisFixIdx <- data_noDelay$allCond == "Fixed Distraction"
DisRanIdx <- data_noDelay$allCond == "Random Distraction"
IntFixIdx <- data_noDelay$allCond == "Fixed Interruption"
IntRanIdx <- data_noDelay$allCond == "Random Interruption"
s = 0
for(sub in unique(data_noDelay$SubjectNo)) {
b = 0
s = s + 1
for(bincentre in bincentres){
b = b+1
binsel <- data_noDelay$DevIntvsTargetNew <= bincentre + halfbinwidth & data_noDelay$DevIntvsTargetNew >= bincentre - halfbinwidth
bindata_x[s,b] <- bincentre
bindata_dev_y[s,1,b] <- mean(data_noDelay$DMeanDevReportvsTargetNew[DisFixIdx == TRUE & binsel == TRUE & data_noDelay$SubjectNo == sub])
bindata_dev_y[s,2,b] <- mean(data_noDelay$DMeanDevReportvsTargetNew[DisRanIdx == TRUE & binsel == TRUE & data_noDelay$SubjectNo == sub])
bindata_dev_y[s,3,b] <- mean(data_noDelay$DMeanDevReportvsTargetNew[IntFixIdx == TRUE & binsel == TRUE & data_noDelay$SubjectNo == sub])
bindata_dev_y[s,4,b] <- mean(data_noDelay$DMeanDevReportvsTargetNew[IntRanIdx == TRUE & binsel == TRUE & data_noDelay$SubjectNo == sub])
}
}
Create data frame (curve_data) including response bias, angular difference between interference and memory item, subject number, and conditions.
curve_data <- NULL
for(c in 1:length(conditions)){
s = 1
for(sub in unique(data_noDelay$SubjectNo)){
bias <- bindata_dev_y[s,c,]
ii <- data.frame(bias)
subbindata_x <- bindata_x[s,]
ii$bindata_x <- subbindata_x
ii$subnum <- rep(s, nrow(ii))
ii$condition <- conditions[c]
curve_data <- rbind(curve_data, ii)
s = s+1
}
}
Add factors Onset Type and Interference Type to curve_data.
curve_data$InterferenceType <- NULL
curve_data$InterferenceType <- ifelse(curve_data$condition == "Fixed Distraction", "Distraction",
ifelse(curve_data$condition == "Random Distraction", "Distraction",
ifelse(curve_data$condition == "Fixed Interruption", "Interruption", "Interruption")))
curve_data$OnsetType <- NULL
curve_data$OnsetType <- ifelse(curve_data$condition == "Fixed Distraction", "Fixed",
ifelse(curve_data$condition == "Random Distraction", "Random",
ifelse(curve_data$condition == "Fixed Interruption", "Fixed", "Random")))
Collapse response bias by factor Onset Type, Interference Type, angular difference between interference and report, and subnum. Calculate summary statistics.
agg_bias <- aggregate(data = curve_data, bias ~ OnsetType + InterferenceType + bindata_x + subnum, mean)
summary_bias <- summarySEwithin(data = agg_bias, measurevar = "bias", withinvars = c("OnsetType","InterferenceType", "bindata_x"), idvar = "subnum")
summary_bias$bindata_x <- as.numeric(as.character(summary_bias$bindata_x))
Plot response bias as a function of Interference Type and Onset Type.
scaleFUN <- function(x) sprintf("%.1f", x)
ggplot(summary_bias, aes(x=bindata_x, y=bias, color =interaction(OnsetType, InterferenceType), fill = interaction(OnsetType, InterferenceType))) +
scale_y_continuous(labels=scaleFUN, breaks=c(-3, -1.5, 0, 1.5, 3)) +
geom_point(aes(x=bindata_x, y=bias)) +
geom_line(aes(x=bindata_x, y=bias)) +
facet_wrap(~InterferenceType, scales = 'free_x') +
geom_ribbon(aes(ymin=bias-se, ymax=bias+se), alpha = 0.2)+
scale_fill_manual(values=c("#E66062","#A3A3A3", "#B01C1E", "#666666")) +
scale_color_manual(values=c("#E66062","#A3A3A3", "#B01C1E", "#666666"))+
geom_hline(aes(yintercept=0), colour="#808080", linetype="dashed")+
geom_vline(aes(xintercept=0), colour="#808080", linetype="dashed")+
labs(x = "Interference vs. Target (degrees)", y = "Report vs. Target (degrees)") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.text.x = element_text(size = 13, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.x = element_text(size = 15, color = "black"),
axis.title.y = element_text(size = 15, color = "black"),
strip.text.x = element_text(size = 15),
strip.background = element_blank(),
axis.line = element_line(colour = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
7.4.5 Stats (response bias)
To test whether the interfering item biases memory reports (i.e., attractive bias towards or repulsive bias from interfering item), the area under the bias curve was integrated – separately for negative and positive target-to-interference angles – and subsequently compared.
subjects = 1:54
curve_data_negative <- curve_data[curve_data$bindata_x < 0,] #left side, negative interference-target angular differences
curve_data_postive <- curve_data[curve_data$bindata_x > 0,] #right side, positive interference-target angular differences
#integrate right area under the curve
AreaR <- NULL
i = 1
for(s in 1:54){
AreaR[i] <- AUC(curve_data_postive$bindata_x[curve_data_postive$subnum == s], curve_data_postive$bias[curve_data_postive$subnum == s], method = "trapezoid")
i = i+1
}
AreaRightG <- data.frame(subjects,AreaR)
AreaRightG$condition <- "right"
names(AreaRightG)[names(AreaRightG) == "AreaR"] <- "Area"
#integrate left area under the curve
AreaL <- NULL
i = 1
for(s in 1:54){
AreaL[i] <- AUC(curve_data_negative$bindata_x[curve_data_negative$subnum == s], curve_data_negative$bias[curve_data_negative$subnum == s], method = "trapezoid")
i = i+1
}
AreaLeftG <- data.frame(subjects,AreaL)
AreaLeftG$condition <- "left"
names(AreaLeftG)[names(AreaLeftG) == "AreaL"] <- "Area"
#bind area left and right into data frame
agg_AUCG <- rbind(AreaRightG, AreaLeftG)
## Mean area under the curve (left side): -52.69941
## Mean area under the curve (right side): 76.59877
## Indicator for attractive bias (left side = negative, right side = positive)
Pairwise comparisons to compare left and right area under the curve.
#right vs. left area under the curve
(BiasTest <- pairedSamplesTTest(data = agg_AUCG, Area ~ condition, id = "subjects"))
##
## Paired samples t-test
##
## Outcome variable: Area
## Grouping variable: condition
## ID variable: subjects
##
## Descriptive statistics:
## left right difference
## mean 76.599 -52.699 129.298
## std dev. 140.484 162.477 251.460
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: 3.779
## degrees of freedom: 53
## p-value: <.001
##
## Other information:
## two-sided 95% confidence interval: [60.663, 197.934]
## estimated effect size (Cohen's d): 0.514
Next, we examine whether the factors Onset Type or Interference Type might influence the magnitude of the response bias. We equate the average response biases for the negative and positive interference-target angular differences of each participant and condition and then compare the resulting equated biases between factors.
subjects = 1:54
curve_data_negative <- curve_data[curve_data$bindata_x < 0,]
curve_data_postive <- curve_data[curve_data$bindata_x > 0,]
#integrate area right - fixed distraction
AreaR <- NULL
i = 1
for(s in 1:54){
AreaR[i] <- AUC(curve_data_postive$bindata_x[curve_data_postive$subnum == s & curve_data_postive$condition == "Fixed Distraction"], curve_data_postive$bias[curve_data_postive$subnum == s & curve_data_postive$condition == "Fixed Distraction"], method = "trapezoid")
i = i+1
}
AreaRight1 <- data.frame(subjects,AreaR)
AreaRight1$condition <- "Fixed Distraction"
AreaRight1$InterferenceType <- "Distraction"
AreaRight1$OnsetType <- "Fixed"
#integrate area right - random distraction
AreaR <- NULL
i = 1
for(s in 1:54){
AreaR[i] <- AUC(curve_data_postive$bindata_x[curve_data_postive$subnum == s & curve_data_postive$condition == "Random Distraction"], curve_data_postive$bias[curve_data_postive$subnum == s & curve_data_postive$condition == "Random Distraction"], method = "trapezoid")
i = i+1
}
AreaRight2 <- data.frame(subjects,AreaR)
AreaRight2$condition <- "Random Distraction"
AreaRight2$InterferenceType <- "Distraction"
AreaRight2$OnsetType <- "Random"
#integrate area right - fixed interruption
AreaR <- NULL
i = 1
for(s in 1:54){
AreaR[i] <- AUC(curve_data_postive$bindata_x[curve_data_postive$subnum == s & curve_data_postive$condition == "Fixed Interruption"], curve_data_postive$bias[curve_data_postive$subnum == s & curve_data_postive$condition == "Fixed Interruption"], method = "trapezoid")
i = i+1
}
AreaRight3 <- data.frame(subjects,AreaR)
AreaRight3$condition <- "Fixed Interruption"
AreaRight3$InterferenceType <- "Interruption"
AreaRight3$OnsetType <- "Fixed"
#integrate area right - random interruption
AreaR <- NULL
i = 1
for(s in 1:54){
AreaR[i] <- AUC(curve_data_postive$bindata_x[curve_data_postive$subnum == s & curve_data_postive$condition == "Random Interruption"], curve_data_postive$bias[curve_data_postive$subnum == s & curve_data_postive$condition == "Random Interruption"], method = "trapezoid")
i = i+1
}
AreaRight4 <- data.frame(subjects,AreaR)
AreaRight4$condition <- "Random Interruption"
AreaRight4$InterferenceType <- "Interruption"
AreaRight4$OnsetType <- "Random"
#bind data frames area right
agg_AUC_right <- bind_rows(AreaRight1, AreaRight2, AreaRight3, AreaRight4)
#integrate area left - fixed distraction
AreaL <- NULL
i = 1
for(s in 1:54){
AreaL[i] <- AUC(curve_data_negative$bindata_x[curve_data_negative$subnum == s & curve_data_negative$condition == "Fixed Distraction"], curve_data_negative$bias[curve_data_negative$subnum == s & curve_data_negative$condition == "Fixed Distraction"], method = "trapezoid")
i = i+1
}
AreaLeft1 <- data.frame(subjects,AreaL)
AreaLeft1$condition <- "Fixed Distraction"
AreaLeft1$InterferenceType <- "Distraction"
AreaLeft1$OnsetType <- "Fixed"
#integrate area left - random distraction
AreaL <- NULL
i = 1
for(s in 1:54){
AreaL[i] <- AUC(curve_data_negative$bindata_x[curve_data_negative$subnum == s & curve_data_negative$condition == "Random Distraction"], curve_data_negative$bias[curve_data_negative$subnum == s & curve_data_negative$condition == "Random Distraction"], method = "trapezoid")
i = i+1
}
AreaLeft2 <- data.frame(subjects,AreaL)
AreaLeft2$condition <- "Random Distraction"
AreaLeft2$InterferenceType <- "Distraction"
AreaLeft2$OnsetType <- "Random"
#integrate area left - fixed interruption
AreaL <- NULL
i = 1
for(s in 1:54){
AreaL[i] <- AUC(curve_data_negative$bindata_x[curve_data_negative$subnum == s & curve_data_negative$condition == "Fixed Interruption"], curve_data_negative$bias[curve_data_negative$subnum == s & curve_data_negative$condition == "Fixed Interruption"], method = "trapezoid")
i = i+1
}
AreaLeft3 <- data.frame(subjects,AreaL)
AreaLeft3$condition <- "Fixed Interruption"
AreaLeft3$InterferenceType <- "Interruption"
AreaLeft3$OnsetType <- "Fixed"
#integrate area left - random interruption
AreaL <- NULL
i = 1
for(s in 1:54){
AreaL[i] <- AUC(curve_data_negative$bindata_x[curve_data_negative$subnum == s & curve_data_negative$condition == "Random Interruption"], curve_data_negative$bias[curve_data_negative$subnum == s & curve_data_negative$condition == "Random Interruption"], method = "trapezoid")
i = i+1
}
AreaLeft4 <- data.frame(subjects,AreaL)
AreaLeft4$condition <- "Random Interruption"
AreaLeft4$InterferenceType <- "Interruption"
AreaLeft4$OnsetType <- "Random"
#bind data frames area left
agg_AUC_left <- bind_rows(AreaLeft1, AreaLeft2, AreaLeft3, AreaLeft4)
#combine area left and right into data frame
agg_AUC <- bind_cols(agg_AUC_left, agg_AUC_right)
#rename headers
names(agg_AUC)[names(agg_AUC) == "condition...3"] <- "condition"
names(agg_AUC)[names(agg_AUC) == "InterferenceType...4"] <- "InterferenceType"
names(agg_AUC)[names(agg_AUC) == "OnsetType...5"] <- "OnsetType"
names(agg_AUC)[names(agg_AUC) == "subjects...1"] <- "subjects"
#get relevant columns
agg_AUC <- agg_AUC[c("subjects", "AreaL", "AreaR","InterferenceType", "OnsetType")]
#get mean response bias
agg_AUC$AreaL_flipped <- agg_AUC$AreaL * (-1)
agg_AUC$mean <- (agg_AUC$AreaL_flipped + agg_AUC$AreaR)/2
Repeated-measures ANOVA with factors Onset Type and Interference Type.
ezANOVA(data = agg_AUC,
dv = mean,
wid = subjects,
within = .(OnsetType, InterferenceType),
detailed = TRUE,
type = 3)
## $ANOVA
## Effect DFn DFd SSn SSd F
## 1 (Intercept) 1 53 1083522.912 1831357 31.3574622
## 2 OnsetType 1 53 17459.617 1307961 0.7074827
## 3 InterferenceType 1 53 43185.075 1750197 1.3077439
## 4 OnsetType:InterferenceType 1 53 3504.243 1587902 0.1169624
## p p<.05 ges
## 1 7.783999e-07 * 0.1433053219
## 2 4.040598e-01 0.0026882138
## 3 2.579426e-01 0.0066228663
## 4 7.337051e-01 0.0005407013