1 Read in data

1.1 We are using xlsx files to recover original text files: this won’t be necessary in the future

(xl.files <- list.files('.','^Sub.*xlsx'))
##  [1] "Sub1.xlsx"  "Sub10.xlsx" "Sub11.xlsx" "Sub12.xlsx" "Sub13.xlsx"
##  [6] "Sub14.xlsx" "Sub15.xlsx" "Sub16.xlsx" "Sub18.xlsx" "Sub19.xlsx"
## [11] "Sub2.xlsx"  "Sub20.xlsx" "Sub21.xlsx" "Sub22.xlsx" "Sub23.xlsx"
## [16] "Sub24.xlsx" "Sub25.xlsx" "Sub26.xlsx" "Sub27.xlsx" "Sub28.xlsx"
## [21] "Sub29.xlsx" "Sub3.xlsx"  "Sub31.xlsx" "Sub32.xlsx" "Sub33.xlsx"
## [26] "Sub35.xlsx" "Sub36.xlsx" "Sub37.xlsx" "Sub39.xlsx" "Sub40.xlsx"
## [31] "Sub41.xlsx" "Sub42.xlsx" "Sub43.xlsx" "Sub44.xlsx" "Sub45.xlsx"
## [36] "Sub47.xlsx" "Sub5.xlsx"  "Sub6.xlsx"  "Sub7.xlsx"

1.2 convert xlsx back to original txt in a loop over xl.files

for (i in seq_along(xl.files)) write_delim(read_xlsx(xl.files[i]), file=str_replace(xl.files[i], '.xlsx', '.txt'))

1.3 Here’s our list of txt files:

(txt.files <- list.files('.','^Sub.*txt'))
##  [1] "Sub1.txt"  "Sub10.txt" "Sub11.txt" "Sub12.txt" "Sub13.txt" "Sub14.txt"
##  [7] "Sub15.txt" "Sub16.txt" "Sub18.txt" "Sub19.txt" "Sub2.txt"  "Sub20.txt"
## [13] "Sub21.txt" "Sub22.txt" "Sub23.txt" "Sub24.txt" "Sub25.txt" "Sub26.txt"
## [19] "Sub27.txt" "Sub28.txt" "Sub29.txt" "Sub3.txt"  "Sub31.txt" "Sub32.txt"
## [25] "Sub33.txt" "Sub35.txt" "Sub36.txt" "Sub37.txt" "Sub39.txt" "Sub40.txt"
## [31] "Sub41.txt" "Sub42.txt" "Sub43.txt" "Sub44.txt" "Sub45.txt" "Sub47.txt"
## [37] "Sub5.txt"  "Sub6.txt"  "Sub7.txt"

1.4 What are the header names? We’ll need to make sense of those

(headers <- names(read_delim(txt.files[1])))
## Rows: 1 Columns: 49
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: " "
## chr  (1): ERPset
## dbl (48): bin17_HighNoSw_FC1, bin17_HighNoSw_C1, bin17_HighNoSw_CP1, bin17_H...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
##  [1] "bin17_HighNoSw_FC1" "bin17_HighNoSw_C1"  "bin17_HighNoSw_CP1"
##  [4] "bin17_HighNoSw_P1"  "bin17_HighNoSw_Pz"  "bin17_HighNoSw_CPz"
##  [7] "bin17_HighNoSw_FC2" "bin17_HighNoSw_FCz" "bin17_HighNoSw_Cz" 
## [10] "bin17_HighNoSw_C2"  "bin17_HighNoSw_CP2" "bin17_HighNoSw_P2" 
## [13] "bin18_HighSw_FC1"   "bin18_HighSw_C1"    "bin18_HighSw_CP1"  
## [16] "bin18_HighSw_P1"    "bin18_HighSw_Pz"    "bin18_HighSw_CPz"  
## [19] "bin18_HighSw_FC2"   "bin18_HighSw_FCz"   "bin18_HighSw_Cz"   
## [22] "bin18_HighSw_C2"    "bin18_HighSw_CP2"   "bin18_HighSw_P2"   
## [25] "bin19_LowNoSw_FC1"  "bin19_LowNoSw_C1"   "bin19_LowNoSw_CP1" 
## [28] "bin19_LowNoSw_P1"   "bin19_LowNoSw_Pz"   "bin19_LowNoSw_CPz" 
## [31] "bin19_LowNoSw_FC2"  "bin19_LowNoSw_FCz"  "bin19_LowNoSw_Cz"  
## [34] "bin19_LowNoSw_C2"   "bin19_LowNoSw_CP2"  "bin19_LowNoSw_P2"  
## [37] "bin20_LowSw_FC1"    "bin20_LowSw_C1"     "bin20_LowSw_CP1"   
## [40] "bin20_LowSw_P1"     "bin20_LowSw_Pz"     "bin20_LowSw_CPz"   
## [43] "bin20_LowSw_FC2"    "bin20_LowSw_FCz"    "bin20_LowSw_Cz"    
## [46] "bin20_LowSw_C2"     "bin20_LowSw_CP2"    "bin20_LowSw_P2"    
## [49] "ERPset"

