Here you need to set your own working directory. We read the dataset and remove participant 1 and rename participant 13 to 1.
# importing behavioural data
df <- read_excel("~/UTwente/M12_Thesis/DataAnalysis/df_P23678.xlsx")
# remove rows not used for analysis (mainly cue presentation and sequence markers)
df <- df[!(df$procedure %in% c("cueprocedure", "fixatieprocedure", "toetsenbordprocedure", "cuelist2", "fixprocedure", "seq1", "seq2", "sequentieprocedure", "feedbackprocedure", "nogoprocedure")), ]
df <- subset(df, select = -c(cue.OnsetTime, cue.OnsetDelay))
#remove participant 1
df<- df %>%
filter(subject != 1)
#rename participant 13 into 1
df <- df %>%
mutate(subject = ifelse(subject == 13, 1, subject))
df <- df %>%
arrange(subject, session)
#add count variable to include the trial number
df <- df %>%
group_by(subject) %>%
mutate(trial_nr = row_number() %% 6 == 0) %>%
mutate(trial_nr = cumsum(trial_nr)) %>%
ungroup()
#remove incorrect #As soon as 1 step is incorrect within a sequence we reject the whole thing
num_blocks <- nrow(df)/ 6
rows_to_remove <- c()
for(i in 0:(num_blocks - 1)) {
block_indices <- (1:6) + (i * 6)
if(any(df$feedback.ACC[block_indices] == 0)){
rows_to_remove <- c(rows_to_remove, block_indices)}}
df <- df[-rows_to_remove, ]
df <- df %>%
select(-procedure, -feedback.ACC)
df$feedback.RT <- as.numeric(df$feedback.RT)
when you look at the dataset now, the correct_trial and tiral_nr variable seem to not overlap because the trial_nr variable starts with 0, but they do always overlap on the 6th step which is the crucial one because we create the averages there. When we create the averages data frame this issue does not matter any more.
df <- df %>%
mutate(correct_trial = ((row_number() - 1) %/% 6) + 1)
df <- df %>%
rename(stepNumber = `sub trial number`)
df = df %>% select(subject, session, stepNumber, feedback.RT, h, trial_nr, correct_trial)
#calculate the ave RT and sum RT we need to make a variable called sequence_id to give each sequence a unique number. Now we have repeating numbers because our trial counts reset per participant.
df <- df %>%
mutate(sequence_id = rep(1:(n() %/% 6), each = 6)) %>%
group_by(sequence_id) %>%
mutate(aveRT= mean(feedback.RT), sumRT = sum(feedback.RT))
#add another count variable, only relevant later for eeg outlier removal
ave_eeg = df %>% filter(stepNumber == 6)
ave_eeg <- ave_eeg %>%
group_by(subject, session) %>%
mutate(cor_count_session = row_number())
#removing outliers using IQR 258 trials (43 sequences) removed
Q1 <- quantile(df$aveRT, 0.25)
Q3 <- quantile(df$aveRT, 0.75)
IQR <- Q3 - Q1
upper_bound <- Q3 + 1.5 * IQR
lower_bound <- Q1 - 1.5 * IQR
df_NO <- df %>%
filter(aveRT < upper_bound)
make a separate dataset which does not include the steps for learning curves
averages = df_NO %>% filter(stepNumber == 6)
averages = averages %>% select(subject, session, h, trial_nr, correct_trial, aveRT, sumRT)
## Adding missing grouping variables: `sequence_id`
#write.xlsx(df_NO, "final_data.xlsx")
#write.xlsx(averages, "ave_data.xlsx")
df_train = averages %>% filter(session < 5)
df_test = averages %>% filter(session > 4)
df_NO$session <- as.factor(df_NO$session)
RT.model <- lmer(feedback.RT ~ session + (1|subject), data=df_NO, REML = FALSE)
RT.model.effects<-allEffects(RT.model)
RT.model.df<-as.data.frame(RT.model.effects[[1]])
# Determine the y position for the annotation (you can adjust it based on your data range)
y_position <- max(RT.model.df$fit) + max(RT.model.df$se)
RT.model.plot <- ggplot(RT.model.df, aes(x=session, y=fit)) +
geom_point(aes(color = session)) +
geom_errorbar(aes(ymin=fit-se, ymax=fit+se, fill=session, color=session),
width=.2, position=position_dodge(.9)) +
geom_rect(aes(xmin = 5 - 0.5, xmax = 6 + 0.5, ymin = -Inf, ymax = Inf),
fill = NA, color = "black", size = 1) +
geom_rect(aes(xmin = 1 - 0.25, xmax = 4 + 0.5, ymin = -Inf, ymax = Inf),
fill = NA, color = "black", size = 1) +
annotate("text", x = (1 + 4) / 2, y = y_position, label = "Training blocks", color = "black", size = 5, fontface = "bold") +
annotate("text", x = (5 + 6) / 2, y = y_position, label = "Test blocks", color = "black", size = 5, fontface = "bold") +
ylab("Avg Response Time (ms)") +
xlab("Block") +
ggtitle("") +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
axis.line = element_line(colour = "black"))
## Warning in geom_errorbar(aes(ymin = fit - se, ymax = fit + se, fill = session, :
## Ignoring unknown aesthetics: fill
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
RT.model.plot
Anova(RT.model)
summary(RT.model, ddf="Satterthwaite")
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: feedback.RT ~ session + (1 | subject)
## Data: df_NO
##
## AIC BIC logLik deviance df.resid
## 234327.3 234389.2 -117155.7 234311.3 16936
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.4988 -0.5586 -0.2528 0.2337 14.8840
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 18778 137
## Residual 59064 243
## Number of obs: 16944, groups: subject, 12
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 529.133 39.865 12.320 13.27 1.16e-08 ***
## session2 -140.104 6.647 16932.210 -21.08 < 2e-16 ***
## session3 -206.363 6.678 16932.314 -30.90 < 2e-16 ***
## session4 -227.323 6.703 16932.386 -33.91 < 2e-16 ***
## session5 -263.659 6.676 16932.397 -39.49 < 2e-16 ***
## session6 -176.150 6.767 16932.399 -26.03 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) sessn2 sessn3 sessn4 sessn5
## session2 -0.092
## session3 -0.092 0.549
## session4 -0.091 0.547 0.546
## session5 -0.092 0.550 0.548 0.547
## session6 -0.090 0.542 0.541 0.539 0.541
## FREE LEARNING CURVES ##
# Free learning curve 1
# per subject per sequence
df_train$subject <- as.factor(df_train$subject)
df_train %>%
ggplot(aes(x = trial_nr, y = aveRT, color = subject)) +
geom_point() +
geom_smooth(se = FALSE) +
facet_wrap(~subject)+
ylab("Average Reaction Time per Trial")+
xlab("Correct Trial Number")+
scale_y_continuous()
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
df_test$subject <- as.factor(df_test$subject)
df_test %>%
ggplot(aes(x = trial_nr, y = aveRT, color = subject)) +
geom_point() +
geom_smooth(se = FALSE) +
facet_wrap(~subject, scales = "free_y")+
ylab("Average Reaction Time per Trial")+
xlab("Correct Trial Number")+
scale_y_continuous()
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
# Concatenation analysis for all 6 blocks
df_NO$subject = factor(df_NO$subject)
df_NO$session = factor(df_NO$session)
df_NO$stepNumber = factor(df_NO$stepNumber, ordered = TRUE, levels=c('1' ,'2', '3', '4', '5', '6'))
model = lmer(feedback.RT ~ session * stepNumber + (1|subject), data = df_NO, REML = FALSE)
Anova(model)
summary(model, ddf="Satterthwaite")
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: feedback.RT ~ session * stepNumber + (1 | subject)
## Data: df_NO
##
## AIC BIC logLik deviance df.resid
## 225145.7 225439.7 -112534.9 225069.7 16906
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.9784 -0.4783 -0.0992 0.3290 16.8613
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 18797 137.1
## Residual 34220 185.0
## Number of obs: 16944, groups: subject, 12
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 529.149 39.756 12.185 13.310 1.27e-08 ***
## session2 -140.117 5.059 16932.122 -27.695 < 2e-16 ***
## session3 -206.384 5.083 16932.183 -40.600 < 2e-16 ***
## session4 -227.348 5.102 16932.224 -44.556 < 2e-16 ***
## session5 -263.686 5.081 16932.231 -51.892 < 2e-16 ***
## session6 -176.174 5.151 16932.232 -34.204 < 2e-16 ***
## stepNumber.L -378.787 9.181 16931.999 -41.259 < 2e-16 ***
## stepNumber.Q 305.315 9.181 16931.999 33.256 < 2e-16 ***
## stepNumber.C -225.539 9.181 16931.999 -24.567 < 2e-16 ***
## stepNumber^4 93.453 9.181 16931.999 10.179 < 2e-16 ***
## stepNumber^5 -58.657 9.181 16931.999 -6.389 1.71e-10 ***
## session2:stepNumber.L 94.899 12.375 16931.999 7.669 1.83e-14 ***
## session3:stepNumber.L 169.729 12.426 16931.999 13.659 < 2e-16 ***
## session4:stepNumber.L 182.307 12.467 16931.999 14.623 < 2e-16 ***
## session5:stepNumber.L 207.968 12.415 16931.999 16.752 < 2e-16 ***
## session6:stepNumber.L 157.084 12.584 16931.999 12.483 < 2e-16 ***
## session2:stepNumber.Q -21.769 12.375 16931.999 -1.759 0.078580 .
## session3:stepNumber.Q -76.533 12.426 16931.999 -6.159 7.48e-10 ***
## session4:stepNumber.Q -75.305 12.467 16931.999 -6.040 1.57e-09 ***
## session5:stepNumber.Q -120.316 12.415 16931.999 -9.691 < 2e-16 ***
## session6:stepNumber.Q -103.660 12.584 16931.999 -8.238 < 2e-16 ***
## session2:stepNumber.C 52.665 12.375 16931.999 4.256 2.09e-05 ***
## session3:stepNumber.C 99.559 12.426 16931.999 8.012 1.20e-15 ***
## session4:stepNumber.C 112.913 12.467 16931.999 9.057 < 2e-16 ***
## session5:stepNumber.C 128.832 12.415 16931.999 10.377 < 2e-16 ***
## session6:stepNumber.C 70.192 12.584 16931.999 5.578 2.47e-08 ***
## session2:stepNumber^4 -23.047 12.375 16931.999 -1.862 0.062567 .
## session3:stepNumber^4 -42.026 12.426 16931.999 -3.382 0.000721 ***
## session4:stepNumber^4 -44.594 12.467 16931.999 -3.577 0.000349 ***
## session5:stepNumber^4 -47.731 12.415 16931.999 -3.845 0.000121 ***
## session6:stepNumber^4 -18.078 12.584 16931.999 -1.437 0.150846
## session2:stepNumber^5 17.875 12.375 16931.999 1.444 0.148631
## session3:stepNumber^5 29.812 12.426 16931.999 2.399 0.016446 *
## session4:stepNumber^5 23.152 12.467 16931.999 1.857 0.063319 .
## session5:stepNumber^5 30.521 12.415 16931.999 2.459 0.013962 *
## session6:stepNumber^5 33.657 12.584 16931.999 2.675 0.007489 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 36 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
# plot concatenation
ae.m.dfbig = allEffects(model)
ae.m.df.dfbig = as.data.frame(ae.m.dfbig[[1]])
ae.3factors = ggplot(ae.m.df.dfbig,
aes(x = stepNumber, y = fit, group = session, color = session)) +
geom_errorbar(aes(ymin = fit-se, ymax = fit + se), width=.1) +
geom_line() +
geom_point() +
ylab("Response Time (ms)") +
xlab("Step") +
facet_grid(~session)+
theme_classic()
plot(ae.3factors)
acctrials.model <- lmer(feedback.RT ~ session * stepNumber + (1|subject), data = df_NO, REML = FALSE)
Anova(acctrials.model)
summary(acctrials.model, ddf="Satterthwaite")
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: feedback.RT ~ session * stepNumber + (1 | subject)
## Data: df_NO
##
## AIC BIC logLik deviance df.resid
## 225145.7 225439.7 -112534.9 225069.7 16906
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.9784 -0.4783 -0.0992 0.3290 16.8613
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 18797 137.1
## Residual 34220 185.0
## Number of obs: 16944, groups: subject, 12
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 529.149 39.756 12.185 13.310 1.27e-08 ***
## session2 -140.117 5.059 16932.122 -27.695 < 2e-16 ***
## session3 -206.384 5.083 16932.183 -40.600 < 2e-16 ***
## session4 -227.348 5.102 16932.224 -44.556 < 2e-16 ***
## session5 -263.686 5.081 16932.231 -51.892 < 2e-16 ***
## session6 -176.174 5.151 16932.232 -34.204 < 2e-16 ***
## stepNumber.L -378.787 9.181 16931.999 -41.259 < 2e-16 ***
## stepNumber.Q 305.315 9.181 16931.999 33.256 < 2e-16 ***
## stepNumber.C -225.539 9.181 16931.999 -24.567 < 2e-16 ***
## stepNumber^4 93.453 9.181 16931.999 10.179 < 2e-16 ***
## stepNumber^5 -58.657 9.181 16931.999 -6.389 1.71e-10 ***
## session2:stepNumber.L 94.899 12.375 16931.999 7.669 1.83e-14 ***
## session3:stepNumber.L 169.729 12.426 16931.999 13.659 < 2e-16 ***
## session4:stepNumber.L 182.307 12.467 16931.999 14.623 < 2e-16 ***
## session5:stepNumber.L 207.968 12.415 16931.999 16.752 < 2e-16 ***
## session6:stepNumber.L 157.084 12.584 16931.999 12.483 < 2e-16 ***
## session2:stepNumber.Q -21.769 12.375 16931.999 -1.759 0.078580 .
## session3:stepNumber.Q -76.533 12.426 16931.999 -6.159 7.48e-10 ***
## session4:stepNumber.Q -75.305 12.467 16931.999 -6.040 1.57e-09 ***
## session5:stepNumber.Q -120.316 12.415 16931.999 -9.691 < 2e-16 ***
## session6:stepNumber.Q -103.660 12.584 16931.999 -8.238 < 2e-16 ***
## session2:stepNumber.C 52.665 12.375 16931.999 4.256 2.09e-05 ***
## session3:stepNumber.C 99.559 12.426 16931.999 8.012 1.20e-15 ***
## session4:stepNumber.C 112.913 12.467 16931.999 9.057 < 2e-16 ***
## session5:stepNumber.C 128.832 12.415 16931.999 10.377 < 2e-16 ***
## session6:stepNumber.C 70.192 12.584 16931.999 5.578 2.47e-08 ***
## session2:stepNumber^4 -23.047 12.375 16931.999 -1.862 0.062567 .
## session3:stepNumber^4 -42.026 12.426 16931.999 -3.382 0.000721 ***
## session4:stepNumber^4 -44.594 12.467 16931.999 -3.577 0.000349 ***
## session5:stepNumber^4 -47.731 12.415 16931.999 -3.845 0.000121 ***
## session6:stepNumber^4 -18.078 12.584 16931.999 -1.437 0.150846
## session2:stepNumber^5 17.875 12.375 16931.999 1.444 0.148631
## session3:stepNumber^5 29.812 12.426 16931.999 2.399 0.016446 *
## session4:stepNumber^5 23.152 12.467 16931.999 1.857 0.063319 .
## session5:stepNumber^5 30.521 12.415 16931.999 2.459 0.013962 *
## session6:stepNumber^5 33.657 12.584 16931.999 2.675 0.007489 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 36 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
emm.acctrials.model <- emmeans(acctrials.model, pairwise ~ stepNumber|session)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16944' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16944)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16944' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16944)' or larger];
## but be warned that this may result in large computation time and memory use.
print(emm.acctrials.model)
## $emmeans
## session = 1:
## stepNumber emmean SE df asymp.LCL asymp.UCL
## 1 1027 40.6 Inf 948 1107
## 2 443 40.6 Inf 363 522
## 3 446 40.6 Inf 367 526
## 4 416 40.6 Inf 337 496
## 5 443 40.6 Inf 364 523
## 6 399 40.6 Inf 320 479
##
## session = 2:
## stepNumber emmean SE df asymp.LCL asymp.UCL
## 1 794 40.4 Inf 714 873
## 2 317 40.4 Inf 238 396
## 3 300 40.4 Inf 221 379
## 4 284 40.4 Inf 205 363
## 5 319 40.4 Inf 240 399
## 6 320 40.4 Inf 241 400
##
## session = 3:
## stepNumber emmean SE df asymp.LCL asymp.UCL
## 1 631 40.5 Inf 552 710
## 2 269 40.5 Inf 190 348
## 3 248 40.5 Inf 169 327
## 4 237 40.5 Inf 157 316
## 5 269 40.5 Inf 189 348
## 6 284 40.5 Inf 204 363
##
## session = 4:
## stepNumber emmean SE df asymp.LCL asymp.UCL
## 1 598 40.5 Inf 519 677
## 2 250 40.5 Inf 170 329
## 3 232 40.5 Inf 153 311
## 4 208 40.5 Inf 128 287
## 5 248 40.5 Inf 169 328
## 6 275 40.5 Inf 196 354
##
## session = 5:
## stepNumber emmean SE df asymp.LCL asymp.UCL
## 1 515 40.5 Inf 436 594
## 2 221 40.5 Inf 142 301
## 3 211 40.5 Inf 132 291
## 4 193 40.5 Inf 113 272
## 5 217 40.5 Inf 138 297
## 6 235 40.5 Inf 156 314
##
## session = 6:
## stepNumber emmean SE df asymp.LCL asymp.UCL
## 1 669 40.5 Inf 590 749
## 2 279 40.5 Inf 199 358
## 3 289 40.5 Inf 210 369
## 4 298 40.5 Inf 218 377
## 5 298 40.5 Inf 218 377
## 6 285 40.5 Inf 206 365
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
##
## $contrasts
## session = 1:
## contrast estimate SE df z.ratio p.value
## stepNumber1 - stepNumber2 584.966 13.0 Inf 45.055 <.0001
## stepNumber1 - stepNumber3 581.288 13.0 Inf 44.771 <.0001
## stepNumber1 - stepNumber4 611.251 13.0 Inf 47.079 <.0001
## stepNumber1 - stepNumber5 584.308 13.0 Inf 45.004 <.0001
## stepNumber1 - stepNumber6 628.234 13.0 Inf 48.387 <.0001
## stepNumber2 - stepNumber3 -3.677 13.0 Inf -0.283 0.9998
## stepNumber2 - stepNumber4 26.286 13.0 Inf 2.025 0.3282
## stepNumber2 - stepNumber5 -0.658 13.0 Inf -0.051 1.0000
## stepNumber2 - stepNumber6 43.269 13.0 Inf 3.333 0.0111
## stepNumber3 - stepNumber4 29.963 13.0 Inf 2.308 0.1907
## stepNumber3 - stepNumber5 3.020 13.0 Inf 0.233 0.9999
## stepNumber3 - stepNumber6 46.946 13.0 Inf 3.616 0.0041
## stepNumber4 - stepNumber5 -26.943 13.0 Inf -2.075 0.3003
## stepNumber4 - stepNumber6 16.983 13.0 Inf 1.308 0.7808
## stepNumber5 - stepNumber6 43.926 13.0 Inf 3.383 0.0094
##
## session = 2:
## contrast estimate SE df z.ratio p.value
## stepNumber1 - stepNumber2 476.747 11.7 Inf 40.627 <.0001
## stepNumber1 - stepNumber3 493.702 11.7 Inf 42.072 <.0001
## stepNumber1 - stepNumber4 509.863 11.7 Inf 43.449 <.0001
## stepNumber1 - stepNumber5 474.250 11.7 Inf 40.414 <.0001
## stepNumber1 - stepNumber6 473.302 11.7 Inf 40.333 <.0001
## stepNumber2 - stepNumber3 16.956 11.7 Inf 1.445 0.6994
## stepNumber2 - stepNumber4 33.117 11.7 Inf 2.822 0.0540
## stepNumber2 - stepNumber5 -2.497 11.7 Inf -0.213 0.9999
## stepNumber2 - stepNumber6 -3.445 11.7 Inf -0.294 0.9997
## stepNumber3 - stepNumber4 16.161 11.7 Inf 1.377 0.7409
## stepNumber3 - stepNumber5 -19.453 11.7 Inf -1.658 0.5600
## stepNumber3 - stepNumber6 -20.400 11.7 Inf -1.738 0.5061
## stepNumber4 - stepNumber5 -35.614 11.7 Inf -3.035 0.0290
## stepNumber4 - stepNumber6 -36.561 11.7 Inf -3.116 0.0226
## stepNumber5 - stepNumber6 -0.948 11.7 Inf -0.081 1.0000
##
## session = 3:
## contrast estimate SE df z.ratio p.value
## stepNumber1 - stepNumber2 362.205 11.8 Inf 30.585 <.0001
## stepNumber1 - stepNumber3 383.045 11.8 Inf 32.345 <.0001
## stepNumber1 - stepNumber4 394.242 11.8 Inf 33.290 <.0001
## stepNumber1 - stepNumber5 362.498 11.8 Inf 30.610 <.0001
## stepNumber1 - stepNumber6 347.406 11.8 Inf 29.335 <.0001
## stepNumber2 - stepNumber3 20.840 11.8 Inf 1.760 0.4920
## stepNumber2 - stepNumber4 32.037 11.8 Inf 2.705 0.0742
## stepNumber2 - stepNumber5 0.293 11.8 Inf 0.025 1.0000
## stepNumber2 - stepNumber6 -14.799 11.8 Inf -1.250 0.8122
## stepNumber3 - stepNumber4 11.197 11.8 Inf 0.945 0.9346
## stepNumber3 - stepNumber5 -20.547 11.8 Inf -1.735 0.5084
## stepNumber3 - stepNumber6 -35.639 11.8 Inf -3.009 0.0314
## stepNumber4 - stepNumber5 -31.744 11.8 Inf -2.680 0.0791
## stepNumber4 - stepNumber6 -46.836 11.8 Inf -3.955 0.0011
## stepNumber5 - stepNumber6 -15.092 11.8 Inf -1.274 0.7991
##
## session = 4:
## contrast estimate SE df z.ratio p.value
## stepNumber1 - stepNumber2 348.634 11.9 Inf 29.227 <.0001
## stepNumber1 - stepNumber3 365.990 11.9 Inf 30.682 <.0001
## stepNumber1 - stepNumber4 390.532 11.9 Inf 32.740 <.0001
## stepNumber1 - stepNumber5 349.647 11.9 Inf 29.312 <.0001
## stepNumber1 - stepNumber6 323.258 11.9 Inf 27.100 <.0001
## stepNumber2 - stepNumber3 17.355 11.9 Inf 1.455 0.6931
## stepNumber2 - stepNumber4 41.898 11.9 Inf 3.512 0.0059
## stepNumber2 - stepNumber5 1.012 11.9 Inf 0.085 1.0000
## stepNumber2 - stepNumber6 -25.376 11.9 Inf -2.127 0.2730
## stepNumber3 - stepNumber4 24.543 11.9 Inf 2.057 0.3099
## stepNumber3 - stepNumber5 -16.343 11.9 Inf -1.370 0.7451
## stepNumber3 - stepNumber6 -42.732 11.9 Inf -3.582 0.0046
## stepNumber4 - stepNumber5 -40.886 11.9 Inf -3.428 0.0080
## stepNumber4 - stepNumber6 -67.274 11.9 Inf -5.640 <.0001
## stepNumber5 - stepNumber6 -26.389 11.9 Inf -2.212 0.2319
##
## session = 5:
## contrast estimate SE df z.ratio p.value
## stepNumber1 - stepNumber2 293.639 11.8 Inf 24.846 <.0001
## stepNumber1 - stepNumber3 303.614 11.8 Inf 25.690 <.0001
## stepNumber1 - stepNumber4 322.231 11.8 Inf 27.265 <.0001
## stepNumber1 - stepNumber5 297.502 11.8 Inf 25.173 <.0001
## stepNumber1 - stepNumber6 279.794 11.8 Inf 23.675 <.0001
## stepNumber2 - stepNumber3 9.976 11.8 Inf 0.844 0.9592
## stepNumber2 - stepNumber4 28.592 11.8 Inf 2.419 0.1495
## stepNumber2 - stepNumber5 3.863 11.8 Inf 0.327 0.9995
## stepNumber2 - stepNumber6 -13.845 11.8 Inf -1.171 0.8506
## stepNumber3 - stepNumber4 18.616 11.8 Inf 1.575 0.6150
## stepNumber3 - stepNumber5 -6.112 11.8 Inf -0.517 0.9955
## stepNumber3 - stepNumber6 -23.820 11.8 Inf -2.016 0.3333
## stepNumber4 - stepNumber5 -24.729 11.8 Inf -2.092 0.2911
## stepNumber4 - stepNumber6 -42.437 11.8 Inf -3.591 0.0045
## stepNumber5 - stepNumber6 -17.708 11.8 Inf -1.498 0.6654
##
## session = 6:
## contrast estimate SE df z.ratio p.value
## stepNumber1 - stepNumber2 390.385 12.2 Inf 32.074 <.0001
## stepNumber1 - stepNumber3 379.807 12.2 Inf 31.205 <.0001
## stepNumber1 - stepNumber4 371.671 12.2 Inf 30.537 <.0001
## stepNumber1 - stepNumber5 371.524 12.2 Inf 30.525 <.0001
## stepNumber1 - stepNumber6 383.924 12.2 Inf 31.544 <.0001
## stepNumber2 - stepNumber3 -10.578 12.2 Inf -0.869 0.9539
## stepNumber2 - stepNumber4 -18.714 12.2 Inf -1.538 0.6398
## stepNumber2 - stepNumber5 -18.861 12.2 Inf -1.550 0.6319
## stepNumber2 - stepNumber6 -6.461 12.2 Inf -0.531 0.9949
## stepNumber3 - stepNumber4 -8.136 12.2 Inf -0.668 0.9854
## stepNumber3 - stepNumber5 -8.284 12.2 Inf -0.681 0.9841
## stepNumber3 - stepNumber6 4.117 12.2 Inf 0.338 0.9994
## stepNumber4 - stepNumber5 -0.147 12.2 Inf -0.012 1.0000
## stepNumber4 - stepNumber6 12.253 12.2 Inf 1.007 0.9159
## stepNumber5 - stepNumber6 12.400 12.2 Inf 1.019 0.9118
##
## Degrees-of-freedom method: asymptotic
## P value adjustment: tukey method for comparing a family of 6 estimates
# afex accurate trials model
acctrials.model.afex <- mixed(feedback.RT ~ session * stepNumber + (1|subject), data = df_NO)
## Contrasts set to contr.sum for the following variables: session, stepNumber, subject
print(acctrials.model.afex)
## Mixed Model Anova Table (Type 3 tests, S-method)
##
## Model: feedback.RT ~ session * stepNumber + (1 | subject)
## Data: df_NO
## Effect df F p.value
## 1 session 5, 16897.08 649.56 *** <.001
## 2 stepNumber 5, 16897.00 2357.33 *** <.001
## 3 session:stepNumber 25, 16897.00 27.51 *** <.001
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
acctrials.model2 <- lmer(feedback.RT ~ stepNumber + (1|subject), data = df_NO, REML = FALSE)
Anova(acctrials.model2)
summary(acctrials.model2, ddf="Satterthwaite")
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: feedback.RT ~ stepNumber + (1 | subject)
## Data: df_NO
##
## AIC BIC logLik deviance df.resid
## 228630.8 228692.7 -114307.4 228614.8 16936
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.0582 -0.4905 -0.1479 0.3090 16.7220
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 17335 131.7
## Residual 42192 205.4
## Number of obs: 16944, groups: subject, 12
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 355.699 38.040 11.999 9.351 7.37e-07 ***
## stepNumber.L -239.920 3.865 16931.999 -62.070 < 2e-16 ***
## stepNumber.Q 237.598 3.865 16931.999 61.469 < 2e-16 ***
## stepNumber.C -145.997 3.865 16931.999 -37.771 < 2e-16 ***
## stepNumber^4 63.300 3.865 16931.999 16.376 < 2e-16 ***
## stepNumber^5 -35.614 3.865 16931.999 -9.214 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) stpN.L stpN.Q stpN.C stpN^4
## stepNumbr.L 0.000
## stepNumbr.Q 0.000 0.000
## stepNumbr.C 0.000 0.000 0.000
## stepNumbr^4 0.000 0.000 0.000 0.000
## stepNumbr^5 0.000 0.000 0.000 0.000 0.000
acctrials.model2.afex <- mixed(feedback.RT ~ stepNumber + (1|subject), data = df_NO)
## Contrasts set to contr.sum for the following variables: stepNumber, subject
print(acctrials.model2.afex)
## Mixed Model Anova Table (Type 3 tests, S-method)
##
## Model: feedback.RT ~ stepNumber + (1 | subject)
## Data: df_NO
## Effect df F p.value
## 1 stepNumber 5, 16927.00 1881.63 *** <.001
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
#Model 1 effects
acctrials.model.effects <- allEffects(acctrials.model)
acctrials.model.df <- as.data.frame(acctrials.model.effects[[1]])
#Model 2 effects
acctrials.model2.effects <- allEffects(acctrials.model2)
acctrials.model2.df <- as.data.frame(acctrials.model.effects[[1]])
#Facet wrap labels
block.labels <- c("Block 1", "Block 2", "Block 3", "Block 4", "Block 5", "Block 6")
names(block.labels) <- c("1", "2", "3", "4", "5", "6")
#Concatenation for Groups
acctrials.model.plot <- ggplot(acctrials.model.df, aes(x=stepNumber,y=fit))+
geom_errorbar(aes(ymin=fit-se, ymax=fit+se, color = session), width=.1) +
#geom_ribbon(aes(ymin=fit-se, ymax=fit+se, group=Group, fill=Group), alpha=0.2) +
geom_path(aes(x=stepNumber, y=fit, group=session, color = session)) +
geom_line() +
geom_point(aes())+
ylab("Mean Response Time (ms)")+
xlab("Steps")+
ggtitle("")+
facet_wrap(~ session, nrow = 2, labeller = labeller(session = block.labels))+
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"))
plot(acctrials.model.plot)
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
#Overall Concatenation
acctrials.model2.plot <- ggplot(acctrials.model2.df, aes(x=stepNumber,y=fit,color=session))+
#geom_errorbar(aes(ymin=fit-se, ymax=fit+se), width=.1) +
#geom_ribbon(aes(ymin=fit-se, ymax=fit+se, group=session), alpha=0.2) +
geom_path(aes(x=stepNumber, y=fit, group=session)) +
geom_line() +
geom_point(aes(color = session))+
ylab("Mean RT (ms)")+
xlab("Steps")+
ggtitle("Concatenation for Groups in Blocks 1-6")+
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(), axis.line = element_line(colour = "black"))
plot(acctrials.model2.plot)
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
#Concatenation Emmeans
emm.acctrials.model <- emmeans(acctrials.model, pairwise ~ stepNumber | session)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16944' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16944)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16944' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16944)' or larger];
## but be warned that this may result in large computation time and memory use.
print(emm.acctrials.model)
## $emmeans
## session = 1:
## stepNumber emmean SE df asymp.LCL asymp.UCL
## 1 1027 40.6 Inf 948 1107
## 2 443 40.6 Inf 363 522
## 3 446 40.6 Inf 367 526
## 4 416 40.6 Inf 337 496
## 5 443 40.6 Inf 364 523
## 6 399 40.6 Inf 320 479
##
## session = 2:
## stepNumber emmean SE df asymp.LCL asymp.UCL
## 1 794 40.4 Inf 714 873
## 2 317 40.4 Inf 238 396
## 3 300 40.4 Inf 221 379
## 4 284 40.4 Inf 205 363
## 5 319 40.4 Inf 240 399
## 6 320 40.4 Inf 241 400
##
## session = 3:
## stepNumber emmean SE df asymp.LCL asymp.UCL
## 1 631 40.5 Inf 552 710
## 2 269 40.5 Inf 190 348
## 3 248 40.5 Inf 169 327
## 4 237 40.5 Inf 157 316
## 5 269 40.5 Inf 189 348
## 6 284 40.5 Inf 204 363
##
## session = 4:
## stepNumber emmean SE df asymp.LCL asymp.UCL
## 1 598 40.5 Inf 519 677
## 2 250 40.5 Inf 170 329
## 3 232 40.5 Inf 153 311
## 4 208 40.5 Inf 128 287
## 5 248 40.5 Inf 169 328
## 6 275 40.5 Inf 196 354
##
## session = 5:
## stepNumber emmean SE df asymp.LCL asymp.UCL
## 1 515 40.5 Inf 436 594
## 2 221 40.5 Inf 142 301
## 3 211 40.5 Inf 132 291
## 4 193 40.5 Inf 113 272
## 5 217 40.5 Inf 138 297
## 6 235 40.5 Inf 156 314
##
## session = 6:
## stepNumber emmean SE df asymp.LCL asymp.UCL
## 1 669 40.5 Inf 590 749
## 2 279 40.5 Inf 199 358
## 3 289 40.5 Inf 210 369
## 4 298 40.5 Inf 218 377
## 5 298 40.5 Inf 218 377
## 6 285 40.5 Inf 206 365
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
##
## $contrasts
## session = 1:
## contrast estimate SE df z.ratio p.value
## stepNumber1 - stepNumber2 584.966 13.0 Inf 45.055 <.0001
## stepNumber1 - stepNumber3 581.288 13.0 Inf 44.771 <.0001
## stepNumber1 - stepNumber4 611.251 13.0 Inf 47.079 <.0001
## stepNumber1 - stepNumber5 584.308 13.0 Inf 45.004 <.0001
## stepNumber1 - stepNumber6 628.234 13.0 Inf 48.387 <.0001
## stepNumber2 - stepNumber3 -3.677 13.0 Inf -0.283 0.9998
## stepNumber2 - stepNumber4 26.286 13.0 Inf 2.025 0.3282
## stepNumber2 - stepNumber5 -0.658 13.0 Inf -0.051 1.0000
## stepNumber2 - stepNumber6 43.269 13.0 Inf 3.333 0.0111
## stepNumber3 - stepNumber4 29.963 13.0 Inf 2.308 0.1907
## stepNumber3 - stepNumber5 3.020 13.0 Inf 0.233 0.9999
## stepNumber3 - stepNumber6 46.946 13.0 Inf 3.616 0.0041
## stepNumber4 - stepNumber5 -26.943 13.0 Inf -2.075 0.3003
## stepNumber4 - stepNumber6 16.983 13.0 Inf 1.308 0.7808
## stepNumber5 - stepNumber6 43.926 13.0 Inf 3.383 0.0094
##
## session = 2:
## contrast estimate SE df z.ratio p.value
## stepNumber1 - stepNumber2 476.747 11.7 Inf 40.627 <.0001
## stepNumber1 - stepNumber3 493.702 11.7 Inf 42.072 <.0001
## stepNumber1 - stepNumber4 509.863 11.7 Inf 43.449 <.0001
## stepNumber1 - stepNumber5 474.250 11.7 Inf 40.414 <.0001
## stepNumber1 - stepNumber6 473.302 11.7 Inf 40.333 <.0001
## stepNumber2 - stepNumber3 16.956 11.7 Inf 1.445 0.6994
## stepNumber2 - stepNumber4 33.117 11.7 Inf 2.822 0.0540
## stepNumber2 - stepNumber5 -2.497 11.7 Inf -0.213 0.9999
## stepNumber2 - stepNumber6 -3.445 11.7 Inf -0.294 0.9997
## stepNumber3 - stepNumber4 16.161 11.7 Inf 1.377 0.7409
## stepNumber3 - stepNumber5 -19.453 11.7 Inf -1.658 0.5600
## stepNumber3 - stepNumber6 -20.400 11.7 Inf -1.738 0.5061
## stepNumber4 - stepNumber5 -35.614 11.7 Inf -3.035 0.0290
## stepNumber4 - stepNumber6 -36.561 11.7 Inf -3.116 0.0226
## stepNumber5 - stepNumber6 -0.948 11.7 Inf -0.081 1.0000
##
## session = 3:
## contrast estimate SE df z.ratio p.value
## stepNumber1 - stepNumber2 362.205 11.8 Inf 30.585 <.0001
## stepNumber1 - stepNumber3 383.045 11.8 Inf 32.345 <.0001
## stepNumber1 - stepNumber4 394.242 11.8 Inf 33.290 <.0001
## stepNumber1 - stepNumber5 362.498 11.8 Inf 30.610 <.0001
## stepNumber1 - stepNumber6 347.406 11.8 Inf 29.335 <.0001
## stepNumber2 - stepNumber3 20.840 11.8 Inf 1.760 0.4920
## stepNumber2 - stepNumber4 32.037 11.8 Inf 2.705 0.0742
## stepNumber2 - stepNumber5 0.293 11.8 Inf 0.025 1.0000
## stepNumber2 - stepNumber6 -14.799 11.8 Inf -1.250 0.8122
## stepNumber3 - stepNumber4 11.197 11.8 Inf 0.945 0.9346
## stepNumber3 - stepNumber5 -20.547 11.8 Inf -1.735 0.5084
## stepNumber3 - stepNumber6 -35.639 11.8 Inf -3.009 0.0314
## stepNumber4 - stepNumber5 -31.744 11.8 Inf -2.680 0.0791
## stepNumber4 - stepNumber6 -46.836 11.8 Inf -3.955 0.0011
## stepNumber5 - stepNumber6 -15.092 11.8 Inf -1.274 0.7991
##
## session = 4:
## contrast estimate SE df z.ratio p.value
## stepNumber1 - stepNumber2 348.634 11.9 Inf 29.227 <.0001
## stepNumber1 - stepNumber3 365.990 11.9 Inf 30.682 <.0001
## stepNumber1 - stepNumber4 390.532 11.9 Inf 32.740 <.0001
## stepNumber1 - stepNumber5 349.647 11.9 Inf 29.312 <.0001
## stepNumber1 - stepNumber6 323.258 11.9 Inf 27.100 <.0001
## stepNumber2 - stepNumber3 17.355 11.9 Inf 1.455 0.6931
## stepNumber2 - stepNumber4 41.898 11.9 Inf 3.512 0.0059
## stepNumber2 - stepNumber5 1.012 11.9 Inf 0.085 1.0000
## stepNumber2 - stepNumber6 -25.376 11.9 Inf -2.127 0.2730
## stepNumber3 - stepNumber4 24.543 11.9 Inf 2.057 0.3099
## stepNumber3 - stepNumber5 -16.343 11.9 Inf -1.370 0.7451
## stepNumber3 - stepNumber6 -42.732 11.9 Inf -3.582 0.0046
## stepNumber4 - stepNumber5 -40.886 11.9 Inf -3.428 0.0080
## stepNumber4 - stepNumber6 -67.274 11.9 Inf -5.640 <.0001
## stepNumber5 - stepNumber6 -26.389 11.9 Inf -2.212 0.2319
##
## session = 5:
## contrast estimate SE df z.ratio p.value
## stepNumber1 - stepNumber2 293.639 11.8 Inf 24.846 <.0001
## stepNumber1 - stepNumber3 303.614 11.8 Inf 25.690 <.0001
## stepNumber1 - stepNumber4 322.231 11.8 Inf 27.265 <.0001
## stepNumber1 - stepNumber5 297.502 11.8 Inf 25.173 <.0001
## stepNumber1 - stepNumber6 279.794 11.8 Inf 23.675 <.0001
## stepNumber2 - stepNumber3 9.976 11.8 Inf 0.844 0.9592
## stepNumber2 - stepNumber4 28.592 11.8 Inf 2.419 0.1495
## stepNumber2 - stepNumber5 3.863 11.8 Inf 0.327 0.9995
## stepNumber2 - stepNumber6 -13.845 11.8 Inf -1.171 0.8506
## stepNumber3 - stepNumber4 18.616 11.8 Inf 1.575 0.6150
## stepNumber3 - stepNumber5 -6.112 11.8 Inf -0.517 0.9955
## stepNumber3 - stepNumber6 -23.820 11.8 Inf -2.016 0.3333
## stepNumber4 - stepNumber5 -24.729 11.8 Inf -2.092 0.2911
## stepNumber4 - stepNumber6 -42.437 11.8 Inf -3.591 0.0045
## stepNumber5 - stepNumber6 -17.708 11.8 Inf -1.498 0.6654
##
## session = 6:
## contrast estimate SE df z.ratio p.value
## stepNumber1 - stepNumber2 390.385 12.2 Inf 32.074 <.0001
## stepNumber1 - stepNumber3 379.807 12.2 Inf 31.205 <.0001
## stepNumber1 - stepNumber4 371.671 12.2 Inf 30.537 <.0001
## stepNumber1 - stepNumber5 371.524 12.2 Inf 30.525 <.0001
## stepNumber1 - stepNumber6 383.924 12.2 Inf 31.544 <.0001
## stepNumber2 - stepNumber3 -10.578 12.2 Inf -0.869 0.9539
## stepNumber2 - stepNumber4 -18.714 12.2 Inf -1.538 0.6398
## stepNumber2 - stepNumber5 -18.861 12.2 Inf -1.550 0.6319
## stepNumber2 - stepNumber6 -6.461 12.2 Inf -0.531 0.9949
## stepNumber3 - stepNumber4 -8.136 12.2 Inf -0.668 0.9854
## stepNumber3 - stepNumber5 -8.284 12.2 Inf -0.681 0.9841
## stepNumber3 - stepNumber6 4.117 12.2 Inf 0.338 0.9994
## stepNumber4 - stepNumber5 -0.147 12.2 Inf -0.012 1.0000
## stepNumber4 - stepNumber6 12.253 12.2 Inf 1.007 0.9159
## stepNumber5 - stepNumber6 12.400 12.2 Inf 1.019 0.9118
##
## Degrees-of-freedom method: asymptotic
## P value adjustment: tukey method for comparing a family of 6 estimates
#Theta Brain wave analysis
df_theta <- read.xlsx("/Users/johan/Documents/UTwente/M12_Thesis/DataAnalysis/eeg_data_theta_RT.xlsx")
df_theta$subject = factor(df_theta$subject)
df_theta$block = factor(df_theta$block, ordered = TRUE, levels=c('1', '2', '3', '4', '5', '6'))
str(df_theta)
## 'data.frame': 16944 obs. of 8 variables:
## $ C3 : num -17.53 -3.67 94.28 64.35 219.21 ...
## $ C4 : num 272 146 346 2111 829 ...
## $ Cz : num 11.2 -29 268.7 706.2 532.1 ...
## $ step : num 1 2 3 4 5 6 1 2 3 4 ...
## $ subject : Factor w/ 12 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ block : Ord.factor w/ 6 levels "1"<"2"<"3"<"4"<..: 1 1 1 1 1 1 1 1 1 1 ...
## $ trial : num 1 1 1 1 1 1 2 2 2 2 ...
## $ feedback.RT: num 2811 257 251 245 431 ...
#Learning model without outliers and only accurate trials
learn.model.C3 <- lmer(C3 ~ block + (1|subject), data=df_theta, REML = FALSE)
learn.model.C4 <- lmer(C4 ~ block + (1|subject), data=df_theta, REML = FALSE)
learn.model.Cz <- lmer(Cz ~ block + (1|subject), data=df_theta, REML = FALSE)
aic_models <- AIC(learn.model.C3, learn.model.C4, learn.model.Cz)
aic_models #C3 is the best fit so only use that from now on
Anova(learn.model.Cz)
summary(learn.model.Cz)
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: Cz ~ block + (1 | subject)
## Data: df_theta
##
## AIC BIC logLik deviance df.resid
## 302987.5 303049.4 -151485.7 302971.5 16936
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.565 -0.198 -0.105 0.022 36.676
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 449803 670.7
## Residual 3399608 1843.8
## Number of obs: 16944, groups: subject, 12
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 509.44 194.13 12.01 2.624 0.02220 *
## block.L -116.38 35.67 16933.07 -3.263 0.00111 **
## block.Q 70.61 35.44 16932.46 1.992 0.04639 *
## block.C 226.32 34.63 16932.31 6.536 6.52e-11 ***
## block^4 37.23 34.16 16932.12 1.090 0.27568
## block^5 -68.45 34.16 16932.05 -2.004 0.04509 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) blck.L blck.Q blck.C blck^4
## block.L -0.002
## block.Q 0.004 -0.048
## block.C -0.002 0.058 -0.026
## block^4 0.002 -0.018 0.022 -0.008
## block^5 0.000 0.013 -0.008 0.000 0.004
#Effects
#Training Model effects
learn.model.effects<-allEffects(learn.model.Cz)
learn.model.df<-as.data.frame(learn.model.effects[[1]])
#Theta plots
y_position <- max(learn.model.df$fit + 50) + max(learn.model.df$se)
learn.model.plot <- ggplot(learn.model.df, aes(x=block, y=fit))+
geom_point(aes(color = block)) +
geom_errorbar(aes(ymin=fit-se, ymax=fit+se, fill=block, color=block),
width=.2,position=position_dodge(.9)) +
geom_rect(aes(xmin = 5 - 0.5, xmax = 6 + 0.5, ymin = -Inf, ymax = Inf),
fill = NA, color = "black", size = 1) +
geom_rect(aes(xmin = 1 - 0.25, xmax = 4 + 0.5, ymin = -Inf, ymax = Inf),
fill = NA, color = "black", size = 1) +
annotate("text", x = (1 + 4) / 2, y = y_position, label = "Training blocks", color = "black", size = 5, fontface = "bold") +
annotate("text", x = (5 + 6) / 2, y = y_position, label = "Test blocks", color = "black", size = 5, fontface = "bold") +
ylab("Average Relative Theta Power")+
xlab("Block")+
ggtitle("")+
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(), axis.line = element_line(colour = "black"))
## Warning in geom_errorbar(aes(ymin = fit - se, ymax = fit + se, fill = block, :
## Ignoring unknown aesthetics: fill
plot(learn.model.plot)
#Posthocs contrasts
emm.learn.model <- emmeans(learn.model.Cz, pairwise ~ block)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16944' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16944)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16944' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16944)' or larger];
## but be warned that this may result in large computation time and memory use.
print(emm.learn.model)
## $emmeans
## block emmean SE df asymp.LCL asymp.UCL
## 1 545 197 Inf 158.0 931
## 2 619 197 Inf 233.7 1004
## 3 617 197 Inf 231.9 1003
## 4 368 197 Inf -17.2 754
## 5 342 197 Inf -42.9 728
## 6 565 197 Inf 179.8 951
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df z.ratio p.value
## block1 - block2 -74.37 50.4 Inf -1.475 0.6805
## block1 - block3 -72.69 50.7 Inf -1.435 0.7058
## block1 - block4 176.32 50.9 Inf 3.467 0.0070
## block1 - block5 202.14 50.6 Inf 3.991 0.0009
## block1 - block6 -20.97 51.3 Inf -0.408 0.9985
## block2 - block3 1.68 48.0 Inf 0.035 1.0000
## block2 - block4 250.68 48.2 Inf 5.202 <.0001
## block2 - block5 276.50 48.0 Inf 5.765 <.0001
## block2 - block6 53.40 48.7 Inf 1.097 0.8828
## block3 - block4 249.00 48.4 Inf 5.147 <.0001
## block3 - block5 274.83 48.2 Inf 5.707 <.0001
## block3 - block6 51.72 48.9 Inf 1.058 0.8978
## block4 - block5 25.82 48.3 Inf 0.534 0.9948
## block4 - block6 -197.28 49.0 Inf -4.022 0.0008
## block5 - block6 -223.10 48.8 Inf -4.568 0.0001
##
## Degrees-of-freedom method: asymptotic
## P value adjustment: tukey method for comparing a family of 6 estimates
#Concatenation Analysis EEG All Blocks (Cz)
df_theta$step = factor(df_theta$step)
df_theta$subject = as.factor(df_theta$subject)
df_theta$block = factor(df_theta$block, ordered = TRUE, levels=c('1' ,'2', '3', '4', '5', '6'))
modelCz <- lmer(Cz ~ block * step + (1|subject), data = df_theta, REML = FALSE)
Anova(modelCz)
summary(modelCz, ddf="Satterthwaite")
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: Cz ~ block * step + (1 | subject)
## Data: df_theta
##
## AIC BIC logLik deviance df.resid
## 302819.5 303113.5 -151371.8 302743.5 16906
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.751 -0.240 -0.076 0.060 36.752
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 449830 670.7
## Residual 3354143 1831.4
## Number of obs: 16944, groups: subject, 12
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 239.875 196.675 12.654 1.220 0.24484
## block.L -44.656 86.580 16932.189 -0.516 0.60602
## block.Q -1.625 86.150 16932.085 -0.019 0.98495
## block.C 21.077 84.197 16932.061 0.250 0.80233
## block^4 -24.541 83.082 16932.029 -0.295 0.76771
## block^5 -61.570 83.097 16932.017 -0.741 0.45874
## step2 328.744 48.855 16932.011 6.729 1.76e-11 ***
## step3 437.434 48.855 16932.011 8.954 < 2e-16 ***
## step4 487.949 48.855 16932.011 9.988 < 2e-16 ***
## step5 327.124 48.855 16932.011 6.696 2.21e-11 ***
## step6 36.139 48.855 16932.011 0.740 0.45947
## block.L:step2 19.428 122.385 16932.011 0.159 0.87387
## block.Q:step2 8.911 121.809 16932.011 0.073 0.94168
## block.C:step2 320.084 119.056 16932.011 2.689 0.00718 **
## block^4:step2 99.247 117.490 16932.011 0.845 0.39827
## block^5:step2 -71.203 117.515 16932.011 -0.606 0.54458
## block.L:step3 -50.667 122.385 16932.011 -0.414 0.67888
## block.Q:step3 58.454 121.809 16932.011 0.480 0.63132
## block.C:step3 526.401 119.056 16932.011 4.421 9.86e-06 ***
## block^4:step3 124.001 117.490 16932.011 1.055 0.29125
## block^5:step3 -95.400 117.515 16932.011 -0.812 0.41691
## block.L:step4 -83.834 122.385 16932.011 -0.685 0.49335
## block.Q:step4 66.619 121.809 16932.011 0.547 0.58445
## block.C:step4 363.142 119.056 16932.011 3.050 0.00229 **
## block^4:step4 21.488 117.490 16932.011 0.183 0.85489
## block^5:step4 -53.527 117.515 16932.011 -0.455 0.64876
## block.L:step5 -187.564 122.385 16932.011 -1.533 0.12540
## block.Q:step5 218.569 121.809 16932.011 1.794 0.07277 .
## block.C:step5 46.834 119.056 16932.011 0.393 0.69404
## block^4:step5 68.580 117.490 16932.011 0.584 0.55942
## block^5:step5 101.352 117.515 16932.011 0.862 0.38845
## block.L:step6 -127.697 122.385 16932.011 -1.043 0.29678
## block.Q:step6 80.828 121.809 16932.011 0.664 0.50698
## block.C:step6 -25.007 119.056 16932.011 -0.210 0.83363
## block^4:step6 57.328 117.490 16932.011 0.488 0.62560
## block^5:step6 77.512 117.515 16932.011 0.660 0.50952
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 36 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
# Model Cz effects
modelCz.effects <- allEffects(modelCz)
modelCz.df <- as.data.frame(modelCz.effects[[1]])
#Facet wrap labels
block.labels <- c("Block 1", "Block 2", "Block 3", "Block 4", "Block 5", "Block 6")
names(block.labels) <- c("1", "2", "3", "4", "5", "6")
#Concatenation per blocks
modelCz.plot <- ggplot(modelCz.df, aes(x=step,y=fit,color = block))+
geom_errorbar(aes(ymin=fit-se, ymax=fit+se), width=.1) +
geom_path(aes(x=step, y=fit, group=block)) +
geom_line() +
geom_point(aes())+
ylab("Theta power over Cz")+
xlab("Steps")+
ggtitle("")+
facet_wrap(~ block, nrow = 2, labeller = labeller(session = block.labels))+
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"))
plot(modelCz.plot)
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
#Overall Concatenation
modelCz.plot2 <- ggplot(modelCz.df, aes(x=step,y=fit,color=block))+
geom_ribbon(aes(ymin=fit-se, ymax=fit+se, group=block), alpha=0.2) +
geom_path(aes(x=step, y=fit, group=block)) +
geom_line() +
geom_point(aes(color = block))+
ylab("Relative Theta Power")+
xlab("Steps")+
ggtitle("Concatenation for Groups in Blocks 1-6")+
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(), axis.line = element_line(colour = "black"))
plot(modelCz.plot2)
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
modelCz.plot3 <- ggplot(modelCz.df, aes(x = step, y = fit, color = block, group = block)) +
geom_smooth() +
ylab("Theta power") +
xlab("Steps") +
ggtitle("Concatenation for Groups in Blocks 1-6")
# Print the plot
print(modelCz.plot3)
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in sqrt(sum.squares/one.delta): NaNs produced
## Warning in stats::qt(level/2 + 0.5, pred$df): NaNs produced
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in sqrt(sum.squares/one.delta): NaNs produced
## Warning in stats::qt(level/2 + 0.5, pred$df): NaNs produced
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in sqrt(sum.squares/one.delta): NaNs produced
## Warning in stats::qt(level/2 + 0.5, pred$df): NaNs produced
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in sqrt(sum.squares/one.delta): NaNs produced
## Warning in stats::qt(level/2 + 0.5, pred$df): NaNs produced
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in sqrt(sum.squares/one.delta): NaNs produced
## Warning in stats::qt(level/2 + 0.5, pred$df): NaNs produced
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in sqrt(sum.squares/one.delta): NaNs produced
## Warning in stats::qt(level/2 + 0.5, pred$df): NaNs produced
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
emm.learn.model <- emmeans(modelCz, pairwise ~ block)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16944' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16944)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16944' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16944)' or larger];
## but be warned that this may result in large computation time and memory use.
## NOTE: Results may be misleading due to involvement in interactions
print(emm.learn.model)
## $emmeans
## block emmean SE df asymp.LCL asymp.UCL
## 1 545 197 Inf 158.1 931
## 2 619 196 Inf 233.7 1004
## 3 617 197 Inf 232.0 1002
## 4 368 197 Inf -17.1 754
## 5 342 197 Inf -42.8 728
## 6 565 197 Inf 179.9 951
##
## Results are averaged over the levels of: step
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df z.ratio p.value
## block1 - block2 -74.37 50.1 Inf -1.485 0.6741
## block1 - block3 -72.69 50.3 Inf -1.444 0.6997
## block1 - block4 176.32 50.5 Inf 3.490 0.0064
## block1 - block5 202.14 50.3 Inf 4.018 0.0008
## block1 - block6 -20.97 51.0 Inf -0.411 0.9985
## block2 - block3 1.68 47.7 Inf 0.035 1.0000
## block2 - block4 250.68 47.9 Inf 5.237 <.0001
## block2 - block5 276.51 47.6 Inf 5.804 <.0001
## block2 - block6 53.40 48.4 Inf 1.104 0.8798
## block3 - block4 249.01 48.1 Inf 5.182 <.0001
## block3 - block5 274.83 47.8 Inf 5.745 <.0001
## block3 - block6 51.72 48.5 Inf 1.065 0.8951
## block4 - block5 25.82 48.0 Inf 0.538 0.9946
## block4 - block6 -197.28 48.7 Inf -4.049 0.0007
## block5 - block6 -223.10 48.5 Inf -4.599 0.0001
##
## Results are averaged over the levels of: step
## Degrees-of-freedom method: asymptotic
## P value adjustment: tukey method for comparing a family of 6 estimates
emm.learn.modelCz.all <- emmeans(modelCz, pairwise ~ step|block)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16944' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16944)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16944' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16944)' or larger];
## but be warned that this may result in large computation time and memory use.
print(emm.learn.modelCz.all)
## $emmeans
## block = 1:
## step emmean SE df asymp.LCL asymp.UCL
## 1 257 214 Inf -162.18 676
## 2 483 214 Inf 63.76 902
## 3 590 214 Inf 170.68 1009
## 4 704 214 Inf 284.31 1123
## 5 805 214 Inf 385.39 1224
## 6 429 214 Inf 9.64 848
##
## block = 2:
## step emmean SE df asymp.LCL asymp.UCL
## 1 262 210 Inf -150.64 674
## 2 671 210 Inf 258.47 1083
## 3 885 210 Inf 472.88 1297
## 4 933 210 Inf 520.52 1345
## 5 650 210 Inf 237.36 1062
## 6 314 210 Inf -98.67 726
##
## block = 3:
## step emmean SE df asymp.LCL asymp.UCL
## 1 282 211 Inf -131.09 695
## 2 782 211 Inf 369.24 1195
## 3 964 211 Inf 550.79 1376
## 4 901 211 Inf 487.91 1314
## 5 512 211 Inf 99.10 925
## 6 263 211 Inf -149.58 676
##
## block = 4:
## step emmean SE df asymp.LCL asymp.UCL
## 1 181 211 Inf -232.38 594
## 2 405 211 Inf -7.98 819
## 3 417 211 Inf 3.31 830
## 4 496 211 Inf 82.61 909
## 5 466 211 Inf 52.73 879
## 6 244 211 Inf -168.83 658
##
## block = 5:
## step emmean SE df asymp.LCL asymp.UCL
## 1 246 211 Inf -166.34 659
## 2 380 211 Inf -32.44 793
## 3 344 211 Inf -68.35 757
## 4 512 211 Inf 99.49 925
## 5 387 211 Inf -25.56 800
## 6 184 211 Inf -228.67 597
##
## block = 6:
## step emmean SE df asymp.LCL asymp.UCL
## 1 212 212 Inf -202.98 626
## 2 690 212 Inf 275.80 1105
## 3 864 212 Inf 449.67 1279
## 4 822 212 Inf 407.24 1236
## 5 583 212 Inf 168.09 997
## 6 222 212 Inf -192.66 637
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
##
## $contrasts
## block = 1:
## contrast estimate SE df z.ratio p.value
## step1 - step2 -225.95 129 Inf -1.758 0.4933
## step1 - step3 -332.87 129 Inf -2.590 0.0997
## step1 - step4 -446.49 129 Inf -3.474 0.0068
## step1 - step5 -547.58 129 Inf -4.260 0.0003
## step1 - step6 -171.82 129 Inf -1.337 0.7646
## step2 - step3 -106.92 129 Inf -0.832 0.9617
## step2 - step4 -220.54 129 Inf -1.716 0.5212
## step2 - step5 -321.63 129 Inf -2.502 0.1234
## step2 - step6 54.13 129 Inf 0.421 0.9983
## step3 - step4 -113.62 129 Inf -0.884 0.9505
## step3 - step5 -214.71 129 Inf -1.670 0.5515
## step3 - step6 161.05 129 Inf 1.253 0.8105
## step4 - step5 -101.08 129 Inf -0.786 0.9699
## step4 - step6 274.67 129 Inf 2.137 0.2682
## step5 - step6 375.76 129 Inf 2.923 0.0405
##
## block = 2:
## contrast estimate SE df z.ratio p.value
## step1 - step2 -409.11 116 Inf -3.521 0.0057
## step1 - step3 -623.52 116 Inf -5.367 <.0001
## step1 - step4 -671.17 116 Inf -5.777 <.0001
## step1 - step5 -388.01 116 Inf -3.340 0.0109
## step1 - step6 -51.97 116 Inf -0.447 0.9978
## step2 - step3 -214.41 116 Inf -1.846 0.4363
## step2 - step4 -262.05 116 Inf -2.256 0.2126
## step2 - step5 21.11 116 Inf 0.182 1.0000
## step2 - step6 357.14 116 Inf 3.074 0.0258
## step3 - step4 -47.64 116 Inf -0.410 0.9985
## step3 - step5 235.52 116 Inf 2.027 0.3267
## step3 - step6 571.55 116 Inf 4.920 <.0001
## step4 - step5 283.16 116 Inf 2.437 0.1435
## step4 - step6 619.20 116 Inf 5.330 <.0001
## step5 - step6 336.04 116 Inf 2.892 0.0443
##
## block = 3:
## contrast estimate SE df z.ratio p.value
## step1 - step2 -500.33 117 Inf -4.267 0.0003
## step1 - step3 -681.89 117 Inf -5.816 <.0001
## step1 - step4 -619.00 117 Inf -5.280 <.0001
## step1 - step5 -230.19 117 Inf -1.963 0.3636
## step1 - step6 18.49 117 Inf 0.158 1.0000
## step2 - step3 -181.56 117 Inf -1.549 0.6326
## step2 - step4 -118.67 117 Inf -1.012 0.9141
## step2 - step5 270.14 117 Inf 2.304 0.1923
## step2 - step6 518.82 117 Inf 4.425 0.0001
## step3 - step4 62.88 117 Inf 0.536 0.9947
## step3 - step5 451.70 117 Inf 3.853 0.0016
## step3 - step6 700.38 117 Inf 5.974 <.0001
## step4 - step5 388.81 117 Inf 3.316 0.0118
## step4 - step6 637.49 117 Inf 5.437 <.0001
## step5 - step6 248.68 117 Inf 2.121 0.2763
##
## block = 4:
## contrast estimate SE df z.ratio p.value
## step1 - step2 -224.41 118 Inf -1.900 0.4019
## step1 - step3 -235.70 118 Inf -1.996 0.3446
## step1 - step4 -314.99 118 Inf -2.667 0.0819
## step1 - step5 -285.12 118 Inf -2.414 0.1512
## step1 - step6 -63.55 118 Inf -0.538 0.9946
## step2 - step3 -11.29 118 Inf -0.096 1.0000
## step2 - step4 -90.58 118 Inf -0.767 0.9730
## step2 - step5 -60.71 118 Inf -0.514 0.9957
## step2 - step6 160.85 118 Inf 1.362 0.7498
## step3 - step4 -79.29 118 Inf -0.671 0.9851
## step3 - step5 -49.42 118 Inf -0.418 0.9984
## step3 - step6 172.14 118 Inf 1.458 0.6914
## step4 - step5 29.87 118 Inf 0.253 0.9999
## step4 - step6 251.44 118 Inf 2.129 0.2721
## step5 - step6 221.57 118 Inf 1.876 0.4169
##
## block = 5:
## contrast estimate SE df z.ratio p.value
## step1 - step2 -133.89 117 Inf -1.144 0.8628
## step1 - step3 -97.99 117 Inf -0.837 0.9606
## step1 - step4 -265.83 117 Inf -2.272 0.2056
## step1 - step5 -140.78 117 Inf -1.203 0.8355
## step1 - step6 62.34 117 Inf 0.533 0.9949
## step2 - step3 35.91 117 Inf 0.307 0.9996
## step2 - step4 -131.93 117 Inf -1.128 0.8701
## step2 - step5 -6.89 117 Inf -0.059 1.0000
## step2 - step6 196.23 117 Inf 1.677 0.5470
## step3 - step4 -167.84 117 Inf -1.434 0.7059
## step3 - step5 -42.80 117 Inf -0.366 0.9991
## step3 - step6 160.32 117 Inf 1.370 0.7450
## step4 - step5 125.05 117 Inf 1.069 0.8939
## step4 - step6 328.16 117 Inf 2.805 0.0567
## step5 - step6 203.12 117 Inf 1.736 0.5078
##
## block = 6:
## contrast estimate SE df z.ratio p.value
## step1 - step2 -478.78 120 Inf -3.973 0.0010
## step1 - step3 -652.65 120 Inf -5.416 <.0001
## step1 - step4 -610.22 120 Inf -5.064 <.0001
## step1 - step5 -371.07 120 Inf -3.079 0.0253
## step1 - step6 -10.32 120 Inf -0.086 1.0000
## step2 - step3 -173.87 120 Inf -1.443 0.7006
## step2 - step4 -131.44 120 Inf -1.091 0.8853
## step2 - step5 107.70 120 Inf 0.894 0.9481
## step2 - step6 468.46 120 Inf 3.888 0.0014
## step3 - step4 42.43 120 Inf 0.352 0.9993
## step3 - step5 281.58 120 Inf 2.337 0.1793
## step3 - step6 642.33 120 Inf 5.331 <.0001
## step4 - step5 239.15 120 Inf 1.985 0.3511
## step4 - step6 599.90 120 Inf 4.978 <.0001
## step5 - step6 360.75 120 Inf 2.994 0.0329
##
## Degrees-of-freedom method: asymptotic
## P value adjustment: tukey method for comparing a family of 6 estimates
#Concatenation Analysis EEG for all blocks (Cz)
modelCz.test.model <- lmer(Cz ~ block * step + (1|subject), data = df_theta, REML = FALSE)
Anova(modelCz.test.model)
summary(modelCz.test.model, ddf="Satterthwaite")
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: Cz ~ block * step + (1 | subject)
## Data: df_theta
##
## AIC BIC logLik deviance df.resid
## 302819.5 303113.5 -151371.8 302743.5 16906
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.751 -0.240 -0.076 0.060 36.752
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 449830 670.7
## Residual 3354143 1831.4
## Number of obs: 16944, groups: subject, 12
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 239.875 196.675 12.654 1.220 0.24484
## block.L -44.656 86.580 16932.189 -0.516 0.60602
## block.Q -1.625 86.150 16932.085 -0.019 0.98495
## block.C 21.077 84.197 16932.061 0.250 0.80233
## block^4 -24.541 83.082 16932.029 -0.295 0.76771
## block^5 -61.570 83.097 16932.017 -0.741 0.45874
## step2 328.744 48.855 16932.011 6.729 1.76e-11 ***
## step3 437.434 48.855 16932.011 8.954 < 2e-16 ***
## step4 487.949 48.855 16932.011 9.988 < 2e-16 ***
## step5 327.124 48.855 16932.011 6.696 2.21e-11 ***
## step6 36.139 48.855 16932.011 0.740 0.45947
## block.L:step2 19.428 122.385 16932.011 0.159 0.87387
## block.Q:step2 8.911 121.809 16932.011 0.073 0.94168
## block.C:step2 320.084 119.056 16932.011 2.689 0.00718 **
## block^4:step2 99.247 117.490 16932.011 0.845 0.39827
## block^5:step2 -71.203 117.515 16932.011 -0.606 0.54458
## block.L:step3 -50.667 122.385 16932.011 -0.414 0.67888
## block.Q:step3 58.454 121.809 16932.011 0.480 0.63132
## block.C:step3 526.401 119.056 16932.011 4.421 9.86e-06 ***
## block^4:step3 124.001 117.490 16932.011 1.055 0.29125
## block^5:step3 -95.400 117.515 16932.011 -0.812 0.41691
## block.L:step4 -83.834 122.385 16932.011 -0.685 0.49335
## block.Q:step4 66.619 121.809 16932.011 0.547 0.58445
## block.C:step4 363.142 119.056 16932.011 3.050 0.00229 **
## block^4:step4 21.488 117.490 16932.011 0.183 0.85489
## block^5:step4 -53.527 117.515 16932.011 -0.455 0.64876
## block.L:step5 -187.564 122.385 16932.011 -1.533 0.12540
## block.Q:step5 218.569 121.809 16932.011 1.794 0.07277 .
## block.C:step5 46.834 119.056 16932.011 0.393 0.69404
## block^4:step5 68.580 117.490 16932.011 0.584 0.55942
## block^5:step5 101.352 117.515 16932.011 0.862 0.38845
## block.L:step6 -127.697 122.385 16932.011 -1.043 0.29678
## block.Q:step6 80.828 121.809 16932.011 0.664 0.50698
## block.C:step6 -25.007 119.056 16932.011 -0.210 0.83363
## block^4:step6 57.328 117.490 16932.011 0.488 0.62560
## block^5:step6 77.512 117.515 16932.011 0.660 0.50952
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 36 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
modelCz.test.effects <- allEffects(modelCz.test.model)
modelCz.test.df <- as.data.frame(modelCz.test.effects[[1]])
#Facet wrap labels
block.labels <- c("Block 1", "Block 2", "Block 3", "Block 4", "Block 5", "Block 6")
names(block.labels) <- c("1", "2", "3", "4","5", "6")
#Concatenation per blocks
modelCz.test.plot1 <- ggplot(modelCz.test.df, aes(x=step,y=fit, color = block))+
geom_errorbar(aes(ymin=fit-se, ymax=fit+se), width=.1) +
geom_path(aes(x=step, y=fit, group=block)) +
geom_line() +
geom_point(aes())+
ylab("Relative Theta Power")+
xlab("Steps")+
ggtitle("")+
facet_wrap(~ block, nrow = 2, labeller = labeller(session = block.labels))+
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"))
plot(modelCz.test.plot1)
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
#Overall Concatenation
modelCz.test.plot2 <- ggplot(modelCz.test.df, aes(x=step,y=fit,color=block))+
geom_ribbon(aes(ymin=fit-se, ymax=fit+se, group=block), alpha=0.2) +
geom_path(aes(x=step, y=fit, group=block)) +
geom_line() +
geom_point(aes(color = block)) +
ylab("Relative Theta Power") +
xlab("Steps")+
ggtitle("Concatenation for Groups in Blocks 5-6")+
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(), axis.line = element_line(colour = "black"))
plot(modelCz.test.plot2)
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
modelCz.test.plot3 <- ggplot(modelCz.test.df, aes(x = step, y = fit, color = block, group = block)) +
geom_smooth() +
ylab("Relative Theta Power") +
xlab("Steps") +
ggtitle("Concatenation for Groups in Blocks 5 & 6")
# Print the plot
print(modelCz.test.plot3)
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in sqrt(sum.squares/one.delta): NaNs produced
## Warning in stats::qt(level/2 + 0.5, pred$df): NaNs produced
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in sqrt(sum.squares/one.delta): NaNs produced
## Warning in stats::qt(level/2 + 0.5, pred$df): NaNs produced
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in sqrt(sum.squares/one.delta): NaNs produced
## Warning in stats::qt(level/2 + 0.5, pred$df): NaNs produced
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in sqrt(sum.squares/one.delta): NaNs produced
## Warning in stats::qt(level/2 + 0.5, pred$df): NaNs produced
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in sqrt(sum.squares/one.delta): NaNs produced
## Warning in stats::qt(level/2 + 0.5, pred$df): NaNs produced
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : Chernobyl! trL>n 6
## Warning in sqrt(sum.squares/one.delta): NaNs produced
## Warning in stats::qt(level/2 + 0.5, pred$df): NaNs produced
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
emm.learn.modelCz.test <- emmeans(modelCz.test.model, pairwise ~ block)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16944' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16944)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16944' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16944)' or larger];
## but be warned that this may result in large computation time and memory use.
## NOTE: Results may be misleading due to involvement in interactions
print(emm.learn.modelCz.test)
## $emmeans
## block emmean SE df asymp.LCL asymp.UCL
## 1 545 197 Inf 158.1 931
## 2 619 196 Inf 233.7 1004
## 3 617 197 Inf 232.0 1002
## 4 368 197 Inf -17.1 754
## 5 342 197 Inf -42.8 728
## 6 565 197 Inf 179.9 951
##
## Results are averaged over the levels of: step
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df z.ratio p.value
## block1 - block2 -74.37 50.1 Inf -1.485 0.6741
## block1 - block3 -72.69 50.3 Inf -1.444 0.6997
## block1 - block4 176.32 50.5 Inf 3.490 0.0064
## block1 - block5 202.14 50.3 Inf 4.018 0.0008
## block1 - block6 -20.97 51.0 Inf -0.411 0.9985
## block2 - block3 1.68 47.7 Inf 0.035 1.0000
## block2 - block4 250.68 47.9 Inf 5.237 <.0001
## block2 - block5 276.51 47.6 Inf 5.804 <.0001
## block2 - block6 53.40 48.4 Inf 1.104 0.8798
## block3 - block4 249.01 48.1 Inf 5.182 <.0001
## block3 - block5 274.83 47.8 Inf 5.745 <.0001
## block3 - block6 51.72 48.5 Inf 1.065 0.8951
## block4 - block5 25.82 48.0 Inf 0.538 0.9946
## block4 - block6 -197.28 48.7 Inf -4.049 0.0007
## block5 - block6 -223.10 48.5 Inf -4.599 0.0001
##
## Results are averaged over the levels of: step
## Degrees-of-freedom method: asymptotic
## P value adjustment: tukey method for comparing a family of 6 estimates
emm.learn.modelCz.test2 <- emmeans(modelCz.test.model, pairwise ~ step|block)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16944' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16944)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16944' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16944)' or larger];
## but be warned that this may result in large computation time and memory use.
print(emm.learn.modelCz.test2)
## $emmeans
## block = 1:
## step emmean SE df asymp.LCL asymp.UCL
## 1 257 214 Inf -162.18 676
## 2 483 214 Inf 63.76 902
## 3 590 214 Inf 170.68 1009
## 4 704 214 Inf 284.31 1123
## 5 805 214 Inf 385.39 1224
## 6 429 214 Inf 9.64 848
##
## block = 2:
## step emmean SE df asymp.LCL asymp.UCL
## 1 262 210 Inf -150.64 674
## 2 671 210 Inf 258.47 1083
## 3 885 210 Inf 472.88 1297
## 4 933 210 Inf 520.52 1345
## 5 650 210 Inf 237.36 1062
## 6 314 210 Inf -98.67 726
##
## block = 3:
## step emmean SE df asymp.LCL asymp.UCL
## 1 282 211 Inf -131.09 695
## 2 782 211 Inf 369.24 1195
## 3 964 211 Inf 550.79 1376
## 4 901 211 Inf 487.91 1314
## 5 512 211 Inf 99.10 925
## 6 263 211 Inf -149.58 676
##
## block = 4:
## step emmean SE df asymp.LCL asymp.UCL
## 1 181 211 Inf -232.38 594
## 2 405 211 Inf -7.98 819
## 3 417 211 Inf 3.31 830
## 4 496 211 Inf 82.61 909
## 5 466 211 Inf 52.73 879
## 6 244 211 Inf -168.83 658
##
## block = 5:
## step emmean SE df asymp.LCL asymp.UCL
## 1 246 211 Inf -166.34 659
## 2 380 211 Inf -32.44 793
## 3 344 211 Inf -68.35 757
## 4 512 211 Inf 99.49 925
## 5 387 211 Inf -25.56 800
## 6 184 211 Inf -228.67 597
##
## block = 6:
## step emmean SE df asymp.LCL asymp.UCL
## 1 212 212 Inf -202.98 626
## 2 690 212 Inf 275.80 1105
## 3 864 212 Inf 449.67 1279
## 4 822 212 Inf 407.24 1236
## 5 583 212 Inf 168.09 997
## 6 222 212 Inf -192.66 637
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
##
## $contrasts
## block = 1:
## contrast estimate SE df z.ratio p.value
## step1 - step2 -225.95 129 Inf -1.758 0.4933
## step1 - step3 -332.87 129 Inf -2.590 0.0997
## step1 - step4 -446.49 129 Inf -3.474 0.0068
## step1 - step5 -547.58 129 Inf -4.260 0.0003
## step1 - step6 -171.82 129 Inf -1.337 0.7646
## step2 - step3 -106.92 129 Inf -0.832 0.9617
## step2 - step4 -220.54 129 Inf -1.716 0.5212
## step2 - step5 -321.63 129 Inf -2.502 0.1234
## step2 - step6 54.13 129 Inf 0.421 0.9983
## step3 - step4 -113.62 129 Inf -0.884 0.9505
## step3 - step5 -214.71 129 Inf -1.670 0.5515
## step3 - step6 161.05 129 Inf 1.253 0.8105
## step4 - step5 -101.08 129 Inf -0.786 0.9699
## step4 - step6 274.67 129 Inf 2.137 0.2682
## step5 - step6 375.76 129 Inf 2.923 0.0405
##
## block = 2:
## contrast estimate SE df z.ratio p.value
## step1 - step2 -409.11 116 Inf -3.521 0.0057
## step1 - step3 -623.52 116 Inf -5.367 <.0001
## step1 - step4 -671.17 116 Inf -5.777 <.0001
## step1 - step5 -388.01 116 Inf -3.340 0.0109
## step1 - step6 -51.97 116 Inf -0.447 0.9978
## step2 - step3 -214.41 116 Inf -1.846 0.4363
## step2 - step4 -262.05 116 Inf -2.256 0.2126
## step2 - step5 21.11 116 Inf 0.182 1.0000
## step2 - step6 357.14 116 Inf 3.074 0.0258
## step3 - step4 -47.64 116 Inf -0.410 0.9985
## step3 - step5 235.52 116 Inf 2.027 0.3267
## step3 - step6 571.55 116 Inf 4.920 <.0001
## step4 - step5 283.16 116 Inf 2.437 0.1435
## step4 - step6 619.20 116 Inf 5.330 <.0001
## step5 - step6 336.04 116 Inf 2.892 0.0443
##
## block = 3:
## contrast estimate SE df z.ratio p.value
## step1 - step2 -500.33 117 Inf -4.267 0.0003
## step1 - step3 -681.89 117 Inf -5.816 <.0001
## step1 - step4 -619.00 117 Inf -5.280 <.0001
## step1 - step5 -230.19 117 Inf -1.963 0.3636
## step1 - step6 18.49 117 Inf 0.158 1.0000
## step2 - step3 -181.56 117 Inf -1.549 0.6326
## step2 - step4 -118.67 117 Inf -1.012 0.9141
## step2 - step5 270.14 117 Inf 2.304 0.1923
## step2 - step6 518.82 117 Inf 4.425 0.0001
## step3 - step4 62.88 117 Inf 0.536 0.9947
## step3 - step5 451.70 117 Inf 3.853 0.0016
## step3 - step6 700.38 117 Inf 5.974 <.0001
## step4 - step5 388.81 117 Inf 3.316 0.0118
## step4 - step6 637.49 117 Inf 5.437 <.0001
## step5 - step6 248.68 117 Inf 2.121 0.2763
##
## block = 4:
## contrast estimate SE df z.ratio p.value
## step1 - step2 -224.41 118 Inf -1.900 0.4019
## step1 - step3 -235.70 118 Inf -1.996 0.3446
## step1 - step4 -314.99 118 Inf -2.667 0.0819
## step1 - step5 -285.12 118 Inf -2.414 0.1512
## step1 - step6 -63.55 118 Inf -0.538 0.9946
## step2 - step3 -11.29 118 Inf -0.096 1.0000
## step2 - step4 -90.58 118 Inf -0.767 0.9730
## step2 - step5 -60.71 118 Inf -0.514 0.9957
## step2 - step6 160.85 118 Inf 1.362 0.7498
## step3 - step4 -79.29 118 Inf -0.671 0.9851
## step3 - step5 -49.42 118 Inf -0.418 0.9984
## step3 - step6 172.14 118 Inf 1.458 0.6914
## step4 - step5 29.87 118 Inf 0.253 0.9999
## step4 - step6 251.44 118 Inf 2.129 0.2721
## step5 - step6 221.57 118 Inf 1.876 0.4169
##
## block = 5:
## contrast estimate SE df z.ratio p.value
## step1 - step2 -133.89 117 Inf -1.144 0.8628
## step1 - step3 -97.99 117 Inf -0.837 0.9606
## step1 - step4 -265.83 117 Inf -2.272 0.2056
## step1 - step5 -140.78 117 Inf -1.203 0.8355
## step1 - step6 62.34 117 Inf 0.533 0.9949
## step2 - step3 35.91 117 Inf 0.307 0.9996
## step2 - step4 -131.93 117 Inf -1.128 0.8701
## step2 - step5 -6.89 117 Inf -0.059 1.0000
## step2 - step6 196.23 117 Inf 1.677 0.5470
## step3 - step4 -167.84 117 Inf -1.434 0.7059
## step3 - step5 -42.80 117 Inf -0.366 0.9991
## step3 - step6 160.32 117 Inf 1.370 0.7450
## step4 - step5 125.05 117 Inf 1.069 0.8939
## step4 - step6 328.16 117 Inf 2.805 0.0567
## step5 - step6 203.12 117 Inf 1.736 0.5078
##
## block = 6:
## contrast estimate SE df z.ratio p.value
## step1 - step2 -478.78 120 Inf -3.973 0.0010
## step1 - step3 -652.65 120 Inf -5.416 <.0001
## step1 - step4 -610.22 120 Inf -5.064 <.0001
## step1 - step5 -371.07 120 Inf -3.079 0.0253
## step1 - step6 -10.32 120 Inf -0.086 1.0000
## step2 - step3 -173.87 120 Inf -1.443 0.7006
## step2 - step4 -131.44 120 Inf -1.091 0.8853
## step2 - step5 107.70 120 Inf 0.894 0.9481
## step2 - step6 468.46 120 Inf 3.888 0.0014
## step3 - step4 42.43 120 Inf 0.352 0.9993
## step3 - step5 281.58 120 Inf 2.337 0.1793
## step3 - step6 642.33 120 Inf 5.331 <.0001
## step4 - step5 239.15 120 Inf 1.985 0.3511
## step4 - step6 599.90 120 Inf 4.978 <.0001
## step5 - step6 360.75 120 Inf 2.994 0.0329
##
## Degrees-of-freedom method: asymptotic
## P value adjustment: tukey method for comparing a family of 6 estimates
theta_RT_model = lmer(Cz ~ feedback.RT + (1|subject), data = df_theta, REML = FALSE)
Anova(theta_RT_model)
summary(theta_RT_model, ddf="Satterthwaite")
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: Cz ~ feedback.RT + (1 | subject)
## Data: df_theta
##
## AIC BIC logLik deviance df.resid
## 302997.0 303027.9 -151494.5 302989.0 16940
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.550 -0.187 -0.105 0.015 36.710
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 432712 657.8
## Residual 3403218 1844.8
## Number of obs: 16944, groups: subject, 12
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.440e+02 1.914e+02 1.227e+01 3.364 0.00547 **
## feedback.RT -3.804e-01 5.529e-02 1.693e+04 -6.879 6.25e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## feedback.RT -0.103
# plot concatenation
theta_RT_model_effects = allEffects(theta_RT_model)
theta_RT_model_effects.df = as.data.frame(theta_RT_model_effects[[1]])
theta_RT_model_plot = ggplot(theta_RT_model_effects.df,
aes(x = feedback.RT, y = fit)) +
geom_errorbar(aes(ymin = fit-se, ymax = fit + se), width=.1) +
geom_line() +
geom_point() +
ylab("Theta Power over Cz") +
xlab("Reaction time (ms)") +
theme_classic()
plot(theta_RT_model_plot)
theta_RT_model_test = lmer(Cz ~ feedback.RT + (1|subject), data = df_theta, REML = FALSE)
Anova(theta_RT_model_test)
summary(theta_RT_model_test, ddf="Satterthwaite")
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: Cz ~ feedback.RT + (1 | subject)
## Data: df_theta
##
## AIC BIC logLik deviance df.resid
## 302997.0 303027.9 -151494.5 302989.0 16940
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.550 -0.187 -0.105 0.015 36.710
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 432712 657.8
## Residual 3403218 1844.8
## Number of obs: 16944, groups: subject, 12
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.440e+02 1.914e+02 1.227e+01 3.364 0.00547 **
## feedback.RT -3.804e-01 5.529e-02 1.693e+04 -6.879 6.25e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## feedback.RT -0.103
# plot concatenation
theta_RT_model_test_effects = allEffects(theta_RT_model_test)
theta_RT_model_test_effects_data = as.data.frame(theta_RT_model_test_effects[[1]])
theta_RT_model_test_plot = ggplot(theta_RT_model_test_effects_data,
aes(x = feedback.RT, y = fit)) +
geom_errorbar(aes(ymin = fit-se, ymax = fit + se), width=.1) +
geom_line() +
geom_point() +
ylab("Theta Cz") +
xlab("Reaction time (ms)") +
ggtitle("Theta against RT (test blocks)")+
theme_classic()
plot(theta_RT_model_test_plot)
theta_RT_block_model = lmer(Cz ~ feedback.RT * block + (1|subject), data = df_theta, REML = FALSE)
Anova(theta_RT_block_model)
summary(theta_RT_block_model, ddf="Satterthwaite")
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: Cz ~ feedback.RT * block + (1 | subject)
## Data: df_theta
##
## AIC BIC logLik deviance df.resid
## 302883.7 302992.0 -151427.8 302855.7 16930
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.633 -0.216 -0.095 0.041 36.764
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 432027 657.3
## Residual 3376535 1837.5
## Number of obs: 16944, groups: subject, 12
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 6.911e+02 1.914e+02 1.231e+01 3.610 0.003443 **
## feedback.RT -4.829e-01 6.075e-02 1.690e+04 -7.950 1.98e-15 ***
## block.L -2.266e+02 5.986e+01 1.693e+04 -3.786 0.000154 ***
## block.Q 1.812e+02 5.905e+01 1.693e+04 3.069 0.002150 **
## block.C 4.658e+02 5.665e+01 1.693e+04 8.223 < 2e-16 ***
## block^4 1.190e+02 5.520e+01 1.693e+04 2.155 0.031189 *
## block^5 -1.748e+02 5.486e+01 1.693e+04 -3.186 0.001445 **
## feedback.RT:block.L 1.579e-01 1.234e-01 1.694e+04 1.280 0.200537
## feedback.RT:block.Q -1.488e-01 1.258e-01 1.694e+04 -1.182 0.237087
## feedback.RT:block.C -7.380e-01 1.293e-01 1.693e+04 -5.709 1.15e-08 ***
## feedback.RT:block^4 -2.525e-01 1.325e-01 1.693e+04 -1.906 0.056716 .
## feedback.RT:block^5 3.482e-01 1.342e-01 1.693e+04 2.595 0.009465 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) fdb.RT blck.L blck.Q blck.C blck^4 blck^5 f.RT:.L f.RT:.Q
## feedback.RT -0.109
## block.L -0.008 -0.035
## block.Q 0.011 0.016 -0.059
## block.C 0.002 -0.017 0.101 -0.054
## block^4 0.004 -0.004 -0.004 0.046 -0.036
## block^5 -0.002 0.034 0.020 0.013 0.007 -0.043
## fdbck.RT:.L -0.011 0.213 -0.783 -0.031 -0.005 0.013 -0.004
## fdbck.RT:.Q 0.007 -0.167 -0.033 -0.783 -0.020 0.005 -0.033 0.106
## fdbck.RT:.C -0.001 -0.034 0.002 -0.024 -0.777 -0.051 0.008 -0.120 0.111
## fdbck.RT:^4 0.001 -0.038 0.010 0.006 -0.048 -0.777 -0.002 -0.060 -0.056
## fdbck.RT:^5 0.005 -0.071 -0.004 -0.029 0.009 -0.002 -0.781 -0.017 0.049
## f.RT:.C f.RT:^4
## feedback.RT
## block.L
## block.Q
## block.C
## block^4
## block^5
## fdbck.RT:.L
## fdbck.RT:.Q
## fdbck.RT:.C
## fdbck.RT:^4 0.176
## fdbck.RT:^5 -0.021 0.076
# plot concatenation
theta_RT_block_model_effects = allEffects(theta_RT_block_model)
theta_RT_block_model_effects_data = as.data.frame(theta_RT_block_model_effects[[1]])
theta_RT_block_model_plot = ggplot(theta_RT_block_model_effects_data,
aes(x = feedback.RT, y = fit)) +
geom_errorbar(aes(ymin = fit-se, ymax = fit + se), width=.1) +
geom_line() +
geom_point() +
ylab("Theta C3") +
xlab("Reaction time (ms)") +
ggtitle("Theta against RT * block")+
facet_wrap(~block) +
theme_classic()
plot(theta_RT_block_model_plot)
theta_RT_step_model = lmer(Cz ~ feedback.RT * step + (1|subject), data = df_theta, REML = FALSE)
Anova(theta_RT_step_model)
summary(theta_RT_step_model, ddf="Satterthwaite")
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: Cz ~ feedback.RT * step + (1 | subject)
## Data: df_theta
##
## AIC BIC logLik deviance df.resid
## 302811.2 302919.5 -151391.6 302783.2 16930
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.699 -0.226 -0.090 0.057 36.814
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 433926 658.7
## Residual 3362106 1833.6
## Number of obs: 16944, groups: subject, 12
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.712e+02 2.042e+02 1.578e+01 0.838 0.4143
## feedback.RT 9.754e-02 9.408e-02 1.694e+04 1.037 0.2998
## step2 5.996e+02 9.545e+01 1.694e+04 6.282 3.42e-10 ***
## step3 8.229e+02 9.512e+01 1.694e+04 8.651 < 2e-16 ***
## step4 7.739e+02 9.483e+01 1.694e+04 8.161 3.54e-16 ***
## step5 3.846e+02 9.739e+01 1.694e+04 3.949 7.89e-05 ***
## step6 -2.228e+01 9.328e+01 1.693e+04 -0.239 0.8112
## feedback.RT:step2 -7.785e-01 1.960e-01 1.694e+04 -3.971 7.18e-05 ***
## feedback.RT:step3 -1.201e+00 1.991e-01 1.694e+04 -6.033 1.64e-09 ***
## feedback.RT:step4 -8.989e-01 2.050e-01 1.694e+04 -4.385 1.17e-05 ***
## feedback.RT:step5 -8.359e-02 2.050e-01 1.694e+04 -0.408 0.6835
## feedback.RT:step6 3.127e-01 1.801e-01 1.694e+04 1.736 0.0826 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) fdb.RT step2 step3 step4 step5 step6 f.RT:2 f.RT:3
## feedback.RT -0.322
## step2 -0.276 0.666
## step3 -0.277 0.668 0.610
## step4 -0.279 0.675 0.612 0.612
## step5 -0.271 0.654 0.595 0.596 0.597
## step6 -0.284 0.687 0.619 0.619 0.622 0.604
## fdbck.RT:s2 0.143 -0.441 -0.781 -0.350 -0.349 -0.340 -0.348
## fdbck.RT:s3 0.140 -0.433 -0.344 -0.775 -0.342 -0.334 -0.341 0.284
## fdbck.RT:s4 0.138 -0.426 -0.337 -0.335 -0.766 -0.325 -0.334 0.276 0.269
## fdbck.RT:s5 0.137 -0.424 -0.332 -0.332 -0.330 -0.791 -0.330 0.269 0.265
## fdbck.RT:s6 0.159 -0.491 -0.374 -0.373 -0.373 -0.362 -0.776 0.294 0.288
## f.RT:4 f.RT:5
## feedback.RT
## step2
## step3
## step4
## step5
## step6
## fdbck.RT:s2
## fdbck.RT:s3
## fdbck.RT:s4
## fdbck.RT:s5 0.256
## fdbck.RT:s6 0.280 0.274
# plot concatenation
theta_RT_step_model_effects = allEffects(theta_RT_step_model)
theta_RT_step_model_effects_data = as.data.frame(theta_RT_step_model_effects[[1]])
theta_RT_step_model_plot = ggplot(theta_RT_step_model_effects_data,
aes(x = feedback.RT, y = fit)) +
geom_errorbar(aes(ymin = fit-se, ymax = fit + se), width=.1) +
geom_line() +
geom_point() +
ylab("Theta C3") +
xlab("Reaction time (ms)") +
ggtitle("Theta against RT * step")+
facet_wrap(~step) +
theme_classic()
plot(theta_RT_step_model_plot)
# Correlation between RT and theta power changes (VERY LOW 0.09)
corRT_theta <- cor.test(df_theta$Cz, df_theta$feedback.RT, method = "pearson")
# Create a scatter plot with a regression line
ggplot(df_theta, aes(x = feedback.RT, y = Cz)) +
geom_point() +
geom_smooth(method = "lm", col = "red") +
labs(title = paste("Scatter Plot with Regression Line\nCorrelation:", round(corRT_theta$estimate, 2)))
## `geom_smooth()` using formula = 'y ~ x'
m.cz.theta <- lmer(Cz~ block * step + (1|subject), data = df_theta)
Anova(m.cz.theta)
summary(m.cz.theta)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Cz ~ block * step + (1 | subject)
## Data: df_theta
##
## REML criterion at convergence: 302363.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.749 -0.240 -0.076 0.060 36.713
##
## Random effects:
## Groups Name Variance Std.Dev.
## subject (Intercept) 490902 700.6
## Residual 3361091 1833.3
## Number of obs: 16944, groups: subject, 12
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 239.866 205.198 11.550 1.169 0.26598
## block.L -44.659 86.670 16897.173 -0.515 0.60637
## block.Q -1.626 86.239 16897.078 -0.019 0.98496
## block.C 21.086 84.284 16897.055 0.250 0.80246
## block^4 -24.548 83.168 16897.026 -0.295 0.76787
## block^5 -61.573 83.183 16897.015 -0.740 0.45918
## step2 328.744 48.905 16897.009 6.722 1.85e-11 ***
## step3 437.434 48.905 16897.009 8.945 < 2e-16 ***
## step4 487.949 48.905 16897.009 9.977 < 2e-16 ***
## step5 327.124 48.905 16897.009 6.689 2.32e-11 ***
## step6 36.139 48.905 16897.009 0.739 0.45994
## block.L:step2 19.428 122.511 16897.009 0.159 0.87400
## block.Q:step2 8.911 121.935 16897.009 0.073 0.94174
## block.C:step2 320.084 119.179 16897.009 2.686 0.00724 **
## block^4:step2 99.247 117.611 16897.009 0.844 0.39876
## block^5:step2 -71.203 117.636 16897.009 -0.605 0.54500
## block.L:step3 -50.667 122.511 16897.009 -0.414 0.67920
## block.Q:step3 58.454 121.935 16897.009 0.479 0.63167
## block.C:step3 526.401 119.179 16897.009 4.417 1.01e-05 ***
## block^4:step3 124.001 117.611 16897.009 1.054 0.29175
## block^5:step3 -95.400 117.636 16897.009 -0.811 0.41739
## block.L:step4 -83.834 122.511 16897.009 -0.684 0.49380
## block.Q:step4 66.619 121.935 16897.009 0.546 0.58484
## block.C:step4 363.142 119.179 16897.009 3.047 0.00231 **
## block^4:step4 21.488 117.611 16897.009 0.183 0.85503
## block^5:step4 -53.527 117.636 16897.009 -0.455 0.64910
## block.L:step5 -187.564 122.511 16897.009 -1.531 0.12579
## block.Q:step5 218.569 121.935 16897.009 1.792 0.07307 .
## block.C:step5 46.834 119.179 16897.009 0.393 0.69435
## block^4:step5 68.580 117.611 16897.009 0.583 0.55983
## block^5:step5 101.352 117.636 16897.009 0.862 0.38894
## block.L:step6 -127.697 122.511 16897.009 -1.042 0.29728
## block.Q:step6 80.828 121.935 16897.009 0.663 0.50742
## block.C:step6 -25.007 119.179 16897.009 -0.210 0.83380
## block^4:step6 57.328 117.611 16897.009 0.487 0.62596
## block^5:step6 77.512 117.636 16897.009 0.659 0.50996
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 36 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
emm.m.cz.theta <- emmeans(m.cz.theta, pairwise ~ step|block)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16944' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16944)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16944' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16944)' or larger];
## but be warned that this may result in large computation time and memory use.
print(emm.m.cz.theta)
## $emmeans
## block = 1:
## step emmean SE df asymp.LCL asymp.UCL
## 1 257 222 Inf -177.67 692
## 2 483 222 Inf 48.28 918
## 3 590 222 Inf 155.20 1025
## 4 704 222 Inf 268.82 1138
## 5 805 222 Inf 369.91 1239
## 6 429 222 Inf -5.85 864
##
## block = 2:
## step emmean SE df asymp.LCL asymp.UCL
## 1 262 218 Inf -166.36 690
## 2 671 218 Inf 242.76 1099
## 3 885 218 Inf 457.17 1313
## 4 933 218 Inf 504.81 1361
## 5 650 218 Inf 221.65 1078
## 6 314 218 Inf -114.38 741
##
## block = 3:
## step emmean SE df asymp.LCL asymp.UCL
## 1 282 219 Inf -146.79 710
## 2 782 219 Inf 353.54 1211
## 3 964 219 Inf 535.09 1392
## 4 901 219 Inf 472.21 1329
## 5 512 219 Inf 83.40 940
## 6 263 219 Inf -165.28 692
##
## block = 4:
## step emmean SE df asymp.LCL asymp.UCL
## 1 181 219 Inf -248.08 610
## 2 405 219 Inf -23.67 834
## 3 417 219 Inf -12.38 846
## 4 496 219 Inf 66.91 925
## 5 466 219 Inf 37.04 895
## 6 244 219 Inf -184.52 673
##
## block = 5:
## step emmean SE df asymp.LCL asymp.UCL
## 1 246 219 Inf -182.04 675
## 2 380 219 Inf -48.15 809
## 3 344 219 Inf -84.06 773
## 4 512 219 Inf 83.79 941
## 5 387 219 Inf -41.26 816
## 6 184 219 Inf -244.38 612
##
## block = 6:
## step emmean SE df asymp.LCL asymp.UCL
## 1 212 220 Inf -218.62 642
## 2 690 220 Inf 260.16 1121
## 3 864 220 Inf 434.03 1295
## 4 822 220 Inf 391.60 1252
## 5 583 220 Inf 152.45 1013
## 6 222 220 Inf -208.30 652
##
## Degrees-of-freedom method: asymptotic
## Confidence level used: 0.95
##
## $contrasts
## block = 1:
## contrast estimate SE df z.ratio p.value
## step1 - step2 -225.95 129 Inf -1.756 0.4945
## step1 - step3 -332.87 129 Inf -2.587 0.1004
## step1 - step4 -446.49 129 Inf -3.470 0.0069
## step1 - step5 -547.58 129 Inf -4.256 0.0003
## step1 - step6 -171.82 129 Inf -1.335 0.7653
## step2 - step3 -106.92 129 Inf -0.831 0.9619
## step2 - step4 -220.54 129 Inf -1.714 0.5224
## step2 - step5 -321.63 129 Inf -2.500 0.1241
## step2 - step6 54.13 129 Inf 0.421 0.9983
## step3 - step4 -113.62 129 Inf -0.883 0.9507
## step3 - step5 -214.71 129 Inf -1.669 0.5527
## step3 - step6 161.05 129 Inf 1.252 0.8112
## step4 - step5 -101.08 129 Inf -0.786 0.9700
## step4 - step6 274.67 129 Inf 2.135 0.2693
## step5 - step6 375.76 129 Inf 2.920 0.0409
##
## block = 2:
## contrast estimate SE df z.ratio p.value
## step1 - step2 -409.11 116 Inf -3.518 0.0058
## step1 - step3 -623.52 116 Inf -5.361 <.0001
## step1 - step4 -671.17 116 Inf -5.771 <.0001
## step1 - step5 -388.01 116 Inf -3.336 0.0110
## step1 - step6 -51.97 116 Inf -0.447 0.9978
## step2 - step3 -214.41 116 Inf -1.844 0.4375
## step2 - step4 -262.05 116 Inf -2.253 0.2136
## step2 - step5 21.11 116 Inf 0.181 1.0000
## step2 - step6 357.14 116 Inf 3.071 0.0260
## step3 - step4 -47.64 116 Inf -0.410 0.9985
## step3 - step5 235.52 116 Inf 2.025 0.3279
## step3 - step6 571.55 116 Inf 4.914 <.0001
## step4 - step5 283.16 116 Inf 2.435 0.1443
## step4 - step6 619.20 116 Inf 5.324 <.0001
## step5 - step6 336.04 116 Inf 2.889 0.0447
##
## block = 3:
## contrast estimate SE df z.ratio p.value
## step1 - step2 -500.33 117 Inf -4.263 0.0003
## step1 - step3 -681.89 117 Inf -5.810 <.0001
## step1 - step4 -619.00 117 Inf -5.274 <.0001
## step1 - step5 -230.19 117 Inf -1.961 0.3648
## step1 - step6 18.49 117 Inf 0.158 1.0000
## step2 - step3 -181.56 117 Inf -1.547 0.6337
## step2 - step4 -118.67 117 Inf -1.011 0.9144
## step2 - step5 270.14 117 Inf 2.302 0.1932
## step2 - step6 518.82 117 Inf 4.420 0.0001
## step3 - step4 62.88 117 Inf 0.536 0.9947
## step3 - step5 451.70 117 Inf 3.849 0.0017
## step3 - step6 700.38 117 Inf 5.967 <.0001
## step4 - step5 388.81 117 Inf 3.313 0.0119
## step4 - step6 637.49 117 Inf 5.432 <.0001
## step5 - step6 248.68 117 Inf 2.119 0.2774
##
## block = 4:
## contrast estimate SE df z.ratio p.value
## step1 - step2 -224.41 118 Inf -1.898 0.4031
## step1 - step3 -235.70 118 Inf -1.994 0.3458
## step1 - step4 -314.99 118 Inf -2.664 0.0825
## step1 - step5 -285.12 118 Inf -2.412 0.1520
## step1 - step6 -63.55 118 Inf -0.538 0.9946
## step2 - step3 -11.29 118 Inf -0.096 1.0000
## step2 - step4 -90.58 118 Inf -0.766 0.9731
## step2 - step5 -60.71 118 Inf -0.514 0.9957
## step2 - step6 160.85 118 Inf 1.361 0.7506
## step3 - step4 -79.29 118 Inf -0.671 0.9851
## step3 - step5 -49.42 118 Inf -0.418 0.9984
## step3 - step6 172.14 118 Inf 1.456 0.6923
## step4 - step5 29.87 118 Inf 0.253 0.9999
## step4 - step6 251.44 118 Inf 2.127 0.2733
## step5 - step6 221.57 118 Inf 1.874 0.4181
##
## block = 5:
## contrast estimate SE df z.ratio p.value
## step1 - step2 -133.89 117 Inf -1.143 0.8633
## step1 - step3 -97.99 117 Inf -0.837 0.9607
## step1 - step4 -265.83 117 Inf -2.270 0.2066
## step1 - step5 -140.78 117 Inf -1.202 0.8361
## step1 - step6 62.34 117 Inf 0.532 0.9949
## step2 - step3 35.91 117 Inf 0.307 0.9996
## step2 - step4 -131.93 117 Inf -1.126 0.8706
## step2 - step5 -6.89 117 Inf -0.059 1.0000
## step2 - step6 196.23 117 Inf 1.675 0.5482
## step3 - step4 -167.84 117 Inf -1.433 0.7068
## step3 - step5 -42.80 117 Inf -0.365 0.9992
## step3 - step6 160.32 117 Inf 1.369 0.7458
## step4 - step5 125.05 117 Inf 1.068 0.8943
## step4 - step6 328.16 117 Inf 2.802 0.0572
## step5 - step6 203.12 117 Inf 1.734 0.5090
##
## block = 6:
## contrast estimate SE df z.ratio p.value
## step1 - step2 -478.78 121 Inf -3.969 0.0010
## step1 - step3 -652.65 121 Inf -5.411 <.0001
## step1 - step4 -610.22 121 Inf -5.059 <.0001
## step1 - step5 -371.07 121 Inf -3.076 0.0256
## step1 - step6 -10.32 121 Inf -0.086 1.0000
## step2 - step3 -173.87 121 Inf -1.441 0.7016
## step2 - step4 -131.44 121 Inf -1.090 0.8857
## step2 - step5 107.70 121 Inf 0.893 0.9483
## step2 - step6 468.46 121 Inf 3.884 0.0014
## step3 - step4 42.43 121 Inf 0.352 0.9993
## step3 - step5 281.58 121 Inf 2.334 0.1803
## step3 - step6 642.33 121 Inf 5.325 <.0001
## step4 - step5 239.15 121 Inf 1.983 0.3523
## step4 - step6 599.90 121 Inf 4.973 <.0001
## step5 - step6 360.75 121 Inf 2.991 0.0332
##
## Degrees-of-freedom method: asymptotic
## P value adjustment: tukey method for comparing a family of 6 estimates
ae.m.cz.theta<-allEffects(m.cz.theta)
ae.m.cz.theta.df<-as.data.frame(ae.m.cz.theta[[1]])
plot(ae.m.cz.theta)
#Cz Posthocs blocks
emmp.m.cz.theta<-emmip(m.cz.theta, ~ step|block)
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'pbkrtest.limit = 16944' (or larger)
## [or, globally, 'set emm_options(pbkrtest.limit = 16944)' or larger];
## but be warned that this may result in large computation time and memory use.
## Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
## To enable adjustments, add the argument 'lmerTest.limit = 16944' (or larger)
## [or, globally, 'set emm_options(lmerTest.limit = 16944)' or larger];
## but be warned that this may result in large computation time and memory use.
print(emmp.m.cz.theta)
#Cz change conf interval to 83%, match p = .05
ae.m.cz.theta.df$l83 <- ae.m.cz.theta.df$fit - 1.3722 * ae.m.cz.theta.df$se
ae.m.cz.theta.df$u83 <- ae.m.cz.theta.df$fit + 1.3722 * ae.m.cz.theta.df$se
#Cz Effects Plot
plot.cztheta <- ggplot(ae.m.cz.theta.df, aes(x=step, y=fit, ymin=l83, ymax=u83))+
geom_point(aes(color = block), size=3) +
geom_path(aes(x=step, y=fit, group=block, colour=block)) +
geom_ribbon(aes(ymin=l83, ymax=u83, group=block, fill=block), alpha=0.2) +
ylab("ERDS (%)")+
xlab("Step Position")+
ggtitle("Learning Phase Concatenation ERDS")+
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(), axis.line = element_line(colour = "black"))+
facet_wrap(~block)
print(plot.cztheta)