Participants performed a web-based visual working-memory task requiring them first to memorise the angles of two oriented bars and then, when probed after a retention interval, to reproduce the exact angle of one of those memory items. In addition, participants had to perform an intervening task between encoding the memory array and retrieving the probed item. Two critical experimental manipulations concerned the time at which the memory probe appeared.
This resulted in four possible trial conditions: an early-fixed, early-variable, late-fixed, or late-variable onset of the memory probe.
Working-memory task:
Intervening task:
In the paper, we refer to BlockTypeWM as Block Type, and to DelayCond as Delay Condition.
Note (regarding angles): 0° is 3 o’clock, 90° is 12 o’clock, 180° is 9 o’clock, and 270° is 6 o’clock.
library(dplyr)
library(ggplot2)
library(Rmisc)
library(ez)
library(lsr)
library(rmarkdown)
library(data.table)
library(ggpubr)
library(RColorBrewer)
library(Hmisc)
Get working directory.
getwd()
Check the available data files.
files <- list.files(pattern = ".csv", recursive = T)
Read-in the files, and remove practice trials and empty rows and then concatenate them into one data frame.
#initialize empty data frame
data <- NULL
#loop through data files, read them in and concatenate
for(file in files){
jj <- read.csv(file, sep = ",", header = T)
# bind files into one data frame
data <- rbind(data, jj)
}
#removes practice trials and empty rows (practice and between blocks)
data <- data[!is.na(data$TrialNumber), ]
#removes empty columns
data <- data[!sapply(data, function (x) all(is.na(x) | x == ""))]
## Number of subjects: 75
Check if all participants completed all blocks and trials.
CompletedTrials <- NULL
for (sub in unique(data$participant)){
nTrials <- length(which(data$participant == sub))
CompletedTrials <- append(CompletedTrials, nTrials)
}
## All participants completed the experiment
Rename columns and levels of independent variables.
names(data)[names(data) == "BlockType"] <- "BlockTypeInt"
data$BlockTypeInt[data$BlockTypeInt == "mixed"] <- "Variable"
data$BlockTypeInt[data$BlockTypeInt == "early"] <- "Fixed-early"
data$BlockTypeInt[data$BlockTypeInt == "late"] <- "Fixed-late"
data$DelayCond[data$DelayCond == "early"] <- "Early"
data$DelayCond[data$DelayCond == "late"] <- "Late"
Create new column “BlockTypeWM” (fixed vs. variable) and rename column “BlockType” to “BlockTypeInt”.
data$BlockTypeWM <- NULL
data$BlockTypeWM[data$BlockTypeInt == "Variable"] <- "Variable"
data$BlockTypeWM[data$BlockTypeInt == "Fixed-early"] <- "Fixed"
data$BlockTypeWM[data$BlockTypeInt == "Fixed-late"] <- "Fixed"
Add column “PreDelayCond” with information about delay condition of previous trial (previous-early vs. previous-late) for sequential-effects analysis.
data$PreDelayCond <- NULL
data$PreDelayCond[dplyr::lag(data$DelayCond, n = 1)=="Early"] <- "Previous-early" #n-1 is early
data$PreDelayCond[dplyr::lag(data$DelayCond, n = 1)=="Late"] <- "Previous-late" #n-1 is late
Add column “Combined” with combined information about delay condition of previous trial (for variable blocks) and delay condition of current trial (for fixed blocks).
data$Combined <- NULL
data$Combined[data$PreDelayCond == "Previous-early"] <- "Previous-early"
data$Combined[data$PreDelayCond == "Previous-late"] <- "Previous-late"
data$Combined[data$BlockTypeInt == "Fixed-early"] <- "Fixed-early"
data$Combined[data$BlockTypeInt == "Fixed-late"] <- "Fixed-late"
Performances above 80% will receive a bonus payment scaling from £0 at 80% to £5 at 100%.
AverageBonus <- aggregate(data = data, DevTargetvsReport ~ participant, mean)
#calculate accuracy for each participant
AverageBonus$MeanAcc <- 100 - (1.11111 * AverageBonus$DevTargetvsReport)
#calculate payment for each participant
AverageBonus$Payment <- round(0.25 * (AverageBonus$MeanAcc-80), digits=2)
#participants with negative bonus payments receive £0
AverageBonus$Payment[AverageBonus$Payment < 0] <- 0
## Mean bonus payment: 0.6662667
## SD bonus payment: 0.8462473
Convert reaction time from seconds into milliseconds.
data$KeyProbe.rt <- data$KeyProbe.rt *1000
data$SpaceResponse.rt <- data$SpaceResponse.rt *1000
data$IntRT[data$IntRT == "None"] <- NA
data$IntRT <- as.numeric(as.character(data$IntRT))
data$IntRT <- data$IntRT *1000
Transform into factors.
data$participant <- as.factor(data$participant)
data$BlockTypeInt <- as.factor(data$BlockTypeInt)
data$BlockTypeWM <- as.factor(data$BlockTypeWM)
data$DelayCond <- as.factor(data$DelayCond)
data$PreDelayCond <- as.factor(data$PreDelayCond)
## Number of trials before trial removal: 28800
Check if there are some participants with reproduction errors larger than 40° in the working-memory task.
participants <- unique(factor(data$participant))
ChancePerformance <- NULL
for (sub in unique(data$participant)){
tempChancePerformance <- mean(data$DevTargetvsReport[data$participant == sub])
if (tempChancePerformance >= 40) {
ChancePerformance <- append(ChancePerformance, 'yes')
} else {
ChancePerformance <- append(ChancePerformance, 'no')
}
}
Remove trials in which participants were slower than 5 seconds after memory-probe onset.
CutOff_5s <- NULL
for (sub in unique(data$participant)){
SlowProbe_5s <- length(which(data$participant == sub & data$KeyProbe.rt > 5000)) #number of trials with reaction time > 5000 ms
CutOff_5s <- append(CutOff_5s, SlowProbe_5s)
}
#remove trials
data <- data[data$KeyProbe.rt <= 5000,]
## Number of trials after more than 5s reaction time removal: 28728
Remove trials in which participants were faster than 200 milliseconds after memory-probe onset.
CutOff_200ms <- NULL
for (sub in unique(data$participant)){
FastProbe_200ms <- length(which(data$participant == sub & data$KeyProbe.rt < 200)) #number of trials with reaction time < 200 ms
CutOff_200ms <- append(CutOff_200ms, FastProbe_200ms)
}
#remove trials
data <- data[data$KeyProbe.rt >= 200,]
## Number of trials after less than 200s reaction time removal: 27191
Remove trials with slow reaction time after memory-probe onset (reaction time +/- 2.5 SD above individual mean reaction time).
CutOff2Remove <- NULL
CutOff_SD_low <- NULL
CutOff_SD_high <- NULL
for (sub in unique(data$participant)){
CutOffSD1 <- mean(data$KeyProbe.rt[data$participant==sub])+(2.5*sd(data$KeyProbe.rt[data$participant==sub])) #mean reaction time + 2.5 SD
CutOffSD2 <- mean(data$KeyProbe.rt[data$participant==sub])-(2.5*sd(data$KeyProbe.rt[data$participant==sub])) #mean reaction time - 2.5 SD
CutOff2Remove <- append(CutOff2Remove, which(data$participant == sub & data$KeyProbe.rt > CutOffSD1))
CutOff2Remove <- append(CutOff2Remove, which(data$participant == sub & data$KeyProbe.rt < CutOffSD2))
SlowProbeSD1 <- length(which(data$participant == sub & data$KeyProbe.rt > CutOffSD1)) #number of trials with reaction time > mean reaction time + 2.5 SD
SlowProbeSD2 <- length(which(data$participant == sub & data$KeyProbe.rt < CutOffSD2)) #number of trials with reaction time < mean reaction time - 2.5 SD
CutOff_SD_low <- append(CutOff_SD_low, SlowProbeSD2)
CutOff_SD_high <- append(CutOff_SD_high, SlowProbeSD1)
}
#remove trials
data <- data[-c(CutOff2Remove),]
## Number of trials after +/-2.5 SD reaction time removal: 26377
Remove trials in which participants were too slow to use the dial.
Dialling <- NULL
for (sub in unique(data$participant)){
SlowDial <- length(which(data$participant == sub & data$TooSlowDialing == "Yes")) #number of trials where too slow to reproduce the tilt
Dialling <- append(Dialling, SlowDial)
}
#remove trials
data <- data[data$TooSlowDialing == "No",]
## Number of trials after 'too slow dialing' removal: 26298
Remove trials in which participants did not respond/responded too slow/responded too fast to the intervening task.
InterveningResponse <- NULL
for (sub in unique(data$participant)){
SubsetInterrupter <- NULL
SubsetInterrupter <- data[data$participant == sub & data$Response2Interruptor == "Yes" ,] #trials in which participants responded to the intervening task
tempInterrupterResponse <- length(which(SubsetInterrupter$participant == sub & SubsetInterrupter$IntRT >= 200 & SubsetInterrupter$IntRT <= 1500)) #number of trials with correct responses to intervening task that are faster than 1500 ms and slower than 200 ms
nTrials <- length(which(data$participant == sub)) #number of intervening-task trials
InterveningResponse <- append(InterveningResponse, nTrials-tempInterrupterResponse) #number of trials in which participants did not respond/responded incorrectly/too slow to intervening task
}
#remove trials
data <- data[!(data$Response2Interruptor == "No"),] #trials with no response to intervening task
data <- data[!(data$IntRT > 1500),] #RTs slower than 1500 ms are excluded
data <- data[!(data$IntRT < 200),] #RTs faster than 200 ms are excluded
## Number of trials after removal of incorrect intervening task responses: 22564
Table with number of all removed trials per category:
BadTrials <- data.frame(participants, ChancePerformance, CutOff_5s, CutOff_200ms, CutOff_SD_low, CutOff_SD_high, Dialling, InterveningResponse)
BadTrials$TotalRemoved <- rowSums(BadTrials[3:8])
BadTrials$PercentageRemoved <- round(BadTrials$Total/384*100, digits = 2)
BadTrials$Remove <- NULL
#check if more than 25% of trials were removed and where performance was at chance level
for (row in 1:nrow(BadTrials)) {
if (BadTrials$PercentageRemoved[row] > 25 | BadTrials$ChancePerformance[row] == "yes") {
BadTrials$Remove[row] <- 'yes'
} else {
BadTrials$Remove[row] <- 'no'
}
}
Remove participants with more than 25% bad trials or chance performance.
RemoveSubs <- NULL
for (sub in unique(BadTrials$participants)){
if (BadTrials$Remove[BadTrials$participants == sub] == "yes"){
RemoveSubs <- append(RemoveSubs, sub)
}
}
#remove participants
data <- data[!data$participant %in% RemoveSubs,]
## Number of subjects: 55
Remove participants who indicated explicit strategy use in the survey at the end of the experiment. Survey results can be found in the “Analysis” folder on OSF.
StrategyUse <- c("6059099fcb5338abc4d6a224", "5f689679cc2af84fa2c57263") #5f689679cc2af84fa2c57263 already removed in bad trial removal
#remove participants
data <- data[!data$participant %in% StrategyUse,]
## Number of subjects: 54
agg_subInfo <- aggregate(data = data, Age~participant+Gender..male.female.other., FUN = mean)
## Mean Age: 28.37037
## Min Age: 19
## Max Age: 40
aggregate(data = agg_subInfo, participant ~ Gender..male.female.other., FUN = length)
## Gender..male.female.other. participant
## 1 female 13
## 2 Female 2
## 3 male 27
## 4 Male 9
## 5 MAle 1
## 6 MALE 1
## 7 NB 1
aggregate(data = aggregate(data = data, Age~participant+Handedness..right.left.ambidextrous., FUN=mean), participant ~ Handedness..right.left.ambidextrous., FUN = length)
## Handedness..right.left.ambidextrous. participant
## 1 left 7
## 2 Left 1
## 3 LEFT 1
## 4 right 35
## 5 Right 10
TotalNoTrials <- NULL
for (sub in unique(data$participant)){
nTrials <- length(which(data$participant == sub))
TotalNoTrials <- append(TotalNoTrials, nTrials)
}
PerNoTrial <- TotalNoTrials/384
## Mean number of trials across participants (in %): 95.17747
## SD of trials across participants (in %): 2.77991
Collapse RTs by factors DelayCond, BlockTypeWM, and participant. Calculate summary statistics.
agg_RT <- aggregate(data = data, KeyProbe.rt ~ participant + BlockTypeWM + DelayCond, mean)
summary_RT <- summarySEwithin(data = agg_RT, measurevar = "KeyProbe.rt", withinvars = c("BlockTypeWM", "DelayCond"), idvar = "participant")
Plot RTs as a function of BlockTypeWM and DelayCond.
ggplot(summary_RT, aes(x = DelayCond, y = KeyProbe.rt, fill = interaction(DelayCond, BlockTypeWM))) +
geom_bar(stat = "identity", position = position_dodge(width=0.9), color = "black", width = 0.8, size=0.9) +
geom_errorbar(data=summary_RT, aes(ymin=KeyProbe.rt-se, ymax=KeyProbe.rt+se), width=0.1, position=position_dodge(0.9), size=0.6)+
coord_cartesian(ylim= c(600,840))+
scale_fill_manual(values=c("#E66062", "#B01C1E","#A3A3A3","#666666")) +
labs(y = "RT (ms)") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.text.x = element_text(size = 16, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 16, color = "black"),
strip.background = element_blank(),
axis.line = element_line(colour = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
The temporal-expectation effect of each DelayCond is calculated by taking the difference in RTs between fixed and variable blocks (fixed - variable).
agg_RT_EarlyFix <- agg_RT[agg_RT$DelayCond == 'Early' & agg_RT$BlockTypeWM == 'Fixed',]
agg_RT_EarlyMix <- agg_RT[agg_RT$DelayCond == 'Early' & agg_RT$BlockTypeWM == 'Variable',]
agg_RT_LateFix <- agg_RT[agg_RT$DelayCond == 'Late' & agg_RT$BlockTypeWM == 'Fixed',]
agg_RT_LateMix <- agg_RT[agg_RT$DelayCond == 'Late' & agg_RT$BlockTypeWM == 'Variable',]
agg_RT_EarlyDiff <- merge(agg_RT_EarlyFix, agg_RT_EarlyMix, by = 'participant', sort = F)
agg_RT_LateDiff <- merge(agg_RT_LateFix, agg_RT_LateMix, by = 'participant', sort = F)
agg_RT_EarlyDiff$diff <- agg_RT_EarlyDiff$KeyProbe.rt.x - agg_RT_EarlyDiff$KeyProbe.rt.y #early-mixed
agg_RT_LateDiff$diff <- agg_RT_LateDiff$KeyProbe.rt.x - agg_RT_LateDiff$KeyProbe.rt.y #late-mixed
agg_RT_EarlyDiff$cond <- 'difference'
agg_RT_LateDiff$cond <- 'difference'
aggDT_AllDiff <- rbind(agg_RT_EarlyDiff, agg_RT_LateDiff)
names(aggDT_AllDiff )[names(aggDT_AllDiff ) == "BlockTypeWM.x"] <- "BlockTypeWM"
names(aggDT_AllDiff )[names(aggDT_AllDiff ) == "DelayCond.x"] <- "DelayCond"
sum.aggDT_Early <- data.frame("DelayCond" = "Early", "cond" = 'difference',
"diff" = mean(aggDT_AllDiff$diff[aggDT_AllDiff$DelayCond == 'Early']),
"se" = sd(aggDT_AllDiff$diff[aggDT_AllDiff$DelayCond == 'Early']) / sqrt(length(aggDT_AllDiff$participant[aggDT_AllDiff$DelayCond == 'Early'])))
sum.aggDT_Late <- data.frame("DelayCond" = "Late", "cond" = 'difference',
"diff" = mean(aggDT_AllDiff$diff[aggDT_AllDiff$DelayCond == 'Late']),
"se" = sd(aggDT_AllDiff$diff[aggDT_AllDiff$DelayCond == 'Late']) / sqrt(length(aggDT_AllDiff$participant[aggDT_AllDiff$DelayCond == 'Late'])))
sum.aggDT_AllDiff <- rbind(sum.aggDT_Early, sum.aggDT_Late)
Violin plot depicting the temporal-expectation effects on RTs for both delay conditions.
ggplot(sum.aggDT_AllDiff, aes(x = DelayCond, y = diff, fill = DelayCond, color = DelayCond)) +
geom_hline(yintercept=0, linetype="dashed", color = "black") +
geom_violin(data = aggDT_AllDiff, size = 1) +
geom_point(size = 2) +
geom_errorbar(data = sum.aggDT_AllDiff, aes(ymin=(diff-se), ymax=(diff+se)), width = .1, size = 0.6) +
geom_point(data = aggDT_AllDiff, size = 1.5, alpha = .3, shape = 1) +
scale_fill_manual(values=c("#FFFFFF", "#FFFFFF")) +
scale_color_manual(values=c("#000000", "#000000"))+
labs(y = "Fixed - Variable (ms)") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.line = element_line(colour = "black"),
axis.text.x = element_text(size = 16, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.y = element_text(size = 16, color = "black"),
axis.title.x = element_blank(),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
Repeated-measures ANOVA with factors BlockTypeWM and DelayCond.
ezANOVA(data = agg_RT,
dv = KeyProbe.rt,
wid = participant,
within = .(BlockTypeWM, DelayCond),
detailed = TRUE,
type = 3)
## $ANOVA
## Effect DFn DFd SSn SSd F p
## 1 (Intercept) 1 53 125643764.29 7829770.49 850.48719 2.580879e-34
## 2 BlockTypeWM 1 53 37027.25 87253.17 22.49138 1.632040e-05
## 3 DelayCond 1 53 198864.06 168591.25 62.51686 1.576969e-10
## 4 BlockTypeWM:DelayCond 1 53 72823.77 79751.73 48.39594 5.294887e-09
## p<.05 ges
## 1 * 0.938977508
## 2 * 0.004514200
## 3 * 0.023775535
## 4 * 0.008839777
Pairwise comparisons to break down interaction effect between BlockTypeWM and DelayCond.
#fixed-early vs variable-early
(WM_early <- pairedSamplesTTest(data = agg_RT[agg_RT$DelayCond == "Early",], KeyProbe.rt ~ BlockTypeWM, id = "participant"))
##
## Paired samples t-test
##
## Outcome variable: KeyProbe.rt
## Grouping variable: BlockTypeWM
## ID variable: participant
##
## Descriptive statistics:
## Fixed Variable difference
## mean 761.570 824.479 -62.909
## std dev. 189.013 214.290 62.157
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -7.437
## degrees of freedom: 53
## p-value: <.001
##
## Other information:
## two-sided 95% confidence interval: [-79.874, -45.943]
## estimated effect size (Cohen's d): 1.012
#fixed-late vs variable-late
(WM_late <- pairedSamplesTTest(data = agg_RT[agg_RT$DelayCond == "Late",], KeyProbe.rt ~ BlockTypeWM, id = "participant"))
##
## Paired samples t-test
##
## Outcome variable: KeyProbe.rt
## Grouping variable: BlockTypeWM
## ID variable: participant
##
## Descriptive statistics:
## Fixed Variable difference
## mean 737.608 727.071 10.537
## std dev. 192.276 188.274 49.382
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: 1.568
## degrees of freedom: 53
## p-value: 0.123
##
## Other information:
## two-sided 95% confidence interval: [-2.941, 24.016]
## estimated effect size (Cohen's d): 0.213
#fixed-early vs fixed-late
(WM_fixed <- pairedSamplesTTest(data = agg_RT[agg_RT$BlockTypeWM == "Fixed",], KeyProbe.rt ~ DelayCond, id = "participant"))
##
## Paired samples t-test
##
## Outcome variable: KeyProbe.rt
## Grouping variable: DelayCond
## ID variable: participant
##
## Descriptive statistics:
## Early Late difference
## mean 761.570 737.608 23.962
## std dev. 189.013 192.276 69.570
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: 2.531
## degrees of freedom: 53
## p-value: 0.014
##
## Other information:
## two-sided 95% confidence interval: [4.973, 42.951]
## estimated effect size (Cohen's d): 0.344
#variable-early vs variable-late
(WM_variable <- pairedSamplesTTest(data = agg_RT[agg_RT$BlockTypeWM == "Variable",], KeyProbe.rt ~ DelayCond, id = "participant"))
##
## Paired samples t-test
##
## Outcome variable: KeyProbe.rt
## Grouping variable: DelayCond
## ID variable: participant
##
## Descriptive statistics:
## Early Late difference
## mean 824.479 727.071 97.408
## std dev. 214.290 188.274 67.316
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: 10.633
## degrees of freedom: 53
## p-value: <.001
##
## Other information:
## two-sided 95% confidence interval: [79.034, 115.782]
## estimated effect size (Cohen's d): 1.447
#bonferroni correction
p.adjust(c(WM_early$p.value, WM_late$p.value, WM_fixed$p.value, WM_variable$p.value), method = "bonferroni")
## [1] 3.569144e-09 4.912802e-01 5.750733e-02 3.760406e-14
Collapse reproduction errors by factors DelayCond, BlockTypeWM, and participant. Calculate summary statistics.
agg_ER <- aggregate(data = data, DevTargetvsReport ~ participant + BlockTypeWM + DelayCond, mean)
summary_ER <- summarySEwithin(data = agg_ER, measurevar = "DevTargetvsReport", withinvars = c("BlockTypeWM", "DelayCond"), idvar = "participant")
Plot reproduction errors as a function of BlockTypeWM and DelayCond.
ggplot(summary_ER, aes(x = DelayCond, y = DevTargetvsReport, fill = interaction(DelayCond, BlockTypeWM))) +
geom_bar(stat = "identity", position = position_dodge(width=0.9), color = "black", width = 0.8, size=0.9) +
geom_errorbar(data=summary_ER, aes(ymin=DevTargetvsReport-se, ymax=DevTargetvsReport+se), width=0.1, position=position_dodge(0.9), size=0.6)+
coord_cartesian(ylim= c(13,19.5))+
scale_fill_manual(values=c("#E66062", "#B01C1E","#A3A3A3","#666666")) +
labs(y = "Error (degrees)") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.text.x = element_text(size = 16, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 16, color = "black"),
strip.background = element_blank(),
axis.line = element_line(colour = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
The temporal-expectation effect of each DelayCond is calculated by taking the difference in reproduction errors between fixed and variable blocks (fixed - variable).
agg_ER_EarlyFix <- agg_ER[agg_ER$DelayCond == 'Early' & agg_ER$BlockTypeWM == 'Fixed',]
agg_ER_EarlyMix <- agg_ER[agg_ER$DelayCond == 'Early' & agg_ER$BlockTypeWM == 'Variable',]
agg_ER_LateFix <- agg_ER[agg_ER$DelayCond == 'Late' & agg_ER$BlockTypeWM == 'Fixed',]
agg_ER_LateMix <- agg_ER[agg_ER$DelayCond == 'Late' & agg_ER$BlockTypeWM == 'Variable',]
agg_ER_EarlyDiff <- merge(agg_ER_EarlyFix, agg_ER_EarlyMix, by = 'participant', sort = F)
agg_ER_LateDiff <- merge(agg_ER_LateFix, agg_ER_LateMix, by = 'participant', sort = F)
agg_ER_EarlyDiff$diff <- agg_ER_EarlyDiff$DevTargetvsReport.x - agg_ER_EarlyDiff$DevTargetvsReport.y #early-mixed
agg_ER_LateDiff$diff <- agg_ER_LateDiff$DevTargetvsReport.x - agg_ER_LateDiff$DevTargetvsReport.y #late-mixed
agg_ER_EarlyDiff$cond <- 'difference'
agg_ER_LateDiff$cond <- 'difference'
aggDev_AllDiff <- rbind(agg_ER_EarlyDiff, agg_ER_LateDiff)
names(aggDev_AllDiff )[names(aggDev_AllDiff ) == "BlockTypeWM.x"] <- "BlockTypeWM"
names(aggDev_AllDiff )[names(aggDev_AllDiff ) == "DelayCond.x"] <- "DelayCond"
sum.aggDev_Early <- data.frame("DelayCond" = "Early", "cond" = 'difference',
"diff" = mean(aggDev_AllDiff$diff[aggDev_AllDiff$DelayCond == 'Early']),
"se" = sd(aggDev_AllDiff$diff[aggDev_AllDiff$DelayCond == 'Early']) / sqrt(length(aggDev_AllDiff$participant[aggDev_AllDiff$DelayCond == 'Early'])))
sum.aggDev_Late <- data.frame("DelayCond" = "Late", "cond" = 'difference',
"diff" = mean(aggDev_AllDiff$diff[aggDev_AllDiff$DelayCond == 'Late']),
"se" = sd(aggDev_AllDiff$diff[aggDev_AllDiff$DelayCond == 'Late']) / sqrt(length(aggDev_AllDiff$participant[aggDev_AllDiff$DelayCond == 'Late'])))
sum.aggDev_AllDiff <- rbind(sum.aggDev_Early, sum.aggDev_Late)
Violin plot depicting the temporal-expectation effects on RTs for both delay conditions.
ggplot(sum.aggDev_AllDiff, aes(x = DelayCond, y = diff, fill = DelayCond, color = DelayCond)) +
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("#000000", "#000000"))+
labs(y = "Fixed - Variable (degrees)") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.line = element_line(colour = "black"),
axis.text.x = element_text(size = 16, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.y = element_text(size = 16, color = "black"),
axis.title.x = element_blank(),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
Repeated-measures ANOVA with factors BlockTypeWM and DelayCond.
ezANOVA(data = agg_ER,
dv = DevTargetvsReport,
wid = participant,
within = .(BlockTypeWM, DelayCond),
detailed = TRUE,
type = 3)
## $ANOVA
## Effect DFn DFd SSn SSd F
## 1 (Intercept) 1 53 68569.068403 12247.2065 296.7338397
## 2 BlockTypeWM 1 53 23.572640 257.3629 4.8544294
## 3 DelayCond 1 53 1.396893 236.4790 0.3130736
## 4 BlockTypeWM:DelayCond 1 53 4.596984 281.7000 0.8648924
## p p<.05 ges
## 1 2.271444e-23 * 0.8403914886
## 2 3.194345e-02 * 0.0018068419
## 3 5.781573e-01 0.0001072541
## 4 3.565899e-01 0.0003528719
Collapse RTs by factors BlockTypeInt and participant. Calculate summary statistics.
agg_RT_Int <- aggregate(data = data, IntRT ~ participant + BlockTypeInt, mean)
agg_RT_Int[] <- lapply(agg_RT_Int, function(x) if(is.factor(x)) factor(x) else x)
summary_RT_Int <- summarySEwithin(data = agg_RT_Int, measurevar = "IntRT", withinvars = c("BlockTypeInt"), idvar = "participant")
Plot RTs as a function of BlockTypeInt.
summary_RT_Int$BlockTypeInt <- factor(summary_RT_Int$BlockTypeInt,levels = c('Fixed-early','Variable','Fixed-late'), ordered = TRUE)
ggplot(summary_RT_Int, aes(x = BlockTypeInt, y = IntRT, fill = BlockTypeInt)) +
geom_bar(stat = "identity", position = position_dodge(width=0.9), color = "black", width = 0.8, size=0.9) +
geom_errorbar(data=summary_RT_Int, aes(ymin=IntRT-se, ymax=IntRT+se), width=0.1, position=position_dodge(0.9), size=0.6)+
coord_cartesian(ylim= c(500,590))+
scale_fill_manual(values=c("#E66062", "#858585", "#B01C1E")) +
theme_bw() +
labs(y = "RT (ms)") +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.line = element_line(colour = "black"),
axis.text.x = element_text(size = 16, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 16, color = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
The temporal-expectation effect of each delay was calculated by taking the difference in RTs between early/late blocks and variable blocks (fixed-early/fixed-late - variable).
agg_RT_Int_Early <- agg_RT_Int[agg_RT_Int$BlockTypeInt == 'Fixed-early',]
agg_RT_Int_Late <- agg_RT_Int[agg_RT_Int$BlockTypeInt == 'Fixed-late',]
agg_RT_Int_Mixed <- agg_RT_Int[agg_RT_Int$BlockTypeInt == 'Variable',]
agg_RT_Int_EarlyDiff <- merge(agg_RT_Int_Early, agg_RT_Int_Mixed, by = 'participant', sort = F)
agg_RT_Int_LateDiff <- merge(agg_RT_Int_Late, agg_RT_Int_Mixed, by = 'participant', sort = F)
agg_RT_Int_EarlyDiff$diff <- agg_RT_Int_EarlyDiff$IntRT.x - agg_RT_Int_EarlyDiff$IntRT.y
agg_RT_Int_LateDiff$diff <- agg_RT_Int_LateDiff$IntRT.x - agg_RT_Int_LateDiff$IntRT.y
agg_RT_Int_EarlyDiff$cond <- 'difference'
agg_RT_Int_LateDiff$cond <- 'difference'
agg_RT_Int_AllDiff <- rbind(agg_RT_Int_EarlyDiff, agg_RT_Int_LateDiff)
names(agg_RT_Int_AllDiff)[names(agg_RT_Int_AllDiff) == "BlockTypeInt.x"] <- "BlockTypeInt"
sum.agg_RT_Int_Early <- data.frame("BlockTypeInt" = "Fixed-early", "cond" = 'difference',
"diff" = mean(agg_RT_Int_AllDiff$diff[agg_RT_Int_AllDiff$BlockTypeInt == 'Fixed-early']),
"se" = sd(agg_RT_Int_AllDiff$diff[agg_RT_Int_AllDiff$BlockTypeInt == 'Fixed-early']) / sqrt(length(agg_RT_Int_AllDiff$participant[agg_RT_Int_AllDiff$BlockTypeInt == 'Fixed-early'])))
sum.agg_RT_Int_Late <- data.frame("BlockTypeInt" = "Fixed-late", "cond" = 'difference',
"diff" = mean(agg_RT_Int_AllDiff$diff[agg_RT_Int_AllDiff$BlockTypeInt == 'Fixed-late']),
"se" = sd(agg_RT_Int_AllDiff$diff[agg_RT_Int_AllDiff$BlockTypeInt == 'Fixed-late']) / sqrt(length(agg_RT_Int_AllDiff$participant[agg_RT_Int_AllDiff$BlockTypeInt == 'Fixed-late'])))
sum.agg_RT_Int_AllDiff <- rbind(sum.agg_RT_Int_Early, sum.agg_RT_Int_Late)
Violin plot depicting the temporal-expectation effects on RTs for both delay conditions.
ggplot(sum.agg_RT_Int_AllDiff, aes(x = BlockTypeInt, y = diff, fill = BlockTypeInt, color = BlockTypeInt)) +
geom_hline(yintercept=0, linetype="dashed", color = "black") +
geom_violin(data = agg_RT_Int_AllDiff, size = 1) +
geom_point(size = 2) +
geom_errorbar(data = sum.agg_RT_Int_AllDiff, aes(ymin=(diff-se), ymax=(diff+se)), width = .1, size = 0.6) +
geom_point(data = agg_RT_Int_AllDiff, size = 1.5, alpha = .3, shape = 1) +
scale_fill_manual(values=c("#FFFFFF", "#FFFFFF")) +
scale_color_manual(values=c("#000000", "#000000"))+
labs(y = "Fixed - Variable (ms)") +
scale_x_discrete(labels=c("Fixed-early" = "Early", "Fixed-late" = "Late"))+
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.line = element_line(colour = "black"),
axis.text.x = element_text(size = 16, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 16, color = "black"),
plot.title = element_text(hjust = 0.5),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
Repeated-measures ANOVA with factor BlockTypeInt.
ezANOVA(data = agg_RT_Int,
dv = IntRT,
wid = participant,
within = .(BlockTypeInt),
detailed = TRUE,
type = 3)
## $ANOVA
## Effect DFn DFd SSn SSd F p p<.05
## 1 (Intercept) 1 53 53521589.78 2323610.01 1220.79189 2.849973e-38 *
## 2 BlockTypeInt 2 106 16174.23 46890.16 18.28175 1.509278e-07 *
## ges
## 1 0.957587913
## 2 0.006776888
##
## $`Mauchly's Test for Sphericity`
## Effect W p p<.05
## 2 BlockTypeInt 0.9063829 0.0776434
##
## $`Sphericity Corrections`
## Effect GGe p[GG] p[GG]<.05 HFe p[HF]
## 2 BlockTypeInt 0.9143968 4.389307e-07 * 0.9454033 2.981004e-07
## p[HF]<.05
## 2 *
Pairwise comparisons to break down main effect of BlockTypeInt.
#fixed-early vs fixed-late
(Int_EL <- pairedSamplesTTest(data = agg_RT_Int[agg_RT_Int$BlockTypeInt != "Variable",], IntRT ~ BlockTypeInt, id = "participant"))
##
## Paired samples t-test
##
## Outcome variable: IntRT
## Grouping variable: BlockTypeInt
## ID variable: participant
##
## Descriptive statistics:
## Fixed-early Fixed-late difference
## mean 562.405 586.875 -24.470
## std dev. 119.335 126.110 33.135
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -5.427
## degrees of freedom: 53
## p-value: <.001
##
## Other information:
## two-sided 95% confidence interval: [-33.514, -15.426]
## estimated effect size (Cohen's d): 0.739
#fixed-early vs variable
(Int_EV <- pairedSamplesTTest(data = agg_RT_Int[agg_RT_Int$BlockTypeInt != "Fixed-late",], IntRT ~ BlockTypeInt, id = "participant"))
##
## Paired samples t-test
##
## Outcome variable: IntRT
## Grouping variable: BlockTypeInt
## ID variable: participant
##
## Descriptive statistics:
## Fixed-early Variable difference
## mean 562.405 575.082 -12.677
## std dev. 119.335 120.755 30.374
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -3.067
## degrees of freedom: 53
## p-value: 0.003
##
## Other information:
## two-sided 95% confidence interval: [-20.967, -4.386]
## estimated effect size (Cohen's d): 0.417
#fixed-late vs variable
(Int_LV <- pairedSamplesTTest(data = agg_RT_Int[agg_RT_Int$BlockTypeInt != "Fixed-early",], IntRT ~ BlockTypeInt, id = "participant")) #change sign of t-value in text for consistency
##
## Paired samples t-test
##
## Outcome variable: IntRT
## Grouping variable: BlockTypeInt
## ID variable: participant
##
## Descriptive statistics:
## Fixed-late Variable difference
## mean 586.875 575.082 11.793
## std dev. 126.110 120.755 25.173
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: 3.443
## degrees of freedom: 53
## p-value: 0.001
##
## Other information:
## two-sided 95% confidence interval: [4.922, 18.664]
## estimated effect size (Cohen's d): 0.468
#bonferroni correction
p.adjust(c(Int_EL$p.value, Int_EV$p.value, Int_LV$p.value), method = "bonferroni")
## [1] 4.358639e-06 1.020485e-02 3.396648e-03
Transform strings in numerical values.
data$IntError[data$CorrectInterruptorResponse == "Yes"] <- 0
data$IntError[data$CorrectInterruptorResponse == "No"] <- 100
Collapse error rates by factors BlockTypeInt and participant. Calculate summary statistics.
agg_ER_Int <- aggregate(data = data, IntError ~ participant + BlockTypeInt, mean)
agg_ER_Int[] <- lapply(agg_ER_Int, function(x) if(is.factor(x)) factor(x) else x)
summary_ER_Int <- summarySEwithin(data = agg_ER_Int, measurevar = "IntError", withinvars = "BlockTypeInt", idvar = "participant")
Plot error rates as a function of BlockTypeInt.
summary_ER_Int$BlockTypeInt <- factor(summary_ER_Int$BlockTypeInt,levels = c('Fixed-early','Variable', 'Fixed-late'), ordered = TRUE)
ggplot(summary_ER_Int, aes(x = BlockTypeInt, y = IntError, fill = BlockTypeInt)) +
geom_bar(stat = "identity", position = position_dodge(width=0.9), color = "black", width = 0.8, size=0.9) +
geom_errorbar(data=summary_ER_Int, aes(ymin=IntError-se, ymax=IntError+se), width=0.1, position=position_dodge(0.9), size=0.6)+
scale_y_continuous(expand = c(0, 0), limits = c(0, 3.1))+
scale_fill_manual(values=c("#E66062", "#858585", "#B01C1E")) +
theme_bw() +
labs(y = "Error rate (%)") +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.line = element_line(colour = "black"),
axis.text.x = element_text(size = 16, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 16, color = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
The temporal-expectation effect of each delay was calculated by taking the difference in error rates between early/late blocks and variable blocks (fixed-early/fixed-late - variable).
agg_ER_Int_Early <- agg_ER_Int[agg_ER_Int$BlockTypeInt == 'Fixed-early',]
agg_ER_Int_Late <- agg_ER_Int[agg_ER_Int$BlockTypeInt == 'Fixed-late',]
agg_ER_Int_Mixed <- agg_ER_Int[agg_ER_Int$BlockTypeInt == 'Variable',]
agg_ER_Int_EarlyDiff <- merge(agg_ER_Int_Early, agg_ER_Int_Mixed, by = 'participant', sort = F)
agg_ER_Int_LateDiff <- merge(agg_ER_Int_Late, agg_ER_Int_Mixed, by = 'participant', sort = F)
agg_ER_Int_EarlyDiff$diff <- agg_ER_Int_EarlyDiff$IntError.x - agg_ER_Int_EarlyDiff$IntError.y
agg_ER_Int_LateDiff$diff <- agg_ER_Int_LateDiff$IntError.x - agg_ER_Int_LateDiff$IntError.y
agg_ER_Int_EarlyDiff$cond <- 'difference'
agg_ER_Int_LateDiff$cond <- 'difference'
agg_ER_Int_AllDiff <- rbind(agg_ER_Int_EarlyDiff, agg_ER_Int_LateDiff)
names(agg_ER_Int_AllDiff)[names(agg_ER_Int_AllDiff) == "BlockTypeInt.x"] <- "BlockTypeInt"
sum.agg_ER_Int_Early <- data.frame("BlockTypeInt" = "Fixed-early", "cond" = 'difference',
"diff" = mean(agg_ER_Int_AllDiff$diff[agg_ER_Int_AllDiff$BlockTypeInt == 'Fixed-early']),
"se" = sd(agg_ER_Int_AllDiff$diff[agg_ER_Int_AllDiff$BlockTypeInt == 'Fixed-early']) / sqrt(length(agg_ER_Int_AllDiff$participant[agg_ER_Int_AllDiff$BlockTypeInt == 'Fixed-early'])))
sum.agg_ER_Int_Late <- data.frame("BlockTypeInt" = "Fixed-late", "cond" = 'difference',
"diff" = mean(agg_ER_Int_AllDiff$diff[agg_ER_Int_AllDiff$BlockTypeInt == 'Fixed-late']),
"se" = sd(agg_ER_Int_AllDiff$diff[agg_ER_Int_AllDiff$BlockTypeInt == 'Fixed-late']) / sqrt(length(agg_ER_Int_AllDiff$participant[agg_ER_Int_AllDiff$BlockTypeInt == 'Fixed-late'])))
sum.agg_ER_Int_AllDiff <- rbind(sum.agg_ER_Int_Early, sum.agg_ER_Int_Late)
Violin plot depicting the temporal-expectation effects on error rates for both delay conditions.
ggplot(sum.agg_ER_Int_AllDiff, aes(x = BlockTypeInt, y = diff, fill = BlockTypeInt, color = BlockTypeInt)) +
geom_hline(yintercept=0, linetype="dashed", color = "black") +
geom_violin(data = agg_ER_Int_AllDiff, size = 1) +
geom_point(size = 2) +
geom_errorbar(data = sum.agg_ER_Int_AllDiff, aes(ymin=(diff-se), ymax=(diff+se)), width = .1, size = 0.6) +
geom_point(data = agg_ER_Int_AllDiff, size = 1.5, alpha = .3, shape = 1) +
scale_x_discrete(labels=c("Fixed-early" = "Early", "Fixed-late" = "Late"))+
scale_fill_manual(values=c("#FFFFFF", "#FFFFFF")) +
scale_color_manual(values=c("#000000", "#000000"))+
labs(y = "Fixed - Variable (%)") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.line = element_line(colour = "black"),
axis.text.x = element_text(size = 16, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 16, color = "black"),
plot.title = element_text(hjust = 0.5),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
Repeated-measures ANOVA with factor BlockTypeInt.
ezANOVA(data = agg_ER_Int,
dv = IntError,
wid = participant,
within = .(BlockTypeInt),
detailed = TRUE,
type = 3)
## $ANOVA
## Effect DFn DFd SSn SSd F p p<.05
## 1 (Intercept) 1 53 1056.961114 1791.615 31.267285 8.01441e-07 *
## 2 BlockTypeInt 2 106 8.862437 443.162 1.059904 3.50132e-01
## ges
## 1 0.321095128
## 2 0.003950027
##
## $`Mauchly's Test for Sphericity`
## Effect W p p<.05
## 2 BlockTypeInt 0.7435322 0.0004506026 *
##
## $`Sphericity Corrections`
## Effect GGe p[GG] p[GG]<.05 HFe p[HF] p[HF]<.05
## 2 BlockTypeInt 0.7958819 0.3378535 0.8165544 0.3393146
Create a new data frame (fixed blocks and first trial in each block are removed).
data_preDelay <- data[!(data$TrialinBlockNumber == "1" & data$BlockTypeInt == "Variable"),] # delete first trial in variable blocks
data_preDelay <- data_preDelay[(data_preDelay$BlockTypeInt == "Variable"),] # delete fixed blocks
Collapse RTs by factors PreDelayCond (previous-early vs. previous-late) and participant. Calculate summary statistics.
agg_IntRT_preDelay <- aggregate(data = data_preDelay, IntRT ~ PreDelayCond + participant, mean)
summary_IntRT_preDelay <- summarySEwithin(data = agg_IntRT_preDelay, measurevar = "IntRT", withinvars = "PreDelayCond", idvar = "participant")
Plot RTs as a function of PreDelayCond.
ggplot(summary_IntRT_preDelay, aes(x = PreDelayCond, y = IntRT, fill = PreDelayCond)) +
geom_bar(stat = "identity", position = position_dodge(), size=1, color = "black") +
geom_errorbar(aes(ymin=IntRT-se, ymax=IntRT+se), width=0.1, position=position_dodge(0.9), size=0.6, color = "black")+
scale_fill_manual(values=c("#A3A3A3", "#666666")) +
coord_cartesian(ylim= c(500,587)) +
labs(y = "RT (ms)") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.text.x = element_text(size = 16, 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.background = element_blank(),
axis.line = element_line(colour = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
The sequential effect was calculated by taking the difference in RTs between previous-early and previous-late blocks (previous-early - previous-late).
aggPrevEarRT <- agg_IntRT_preDelay[agg_IntRT_preDelay$PreDelayCond == 'Previous-early',]
aggPrevLatRT <- agg_IntRT_preDelay[agg_IntRT_preDelay$PreDelayCond == 'Previous-late',]
aggPrev_Diff <- merge(aggPrevEarRT, aggPrevLatRT, by = 'participant', sort = F)
aggPrev_Diff$diff <- aggPrev_Diff$IntRT.x - aggPrev_Diff$IntRT.y
aggPrev_Diff$cond <- 'difference'
names(aggPrev_Diff)[names(aggPrev_Diff ) == "PreDelayCond.x"] <- "Previous Trial"
sum.aggPrev_Diff <- data.frame("cond" = 'difference',
"diff" = mean(aggPrev_Diff$diff),
"se" = sd(aggPrev_Diff$diff) / sqrt(length(aggPrev_Diff$participant)))
Violin plot depicting the sequential effect of RTs.
ggplot(sum.aggPrev_Diff, aes(x = cond, y = diff, fill = cond, color = cond)) +
geom_hline(yintercept=0, linetype="dashed", color = "black") +
geom_violin(data = aggPrev_Diff, size = 1) +
scale_fill_manual("cond", values="#FFFFFF") +
scale_color_manual("cond", values="#858585") +
geom_point(size = 2) +
geom_errorbar(data = sum.aggPrev_Diff, aes(ymin=(diff-se), ymax=(diff+se)), width = .1, size = 0.6) +
geom_point(data = aggPrev_Diff, size = 1.5, alpha = .3, shape =1) +
labs(y = "Previous-early - Previous-late (ms)") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.text.x = element_text(size = 16, 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())
Pairwise comparisons of RTs between previous-early and previous-late.
pairedSamplesTTest(data = agg_IntRT_preDelay, IntRT ~ PreDelayCond, id = "participant")
##
## Paired samples t-test
##
## Outcome variable: IntRT
## Grouping variable: PreDelayCond
## ID variable: participant
##
## Descriptive statistics:
## Previous-early Previous-late difference
## mean 571.543 580.231 -8.688
## std dev. 120.346 123.259 21.739
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -2.937
## degrees of freedom: 53
## p-value: 0.005
##
## Other information:
## two-sided 95% confidence interval: [-14.622, -2.755]
## estimated effect size (Cohen's d): 0.4
Collapse error rates by factors PreDelayCond (previous-early vs. previous-late) and participant. Calculate summary statistics.
agg_IntAcc_preDelay <- aggregate(data = data_preDelay, IntError ~ PreDelayCond + participant, mean)
summary_IntAcc_preDelay <- summarySEwithin(data = agg_IntAcc_preDelay, measurevar = "IntError", withinvars = "PreDelayCond", idvar = "participant")
Plot error rates as a function of PreDelayCond.
ggplot(summary_IntAcc_preDelay, aes(x = PreDelayCond, y = IntError, fill = PreDelayCond)) +
geom_bar(stat = "identity", position = position_dodge(), size=1, color = "black") +
geom_errorbar(aes(ymin=IntError-se, ymax=IntError+se), width=0.1, position=position_dodge(0.9), size=0.6, color = "black")+
scale_fill_manual(values=c("#A3A3A3", "#666666")) +
scale_y_continuous(expand = c(0, 0), limits = c(0, 3.1))+
labs(y = "Error rate (%)") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.text.x = element_text(size = 16, 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.background = element_blank(),
axis.line = element_line(colour = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
The sequential effect was calculated by taking the difference in error rates between previous-early and previous-late blocks (previous-early - previous-late).
aggPrevEarER <- agg_IntAcc_preDelay[agg_IntAcc_preDelay$PreDelayCond == 'Previous-early',]
aggPrevLatER <- agg_IntAcc_preDelay[agg_IntAcc_preDelay$PreDelayCond == 'Previous-late',]
aggPrevER_Diff <- merge(aggPrevEarER, aggPrevLatER, by = 'participant', sort = F)
aggPrevER_Diff$diff <- aggPrevER_Diff$IntError.x - aggPrevER_Diff$IntError.y
aggPrevER_Diff$cond <- 'difference'
names(aggPrevER_Diff)[names(aggPrevER_Diff ) == "PreDelayCond.x"] <- "Previous Trial"
sum.aggPrevER_Diff <- data.frame("cond" = 'difference',
"diff" = mean(aggPrevER_Diff$diff),
"se" = sd(aggPrevER_Diff$diff) / sqrt(length(aggPrevER_Diff$participant)))
Violin plot depicting the sequential effect of error rates.
ggplot(sum.aggPrevER_Diff, aes(x = cond, y = diff, fill = cond, color = cond)) +
geom_hline(yintercept=0, linetype="dashed", color = "black") +
geom_violin(data = aggPrevER_Diff, size = 1) +
scale_fill_manual("cond", values="#FFFFFF") +
scale_color_manual("cond", values="#858585") +
geom_point(size = 2) +
geom_errorbar(data = sum.aggPrevER_Diff, aes(ymin=(diff-se), ymax=(diff+se)), width = .1, size = 0.6) +
geom_point(data = aggPrevER_Diff, size = 1.5, alpha = .3, shape =1) +
labs(y = "Previous-early - Previous-late (degrees)") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.text.x = element_text(size = 16, 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())
Pairwise comparisons of error rates between previous-early and previous-late.
pairedSamplesTTest(data = agg_IntAcc_preDelay, IntError ~ PreDelayCond, id = "participant")
##
## Paired samples t-test
##
## Outcome variable: IntError
## Grouping variable: PreDelayCond
## ID variable: participant
##
## Descriptive statistics:
## Previous-early Previous-late difference
## mean 2.623 2.814 -0.191
## std dev. 3.357 3.441 2.415
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -0.58
## degrees of freedom: 53
## p-value: 0.564
##
## Other information:
## two-sided 95% confidence interval: [-0.85, 0.468]
## estimated effect size (Cohen's d): 0.079
Remove slow responses (RT < 1000 ms) to intervening task.
data_noslow <- data[data$IntRT < 1000,]
Collapse RTs by factors DelayCond, BlockTypeWM, and participant. Calculate summary statistics.
agg_RT2 <- aggregate(data = data_noslow, KeyProbe.rt ~ participant + BlockTypeWM + DelayCond, mean)
summary_RT2 <- summarySEwithin(data = agg_RT2, measurevar = "KeyProbe.rt", withinvars = c("BlockTypeWM", "DelayCond"), idvar = "participant")
Average number of trials after removing slow RTs to intervening task (in percent).
TotalNoTrials <- NULL
for (sub in unique(data_noslow$participant)){
nTrials <- length(which(data_noslow$participant == sub))
TotalNoTrials <- append(TotalNoTrials, nTrials)
}
PerNoTrial <- TotalNoTrials/384
## Mean number of trial loss across participants (in %): 8.415316
## SD of trials across participants (in %): 8.803561
Plot RTs as a function of BlockTypeWM and DelayCond.
ggplot(summary_RT2, aes(x = DelayCond, y = KeyProbe.rt, fill = interaction(DelayCond, BlockTypeWM))) +
geom_bar(stat = "identity", position = position_dodge(width=0.9), color = "black", width = 0.8, size=0.9) +
geom_errorbar(data=summary_RT2, aes(ymin=KeyProbe.rt-se, ymax=KeyProbe.rt+se), width=0.1, position=position_dodge(0.9), size=0.6)+
coord_cartesian(ylim= c(600,840))+
scale_fill_manual(values=c("#E66062", "#B01C1E","#A3A3A3","#666666")) +
labs(y = "RT (ms)") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.text.x = element_text(size = 16, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 16, color = "black"),
strip.background = element_blank(),
axis.line = element_line(colour = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
Repeated-measures ANOVA with factors BlockTypeWM and DelayCond.
ezANOVA(data = agg_RT2,
dv = KeyProbe.rt,
wid = participant,
within = .(BlockTypeWM, DelayCond),
detailed = TRUE,
type = 3)
## $ANOVA
## Effect DFn DFd SSn SSd F p
## 1 (Intercept) 1 53 123892292.10 7582529.78 865.97635 1.644056e-34
## 2 BlockTypeWM 1 53 36515.42 102741.55 18.83676 6.435254e-05
## 3 DelayCond 1 53 181965.02 165662.47 58.21564 4.378334e-10
## 4 BlockTypeWM:DelayCond 1 53 73478.16 83343.21 46.72657 8.291786e-09
## p<.05 ges
## 1 * 0.939812763
## 2 * 0.004581153
## 3 * 0.022419862
## 4 * 0.009175875
Pairwise comparisons to break down interaction effect between BlockTypeWM and DelayCond.
#fixed-early vs variable-early
(WM_early2 <- pairedSamplesTTest(data = agg_RT2[agg_RT2$DelayCond == "Early",], KeyProbe.rt ~ BlockTypeWM, id = "participant"))
##
## Paired samples t-test
##
## Outcome variable: KeyProbe.rt
## Grouping variable: BlockTypeWM
## ID variable: participant
##
## Descriptive statistics:
## Fixed Variable difference
## mean 754.926 817.818 -62.892
## std dev. 184.041 211.643 66.236
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -6.977
## degrees of freedom: 53
## p-value: <.001
##
## Other information:
## two-sided 95% confidence interval: [-80.971, -44.813]
## estimated effect size (Cohen's d): 0.95
#fixed-late vs variable-late
(WM_late2 <- pairedSamplesTTest(data = agg_RT2[agg_RT2$DelayCond == "Late",], KeyProbe.rt ~ BlockTypeWM, id = "participant"))
##
## Paired samples t-test
##
## Outcome variable: KeyProbe.rt
## Grouping variable: BlockTypeWM
## ID variable: participant
##
## Descriptive statistics:
## Fixed Variable difference
## mean 733.765 722.881 10.884
## std dev. 190.230 186.687 51.330
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: 1.558
## degrees of freedom: 53
## p-value: 0.125
##
## Other information:
## two-sided 95% confidence interval: [-3.127, 24.894]
## estimated effect size (Cohen's d): 0.212
#fixed-early vs fixed-late
(WM_fixed2 <- pairedSamplesTTest(data = agg_RT2[agg_RT2$BlockTypeWM == "Fixed",], KeyProbe.rt ~ DelayCond, id = "participant"))
##
## Paired samples t-test
##
## Outcome variable: KeyProbe.rt
## Grouping variable: DelayCond
## ID variable: participant
##
## Descriptive statistics:
## Early Late difference
## mean 754.926 733.765 21.162
## std dev. 184.041 190.230 71.229
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: 2.183
## degrees of freedom: 53
## p-value: 0.033
##
## Other information:
## two-sided 95% confidence interval: [1.72, 40.603]
## estimated effect size (Cohen's d): 0.297
#variable-early vs variable-late
(WM_variable2 <- pairedSamplesTTest(data = agg_RT2[agg_RT2$BlockTypeWM == "Variable",], KeyProbe.rt ~ DelayCond, id = "participant"))
##
## Paired samples t-test
##
## Outcome variable: KeyProbe.rt
## Grouping variable: DelayCond
## ID variable: participant
##
## Descriptive statistics:
## Early Late difference
## mean 817.818 722.881 94.937
## std dev. 211.643 186.687 65.748
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: 10.611
## degrees of freedom: 53
## p-value: <.001
##
## Other information:
## two-sided 95% confidence interval: [76.991, 112.883]
## estimated effect size (Cohen's d): 1.444
#bonferroni correction
p.adjust(c(WM_early2$p.value, WM_late2$p.value, WM_fixed2$p.value, WM_variable2$p.value), method = "bonferroni")
## [1] 1.961559e-08 5.006357e-01 1.338970e-01 4.062895e-14
Delete first trial in each block.
data_combined <- data[!(data$TrialinBlockNumber == "1"),] # delete first trial
data_combined$Combined <- as.factor(data_combined$Combined)
Collapse error rates by factors Combined (fixed-early vs. previous-early vs. previous-late vs. fixed-late) and participant. Calculate summary statistics.
agg_IntRTCombined <- aggregate(data = data_combined, IntRT ~ Combined + participant, mean)
summary_IntRTCombined <- summarySEwithin(data = agg_IntRTCombined, measurevar = "IntRT", withinvars = "Combined", idvar = "participant")
Plot RTs as a function of Combined.
summary_IntRTCombined$Combined <- factor(summary_IntRTCombined$Combined,levels = c("Fixed-early", "Previous-early", "Previous-late", "Fixed-late"))
ggplot(summary_IntRTCombined, aes(x = Combined, y = IntRT, fill = Combined)) +
geom_bar(stat = "identity", position = position_dodge(), size=1, color = "black") +
geom_errorbar(aes(ymin=IntRT-se, ymax=IntRT+se), width=0.1, position=position_dodge(0.9), size=0.6, color = "black")+
scale_fill_manual(values=c("#E66062", "#A3A3A3", "#666666", "#B01C1E")) +
scale_x_discrete(labels=c("Fixed-early" = "Early", "Previous-early" = "Previous-early", "Previous-late" = "Previous-late", "Fixed-late" = "Late"))+
coord_cartesian(ylim= c(500,587)) +
labs(y = "RT (ms)") +
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.text.x = element_text(size = 16, 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.background = element_blank(),
axis.line = element_line(colour = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
Take the difference in error rates between previous-early and previous-late trials (previous-early - previous-late) as well as between fixed-early and fixed-late trials (fixed-early - fixed-late).
agg_ER_Int_Early <- agg_IntRTCombined[agg_IntRTCombined$Combined == 'Fixed-early',]
agg_ER_Int_Late <- agg_IntRTCombined[agg_IntRTCombined$Combined == 'Fixed-late',]
agg_ER_Int_PLate <- agg_IntRTCombined[agg_IntRTCombined$Combined == 'Previous-late',]
agg_ER_Int_PEarly <- agg_IntRTCombined[agg_IntRTCombined$Combined == 'Previous-early',]
agg_ER_Int_FixedDiff <- merge(agg_ER_Int_Early, agg_ER_Int_Late, by = 'participant', sort = F)
agg_ER_Int_PreviousDiff <- merge(agg_ER_Int_PEarly, agg_ER_Int_PLate, by = 'participant', sort = F)
agg_ER_Int_FixedDiff$diff <- agg_ER_Int_FixedDiff$IntRT.x - agg_ER_Int_FixedDiff$IntRT.y
agg_ER_Int_PreviousDiff$diff <- agg_ER_Int_PreviousDiff$IntRT.x - agg_ER_Int_PreviousDiff$IntRT.y
agg_ER_Int_FixedDiff$cond <- 'difference'
agg_ER_Int_PreviousDiff$cond <- 'difference'
agg_ER_Int_AllDiff <- rbind(agg_ER_Int_FixedDiff, agg_ER_Int_PreviousDiff)
names(agg_ER_Int_AllDiff)[names(agg_ER_Int_AllDiff) == "Combined.x"] <- "Combined"
sum.agg_ER_Int_Fixed <- data.frame("Combined" = "Fixed-early", "cond" = 'difference',
"diff" = mean(agg_ER_Int_AllDiff$diff[agg_ER_Int_AllDiff$Combined == 'Fixed-early']),
"se" = sd(agg_ER_Int_AllDiff$diff[agg_ER_Int_AllDiff$Combined == 'Fixed-early']) / sqrt(length(agg_ER_Int_AllDiff$participant[agg_ER_Int_AllDiff$Combined == 'Fixed-early'])))
sum.agg_ER_Int_Previous <- data.frame("Combined" = "Previous-early", "cond" = 'difference',
"diff" = mean(agg_ER_Int_AllDiff$diff[agg_ER_Int_AllDiff$Combined == 'Previous-early']),
"se" = sd(agg_ER_Int_AllDiff$diff[agg_ER_Int_AllDiff$Combined == 'Previous-early']) / sqrt(length(agg_ER_Int_AllDiff$participant[agg_ER_Int_AllDiff$Combined == 'Previous-early'])))
sum.agg_ER_Int_AllDiff <- rbind(sum.agg_ER_Int_Fixed, sum.agg_ER_Int_Previous)
Violin plot depicting this difference of RTs.
ggplot(sum.agg_ER_Int_AllDiff, aes(x = Combined, y = diff, fill = Combined, color = Combined)) +
geom_hline(yintercept=0, linetype="dashed", color = "black") +
geom_violin(data = agg_ER_Int_AllDiff, size = 1) +
geom_point(size = 2) +
geom_errorbar(data = sum.agg_ER_Int_AllDiff, aes(ymin=(diff-se), ymax=(diff+se)), width = .1, size = 0.6) +
geom_point(data = agg_ER_Int_AllDiff, size = 1.5, alpha = .3, shape = 1) +
scale_fill_manual(values=c("#FFFFFF", "#FFFFFF")) +
scale_color_manual(values=c("#DE2B2E", "#858585"))+
labs(y = " Early - Late (ms)") +
scale_x_discrete(labels=c("Fixed-early" = "Fixed Block", "Previous-early" = "Variable Block"))+
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.line = element_line(colour = "black"),
axis.text.x = element_text(size = 16, color = "black"),
axis.text.y = element_text(size = 13, color = "black"),
axis.title.x = element_blank(),
axis.title.y = element_text(size = 16, color = "black"),
plot.title = element_text(hjust = 0.5),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
Pairwise comparisons of RTs between Fixed Block (fixed-early - fixed-late) and Variable Block (previous-early - previous-late)
pairedSamplesTTest(data = agg_ER_Int_AllDiff, diff ~ Combined, id = "participant")
##
## Paired samples t-test
##
## Outcome variable: diff
## Grouping variable: Combined
## ID variable: participant
##
## Descriptive statistics:
## Fixed-early Previous-early difference
## mean -24.995 -8.688 -16.307
## std dev. 33.880 21.739 36.754
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -3.26
## degrees of freedom: 53
## p-value: 0.002
##
## Other information:
## two-sided 95% confidence interval: [-26.338, -6.275]
## estimated effect size (Cohen's d): 0.444
Transform deviation between target item and intervening item into -90 to +90 degrees space.
data$DevTargetvsInt <- NULL
tempargetvsInt <- data$IntOri - data$TargetOri
Dev <- NULL
for (i in 1:length(tempargetvsInt)) {
if (0 <= tempargetvsInt[i] && tempargetvsInt[i] <= 90){
Dev[i] <- tempargetvsInt[i]
} else if (-90 <= tempargetvsInt[i] && tempargetvsInt[i] < 0) {
Dev[i] <- tempargetvsInt[i]
} else if (90 < tempargetvsInt[i] && tempargetvsInt[i] <= 270) {
Dev[i] <- tempargetvsInt[i] - 180
} else if (-270 < tempargetvsInt[i] && tempargetvsInt[i] <= -90) {
Dev[i] <- tempargetvsInt[i] + 180
}
}
data$DevTargetvsInt <- Dev
Take absolute value and assign to one of three bins (i.e., three levels of similarity).
data$DevTargetvsInt2 <- abs(data$DevTargetvsInt)
data$Similarity <- as.numeric(cut2(data$DevTargetvsInt2, g=3))
data$Similarity[data$Similarity == 1] <- "High"
data$Similarity[data$Similarity == 2] <- "Medium"
data$Similarity[data$Similarity == 3] <- "Low"
data$Similarity <- as.factor(data$Similarity)
Collapse RTs by factors Similarity, BlockTypeWM, DelayCond, and participant. Calculate summary statistics.
agg_RT_Similarity <- aggregate(data = data, KeyProbe.rt ~ participant + Similarity+ BlockTypeWM+DelayCond, mean)
summary_RT_Similarity <- summarySEwithin(data = agg_RT_Similarity, measurevar = "KeyProbe.rt",withinvars = c("BlockTypeWM","Similarity","DelayCond"), idvar = "participant")
Plot RTs as a function of Similarity, BlockTypeWM, and DelayCond.
summary_RT_Similarity$Similarity <- factor(summary_RT_Similarity$Similarity ,levels = c("Low", "Medium", "High"))
pd <- position_dodge(0.15) # move them .05 to the left and right
ggplot(summary_RT_Similarity, aes(x = Similarity, y = KeyProbe.rt, color = interaction(BlockTypeWM,DelayCond), group = BlockTypeWM)) +
scale_color_manual(values=c("#E66062", "#A3A3A3", "#666666", "#B01C1E")) +
geom_errorbar(aes(ymin=KeyProbe.rt-se, ymax=KeyProbe.rt+se), width=0.1, size=0.6, color = "black", position=pd) +
geom_line(color = "black", position=pd) +
geom_point(size = 4, position=pd) +
labs(x = "Similarity between Intervening Item and Memory Item", y = "RT (ms)") +
theme_bw() +
facet_wrap(~DelayCond, scales = 'free_x', labeller = labeller(DelayCond = label_wrap_gen(10)))+
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.text.x = element_text(size = 12, color = "black"),
axis.text.y = element_text(size = 12, color = "black"),
axis.title.x = element_text(size = 17, color = "black"),
axis.title.y = element_text(size = 17, color = "black"),
strip.text.x = element_blank(),
strip.background = element_blank(),
axis.line = element_line(colour = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
Repeated-measures ANOVA with factors Similarity, BlockTypeWM, and DelayCond.
ezANOVA(data = agg_RT_Similarity,
dv = KeyProbe.rt,
wid = participant,
within = .(BlockTypeWM, DelayCond, Similarity),
detailed = TRUE,
type = 3)
## $ANOVA
## Effect DFn DFd SSn SSd F
## 1 (Intercept) 1 53 3.767702e+08 23452074.2 851.4735552
## 2 BlockTypeWM 1 53 1.183011e+05 251716.7 24.9087769
## 3 DelayCond 1 53 5.961976e+05 512203.8 61.6912034
## 4 Similarity 2 106 2.482025e+03 554554.8 0.2372125
## 5 BlockTypeWM:DelayCond 1 53 2.324127e+05 240589.4 51.1987486
## 6 BlockTypeWM:Similarity 2 106 9.808700e+03 208597.8 2.4921700
## 7 DelayCond:Similarity 2 106 2.393107e+03 228453.1 0.5551891
## 8 BlockTypeWM:DelayCond:Similarity 2 106 2.714929e+03 264520.8 0.5439694
## p p<.05 ges
## 1 2.507239e-34 * 0.9361147780
## 2 6.857642e-06 * 0.0045798075
## 3 1.912596e-10 * 0.0226614333
## 4 7.892412e-01 0.0000965198
## 5 2.536153e-09 * 0.0089578582
## 6 8.756702e-02 0.0003813273
## 7 5.756236e-01 0.0000930623
## 8 5.820512e-01 0.0001055759
##
## $`Mauchly's Test for Sphericity`
## Effect W p p<.05
## 4 Similarity 0.9347625 0.17307442
## 6 BlockTypeWM:Similarity 0.9953139 0.88503766
## 7 DelayCond:Similarity 0.8827077 0.03901568 *
## 8 BlockTypeWM:DelayCond:Similarity 0.9906626 0.78355686
##
## $`Sphericity Corrections`
## Effect GGe p[GG] p[GG]<.05 HFe
## 4 Similarity 0.9387578 0.77540213 0.9720365
## 6 BlockTypeWM:Similarity 0.9953358 0.08784553 1.0340879
## 7 DelayCond:Similarity 0.8950209 0.55675361 0.9242563
## 8 BlockTypeWM:DelayCond:Similarity 0.9907490 0.58044037 1.0290472
## p[HF] p[HF]<.05
## 4 0.78306277
## 6 0.08756702
## 7 0.56221205
## 8 0.58205121
Collapse reproduction errors by factors Similarity, BlockTypeWM, DelayCond, and participant. Calculate summary statistics.
agg_ER_Similarity <- aggregate(data = data, DevTargetvsReport ~ participant + Similarity+ BlockTypeWM+DelayCond, mean)
summary_ER_Similarity <- summarySEwithin(data = agg_ER_Similarity, measurevar = "DevTargetvsReport",withinvars = c("BlockTypeWM","Similarity","DelayCond"), idvar = "participant")
Plot reproduction errors as a function of Similarity, BlockTypeWM, and DelayCond.
summary_ER_Similarity$Similarity <- factor(summary_ER_Similarity$Similarity ,levels = c("Low", "Medium", "High"))
ggplot(summary_ER_Similarity, aes(x = Similarity, y = DevTargetvsReport, color = interaction(BlockTypeWM,DelayCond), group = BlockTypeWM)) +
scale_color_manual(values=c("#E66062", "#A3A3A3", "#666666", "#B01C1E")) +
geom_errorbar(aes(ymin=DevTargetvsReport-se, ymax=DevTargetvsReport+se), width=0.1, size=0.6, color = "black", position=pd) +
geom_line(color = "black", position=pd) +
geom_point(size = 4, position=pd) +
labs(x = "Similarity between Intervening Item and Memory Item", y = "Error (degrees)") +
coord_cartesian(ylim= c(15,20))+
facet_wrap(~DelayCond, scales = 'free_x', labeller = labeller(DelayCond = label_wrap_gen(10)))+
theme_bw() +
theme(text=element_text(family = "Avenir"),
legend.position="none",
axis.text.x = element_text(size = 12, color = "black"),
axis.text.y = element_text(size = 12, color = "black"),
axis.title.x = element_text(size = 17, color = "black"),
axis.title.y = element_text(size = 17, color = "black"),
strip.text.x = element_blank(),
strip.background = element_blank(),
axis.line = element_line(colour = "black"),
panel.border = element_blank(),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank())
Repeated-measures ANOVA with factors Similarity, BlockTypeWM, and DelayCond.
ezANOVA(data = agg_ER_Similarity,
dv = DevTargetvsReport,
wid = participant,
within = .(BlockTypeWM, DelayCond, Similarity),
detailed = TRUE,
type = 3)
## $ANOVA
## Effect DFn DFd SSn SSd F
## 1 (Intercept) 1 53 2.064370e+05 36515.0774 299.6340306
## 2 BlockTypeWM 1 53 8.131501e+01 806.9936 5.3404333
## 3 DelayCond 1 53 4.146002e+00 754.0321 0.2914175
## 4 Similarity 2 106 1.023537e+02 1002.4689 5.4113851
## 5 BlockTypeWM:DelayCond 1 53 1.017303e+01 904.0819 0.5963733
## 6 BlockTypeWM:Similarity 2 106 8.734985e+00 1245.3712 0.3717399
## 7 DelayCond:Similarity 2 106 2.395399e+01 933.2406 1.3603794
## 8 BlockTypeWM:DelayCond:Similarity 2 106 4.978232e+01 1029.9964 2.5616237
## p p<.05 ges
## 1 1.823698e-23 * 8.269777e-01
## 2 2.475712e-02 * 1.879135e-03
## 3 5.915747e-01 9.598247e-05
## 4 5.784334e-03 * 2.364175e-03
## 5 4.433952e-01 2.354789e-04
## 6 6.904289e-01 2.021987e-04
## 7 2.610055e-01 5.542952e-04
## 8 8.195017e-02 1.151275e-03
##
## $`Mauchly's Test for Sphericity`
## Effect W p p<.05
## 4 Similarity 0.9275172 0.1413745
## 6 BlockTypeWM:Similarity 0.9354300 0.1763166
## 7 DelayCond:Similarity 0.9648991 0.3949387
## 8 BlockTypeWM:DelayCond:Similarity 0.9311844 0.1566491
##
## $`Sphericity Corrections`
## Effect GGe p[GG] p[GG]<.05 HFe
## 4 Similarity 0.9324159 0.006999458 * 0.9650982
## 6 BlockTypeWM:Similarity 0.9393464 0.677305434 0.9726806
## 7 DelayCond:Similarity 0.9660894 0.260956859 1.0019779
## 8 BlockTypeWM:DelayCond:Similarity 0.9356151 0.085869508 0.9685978
## p[HF] p[HF]<.05
## 4 0.00638254 *
## 6 0.68462518
## 7 0.26100553
## 8 0.08384167
Pairwise comparisons to break down main effect of Similarity.
agg_ER_Similarity2 <- aggregate(data = data, DevTargetvsReport ~ participant + Similarity, mean)
summary_ER_Similarity2 <- summarySEwithin(data = agg_ER_Similarity2, measurevar = "DevTargetvsReport",withinvars = c("Similarity"), idvar = "participant")
#low vs medium
(Sim_LowMed <- pairedSamplesTTest(data = agg_ER_Similarity2[agg_ER_Similarity2$Similarity != "High",], DevTargetvsReport ~ Similarity, id = "participant")) #change sign of t-value in text for consistency
##
## Paired samples t-test
##
## Outcome variable: DevTargetvsReport
## Grouping variable: Similarity
## ID variable: participant
##
## Descriptive statistics:
## Low Medium difference
## mean 18.187 18.041 0.146
## std dev. 7.920 7.408 2.077
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: 0.515
## degrees of freedom: 53
## p-value: 0.609
##
## Other information:
## two-sided 95% confidence interval: [-0.421, 0.713]
## estimated effect size (Cohen's d): 0.07
#low vs high
(Sim_HighLow <- pairedSamplesTTest(data = agg_ER_Similarity2[agg_ER_Similarity2$Similarity != "Medium",], DevTargetvsReport ~ Similarity, id = "participant"))
##
## Paired samples t-test
##
## Outcome variable: DevTargetvsReport
## Grouping variable: Similarity
## ID variable: participant
##
## Descriptive statistics:
## High Low difference
## mean 17.259 18.187 -0.927
## std dev. 7.701 7.920 2.341
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -2.911
## degrees of freedom: 53
## p-value: 0.005
##
## Other information:
## two-sided 95% confidence interval: [-1.567, -0.288]
## estimated effect size (Cohen's d): 0.396
#medium vs high
(Sim_HighMed <- pairedSamplesTTest(data = agg_ER_Similarity2[agg_ER_Similarity2$Similarity != "Low",], DevTargetvsReport ~ Similarity, id = "participant"))
##
## Paired samples t-test
##
## Outcome variable: DevTargetvsReport
## Grouping variable: Similarity
## ID variable: participant
##
## Descriptive statistics:
## High Medium difference
## mean 17.259 18.041 -0.782
## std dev. 7.701 7.408 1.824
##
## Hypotheses:
## null: population means equal for both measurements
## alternative: different population means for each measurement
##
## Test results:
## t-statistic: -3.15
## degrees of freedom: 53
## p-value: 0.003
##
## Other information:
## two-sided 95% confidence interval: [-1.28, -0.284]
## estimated effect size (Cohen's d): 0.429
#bonferroni correction
p.adjust(c(Sim_LowMed$p.value, Sim_HighLow$p.value, Sim_HighMed$p.value), method = "bonferroni")
## [1] 1.000000000 0.015778564 0.008054514