2 Assemble data from individual files into a single table

raw.all <- map_df(txt.files, ~read_table(.x, show_col_types=FALSE))
kable(head(raw.all))
bin17_HighNoSw_FC1 bin17_HighNoSw_C1 bin17_HighNoSw_CP1 bin17_HighNoSw_P1 bin17_HighNoSw_Pz bin17_HighNoSw_CPz bin17_HighNoSw_FC2 bin17_HighNoSw_FCz bin17_HighNoSw_Cz bin17_HighNoSw_C2 bin17_HighNoSw_CP2 bin17_HighNoSw_P2 bin18_HighSw_FC1 bin18_HighSw_C1 bin18_HighSw_CP1 bin18_HighSw_P1 bin18_HighSw_Pz bin18_HighSw_CPz bin18_HighSw_FC2 bin18_HighSw_FCz bin18_HighSw_Cz bin18_HighSw_C2 bin18_HighSw_CP2 bin18_HighSw_P2 bin19_LowNoSw_FC1 bin19_LowNoSw_C1 bin19_LowNoSw_CP1 bin19_LowNoSw_P1 bin19_LowNoSw_Pz bin19_LowNoSw_CPz bin19_LowNoSw_FC2 bin19_LowNoSw_FCz bin19_LowNoSw_Cz bin19_LowNoSw_C2 bin19_LowNoSw_CP2 bin19_LowNoSw_P2 bin20_LowSw_FC1 bin20_LowSw_C1 bin20_LowSw_CP1 bin20_LowSw_P1 bin20_LowSw_Pz bin20_LowSw_CPz bin20_LowSw_FC2 bin20_LowSw_FCz bin20_LowSw_Cz bin20_LowSw_C2 bin20_LowSw_CP2 bin20_LowSw_P2 ERPset
-0.666 -0.215 -0.529 1.019 -1.433 -1.385 -2.415 4.944 -3.569 -5.848 -0.605 -1.497 -2.468 -1.118 -0.690 -2.102 0.611 -2.245 0.460 -2.306 4.247 -1.522 1.436 1.706 -0.586 -0.608 -1.108 -1.703 -3.215 0.681 -0.590 -3.340 -2.690 1.506 -2.095 -3.021 -0.339 0.969 1.527 1.115 -0.281 5.851 -0.417 -1.524 3.487 -2.057 0.513 -1.463 Sub1_erpnew_filt
0.118 2.933 5.043 3.095 5.433 3.778 -1.042 0.668 1.088 -3.192 2.838 5.352 -2.309 -0.851 0.972 4.586 3.721 1.535 -1.607 -2.382 -0.043 2.774 1.105 0.597 -1.688 -0.427 2.826 3.047 3.124 1.900 -2.837 -4.167 1.650 -0.654 1.378 3.761 1.540 -1.213 0.143 2.107 3.779 1.119 2.701 -0.127 -6.058 6.458 3.880 4.431 Sub10_erp_filt
0.877 0.989 1.859 -0.250 -0.081 -0.239 4.400 1.827 0.482 0.346 2.725 0.259 13.888 9.449 3.876 7.845 7.878 6.177 9.951 8.967 4.949 5.950 6.779 5.753 8.502 8.393 7.430 8.295 6.641 7.879 5.850 2.582 9.293 5.153 9.415 8.552 5.870 5.614 5.210 7.396 6.050 6.070 4.567 2.477 3.359 4.646 7.941 5.848 Sub11_erp_filt
5.277 4.107 0.012 0.905 4.870 1.596 4.348 3.748 1.398 5.098 4.078 5.982 -0.103 0.214 -6.290 -4.834 -2.209 -2.600 15.599 5.060 -0.643 6.616 2.114 4.982 -6.992 -2.180 -3.571 -6.358 -10.476 -3.197 5.232 3.233 0.140 2.978 -3.668 -3.945 -0.876 1.685 -1.899 -1.028 -3.432 -1.756 4.145 -1.154 -5.691 -1.860 -1.890 2.906 Sub_12_erp_new_filt
0.474 -2.394 1.857 3.376 3.412 5.498 1.941 1.737 2.238 -1.154 2.494 2.967 -2.570 -2.362 1.429 0.542 1.252 -3.318 -1.151 -1.345 -0.641 0.416 -1.370 1.335 2.482 4.231 3.220 1.826 1.380 10.056 4.617 4.422 2.063 5.424 -0.240 1.591 0.117 0.188 -2.300 0.670 0.571 1.438 -1.081 -0.123 -0.133 -4.800 -2.434 -0.442 Sub13_erp_filt_new
3.334 1.093 -0.133 -1.369 -0.946 1.605 4.752 4.004 3.430 3.297 0.729 -0.126 3.055 2.375 1.308 0.407 -1.003 3.011 3.206 0.277 2.797 2.711 2.553 -0.165 -0.543 1.983 1.441 0.609 0.190 1.876 4.001 2.889 3.641 2.527 2.476 0.610 -0.379 0.231 -0.425 -1.396 2.113 -0.182 1.277 2.332 0.253 0.856 -0.488 0.096 Sub14_erp_filt_new

3 Bringing order into the data and converting to long form

eeg.long <- raw.all %>%
  mutate(ERPset = str_replace(ERPset, 'Sub_', 'Sub')) %>% # fix coding error, such as for Subject 12
  mutate(Participant = str_extract(ERPset,'^.+?(?=_)'), .before=1, .keep='unused') %>% # get Participant ID from ERPse 
  pivot_longer(-1) %>% # convert everything to long form
  mutate(name = str_replace_all(name, '(High|Low)', '\\1_')) %>% # insert underscore following expectancy string 
  mutate(name = str_replace_all(name, '([12z]$)', '_\\1')) %>%  # insert underscore before side suffix
  separate_wider_delim(name, delim='_', names=c('bin','expectancy','switch','region','side')) %>% # generate variables based on underscore pattern
  mutate(across(where(is.character), as.factor)) %>%  # convert characters to factors
  mutate(expectancy = fct_relevel(expectancy, 'Low', 'High')) %>% # reorder factor levels 
  mutate(region = fct_relevel(region, 'FC', 'C', 'CP')) %>% 
  mutate(side = fct_relevel(side, '1', 'z', '2')) %>% 
  mutate(side = fct_recode(side, Left='1', Midline='z', Right='2'))
write.xlsx(eeg.long, 'EEG long format all leads.xlsx', asTable=T) # save to Excel

3.1 Here’s the top of our data file

kable(head(eeg.long,9))
Participant bin expectancy switch region side value
Sub1 bin17 High NoSw FC Left -0.666
Sub1 bin17 High NoSw C Left -0.215
Sub1 bin17 High NoSw CP Left -0.529
Sub1 bin17 High NoSw P Left 1.019
Sub1 bin17 High NoSw P Midline -1.433
Sub1 bin17 High NoSw CP Midline -1.385
Sub1 bin17 High NoSw FC Right -2.415
Sub1 bin17 High NoSw FC Midline 4.944
Sub1 bin17 High NoSw C Midline -3.569

3.2 A look at the levels of all variables

summary(eeg.long)  
##   Participant      bin      expectancy  switch    region        side    
##  Sub1   :  48   bin17:468   Low :936   NoSw:936   FC:468   Left   :624  
##  Sub10  :  48   bin18:468   High:936   Sw  :936   C :468   Midline:624  
##  Sub11  :  48   bin19:468                         CP:468   Right  :624  
##  Sub12  :  48   bin20:468                         P :468                
##  Sub13  :  48                                                           
##  Sub14  :  48                                                           
##  (Other):1584                                                           
##      value         
##  Min.   :-23.2420  
##  1st Qu.: -0.8135  
##  Median :  0.9815  
##  Mean   :  0.6294  
##  3rd Qu.:  2.6510  
##  Max.   : 15.5990  
## 

3.3 Filter out data for Parietal which we won’t use

eeg.noP <- eeg.long %>% filter(region != 'P')

4 Create tables with aggregation over 3 leads for legacy anterior-posterior and left-to-right analyses

(anteriority <- eeg.noP %>% summarize(value = mean(value, na.rm=T), .by=c(Participant, expectancy, switch, region)))
## # A tibble: 468 × 5
##    Participant expectancy switch region  value
##    <fct>       <fct>      <fct>  <fct>   <dbl>
##  1 Sub1        High       NoSw   FC      0.621
##  2 Sub1        High       NoSw   C      -3.21 
##  3 Sub1        High       NoSw   CP     -0.840
##  4 Sub1        High       Sw     FC     -1.44 
##  5 Sub1        High       Sw     C       0.536
##  6 Sub1        High       Sw     CP     -0.500
##  7 Sub1        Low        NoSw   FC     -1.51 
##  8 Sub1        Low        NoSw   C      -0.597
##  9 Sub1        Low        NoSw   CP     -0.841
## 10 Sub1        Low        Sw     FC     -0.76 
## # ℹ 458 more rows
write.xlsx(anteriority, 'EEG anterio-posterior long data.xlsx', asTable=T)

(laterality <- eeg.noP %>% summarize(value = mean(value, na.rm=T), .by=c(Participant, expectancy, switch, side)))
## # A tibble: 468 × 5
##    Participant expectancy switch side       value
##    <fct>       <fct>      <fct>  <fct>      <dbl>
##  1 Sub1        High       NoSw   Left    -0.47   
##  2 Sub1        High       NoSw   Midline -0.00333
##  3 Sub1        High       NoSw   Right   -2.96   
##  4 Sub1        High       Sw     Left    -1.43   
##  5 Sub1        High       Sw     Midline -0.101  
##  6 Sub1        High       Sw     Right    0.125  
##  7 Sub1        Low        NoSw   Left    -0.767  
##  8 Sub1        Low        NoSw   Midline -1.78   
##  9 Sub1        Low        NoSw   Right   -0.393  
## 10 Sub1        Low        Sw     Left     0.719  
## # ℹ 458 more rows
write.xlsx(laterality, 'EEG left-to-right long data.xlsx', asTable=T)

5 Initial modelling: legacy analyses but with varying intercepts for Participants

5.1 Anteriority analysis

summary(m.anteriority <- lmer(value ~ expectancy*switch + switch*region + (1|Participant), anteriority))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: value ~ expectancy * switch + switch * region + (1 | Participant)
##    Data: anteriority
## 
## REML criterion at convergence: 2066.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.7186 -0.5410 -0.0507  0.5178  4.7348 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  Participant (Intercept) 6.840    2.615   
##  Residual                3.745    1.935   
## Number of obs: 468, groups:  Participant, 39
## 
## Fixed effects:
##                          Estimate Std. Error        df t value Pr(>|t|)   
## (Intercept)               1.23682    0.48928  64.21991   2.528  0.01395 * 
## expectancyHigh           -0.16972    0.25301 422.00000  -0.671  0.50272   
## switchSw                 -1.15943    0.35781 422.00000  -3.240  0.00129 **
## regionC                   0.01561    0.30988 422.00000   0.050  0.95986   
## regionCP                 -0.14392    0.30988 422.00000  -0.464  0.64257   
## expectancyHigh:switchSw   0.17184    0.35781 422.00000   0.480  0.63129   
## switchSw:regionC          0.05042    0.43823 422.00000   0.115  0.90846   
## switchSw:regionCP         0.17719    0.43823 422.00000   0.404  0.68617   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) expctH swtchS reginC regnCP expH:S swtS:C
## expctncyHgh -0.259                                          
## switchSw    -0.366  0.354                                   
## regionC     -0.317  0.000  0.433                            
## regionCP    -0.317  0.000  0.433  0.500                     
## expctncyH:S  0.183 -0.707 -0.500  0.000  0.000              
## swtchSw:rgC  0.224  0.000 -0.612 -0.707 -0.354  0.000       
## swtchSw:rCP  0.224  0.000 -0.612 -0.354 -0.707  0.000  0.500
car::Anova(m.anteriority, type=3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
## 
## Response: value
##                     Chisq Df Pr(>Chisq)   
## (Intercept)        6.3900  1   0.011477 * 
## expectancy         0.4500  1   0.502354   
## switch            10.4998  1   0.001194 **
## region             0.3222  2   0.851216   
## expectancy:switch  0.2306  1   0.631043   
## switch:region      0.1736  2   0.916857   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

5.2 Laterality analysis

summary(m.laterality <- lmer(value ~ expectancy*switch + switch*side + (1|Participant), laterality))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: value ~ expectancy * switch + switch * side + (1 | Participant)
##    Data: laterality
## 
## REML criterion at convergence: 1987.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.5634 -0.4910 -0.0361  0.4313  4.9109 
## 
## Random effects:
##  Groups      Name        Variance Std.Dev.
##  Participant (Intercept) 6.893    2.625   
##  Residual                3.106    1.762   
## Number of obs: 468, groups:  Participant, 39
## 
## Fixed effects:
##                          Estimate Std. Error        df t value Pr(>|t|)   
## (Intercept)               0.82661    0.47941  59.34830   1.724  0.08987 . 
## expectancyHigh           -0.16972    0.23042 422.00000  -0.737  0.46179   
## switchSw                 -1.02102    0.32586 422.00000  -3.133  0.00185 **
## sideMidline               0.64762    0.28220 422.00000   2.295  0.02223 * 
## sideRight                 0.45469    0.28220 422.00000   1.611  0.10788   
## expectancyHigh:switchSw   0.17184    0.32586 422.00000   0.527  0.59822   
## switchSw:sideMidline     -0.17159    0.39909 422.00000  -0.430  0.66745   
## switchSw:sideRight       -0.01606    0.39909 422.00000  -0.040  0.96793   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) expctH swtchS sdMdln sdRght expH:S swtS:M
## expctncyHgh -0.240                                          
## switchSw    -0.340  0.354                                   
## sideMidline -0.294  0.000  0.433                            
## sideRight   -0.294  0.000  0.433  0.500                     
## expctncyH:S  0.170 -0.707 -0.500  0.000  0.000              
## swtchSw:sdM  0.208  0.000 -0.612 -0.707 -0.354  0.000       
## swtchSw:sdR  0.208  0.000 -0.612 -0.354 -0.707  0.000  0.500
car::Anova(m.laterality, type=3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
## 
## Response: value
##                    Chisq Df Pr(>Chisq)   
## (Intercept)       2.9729  1   0.084668 . 
## expectancy        0.5425  1   0.461381   
## switch            9.8178  1   0.001728 **
## side              5.5533  2   0.062247 . 
## expectancy:switch 0.2781  1   0.597944   
## switch:side       0.2256  2   0.893341   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

6 Now using all data available and more complex RanEff structures

6.1 Anteriority analysis

6.1.1 Linear mixed model

summary(m.anter <- lmer(value ~ expectancy*switch + switch*region + (1|Participant) + (1|Participant:side), eeg.noP))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: value ~ expectancy * switch + switch * region + (1 | Participant) +  
##     (1 | Participant:side)
##    Data: eeg.noP
## 
## REML criterion at convergence: 6598.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.7967 -0.5365 -0.0308  0.4984  5.9178 
## 
## Random effects:
##  Groups           Name        Variance Std.Dev.
##  Participant:side (Intercept) 0.4226   0.6501  
##  Participant      (Intercept) 6.8565   2.6185  
##  Residual                     5.5704   2.3602  
## Number of obs: 1404, groups:  Participant:side, 117; Participant, 39
## 
## Fixed effects:
##                           Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                1.23682    0.45952   50.34424   2.692  0.00963 ** 
## expectancyHigh            -0.16972    0.17816 1280.00074  -0.953  0.34096    
## switchSw                  -1.15943    0.25195 1280.00074  -4.602  4.6e-06 ***
## regionC                    0.01561    0.21820 1280.00074   0.072  0.94299    
## regionCP                  -0.14392    0.21820 1280.00074  -0.660  0.50964    
## expectancyHigh:switchSw    0.17184    0.25195 1280.00074   0.682  0.49533    
## switchSw:regionC           0.05042    0.30858 1280.00074   0.163  0.87024    
## switchSw:regionCP          0.17719    0.30858 1280.00074   0.574  0.56592    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) expctH swtchS reginC regnCP expH:S swtS:C
## expctncyHgh -0.194                                          
## switchSw    -0.274  0.354                                   
## regionC     -0.237  0.000  0.433                            
## regionCP    -0.237  0.000  0.433  0.500                     
## expctncyH:S  0.137 -0.707 -0.500  0.000  0.000              
## swtchSw:rgC  0.168  0.000 -0.612 -0.707 -0.354  0.000       
## swtchSw:rCP  0.168  0.000 -0.612 -0.354 -0.707  0.000  0.500

6.1.2 Anova

car::Anova(m.anter, type=3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
## 
## Response: value
##                     Chisq Df Pr(>Chisq)    
## (Intercept)        7.2444  1   0.007112 ** 
## expectancy         0.9075  1   0.340777    
## switch            21.1766  1  4.188e-06 ***
## region             0.6498  2   0.722603    
## expectancy:switch  0.4652  1   0.495209    
## switch:region      0.3501  2   0.839397    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

6.1.3 Plot of effects

plot(allEffects(m.anter))

6.2 Laterality analysis

6.2.1 Linear mixed model

summary(m.later <- lmer(value ~ expectancy*switch + switch*side + (1|Participant) + (1|Participant:region), eeg.noP))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: value ~ expectancy * switch + switch * side + (1 | Participant) +  
##     (1 | Participant:region)
##    Data: eeg.noP
## 
## REML criterion at convergence: 6498.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.2794 -0.4841 -0.0278  0.4637  6.0184 
## 
## Random effects:
##  Groups             Name        Variance Std.Dev.
##  Participant:region (Intercept) 1.219    1.104   
##  Participant        (Intercept) 6.608    2.571   
##  Residual                       4.962    2.228   
## Number of obs: 1404, groups:  Participant:region, 117; Participant, 39
## 
## Fixed effects:
##                           Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)                0.82661    0.45620   48.91875   1.812   0.0761 .  
## expectancyHigh            -0.16972    0.16815 1280.00001  -1.009   0.3130    
## switchSw                  -1.02102    0.23780 1280.00001  -4.294 1.89e-05 ***
## sideMidline                0.64762    0.20594 1280.00001   3.145   0.0017 ** 
## sideRight                  0.45469    0.20594 1280.00001   2.208   0.0274 *  
## expectancyHigh:switchSw    0.17184    0.23780 1280.00001   0.723   0.4700    
## switchSw:sideMidline      -0.17159    0.29125 1280.00001  -0.589   0.5559    
## switchSw:sideRight        -0.01606    0.29125 1280.00001  -0.055   0.9560    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) expctH swtchS sdMdln sdRght expH:S swtS:M
## expctncyHgh -0.184                                          
## switchSw    -0.261  0.354                                   
## sideMidline -0.226  0.000  0.433                            
## sideRight   -0.226  0.000  0.433  0.500                     
## expctncyH:S  0.130 -0.707 -0.500  0.000  0.000              
## swtchSw:sdM  0.160  0.000 -0.612 -0.707 -0.354  0.000       
## swtchSw:sdR  0.160  0.000 -0.612 -0.354 -0.707  0.000  0.500

6.2.2 Anova

car::Anova(m.later, type=3)
## Analysis of Deviance Table (Type III Wald chisquare tests)
## 
## Response: value
##                     Chisq Df Pr(>Chisq)    
## (Intercept)        3.2831  1   0.069996 .  
## expectancy         1.0187  1   0.312824    
## switch            18.4345  1  1.758e-05 ***
## side              10.4272  2   0.005442 ** 
## expectancy:switch  0.5222  1   0.469907    
## switch:side        0.4236  2   0.809146    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

6.2.3 Plot of effects

plot(allEffects(m.later))