## `summarise()` regrouping output by 'partID', 'trial', 'pondnum', 'strategy' (override with `.groups` argument)
## `summarise()` regrouping output by 'partID', 'strategy', 'cue' (override with `.groups` argument)

1. Documents & Dataframes

Readin data. TSTM data read in, in hidden chunk above (cause it’s long).

vi <- read.csv('data_out/tstm_vi_outcomes_20210615.csv', header = TRUE, na.strings = NA)
dccs <- read.csv('data_out/tstm_dccs_outcomes_20210615.csv', header = TRUE, na.strings = NA)
indDiffs <- merge(vi, dccs, by = "Subject")

Merge.

str(indDiffs)
## 'data.frame':    99 obs. of  14 variables:
##  $ Subject        : int  3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 ...
##  $ X.x            : int  2 3 4 5 6 7 8 9 10 11 ...
##  $ Age            : num  0 390 0 0 0 0 0 0 0 0 ...
##  $ Gender         : Factor w/ 2 levels "female","male": 1 2 1 1 2 2 1 2 1 1 ...
##  $ VisInspTime    : num  28.4 28.1 29.7 208.8 27.3 ...
##  $ TrialCount     : int  14 18 9 27 18 18 15 18 11 2 ...
##  $ VisInspTime_log: num  3.35 3.33 3.39 5.34 3.31 ...
##  $ X.y            : int  1 2 3 4 5 6 7 8 9 10 ...
##  $ nsw            : num  6.78 7.22 6.63 6.93 6.69 ...
##  $ single         : num  6.21 6.18 5.82 6.19 6.07 ...
##  $ start          : num  6.44 6.72 6.18 6.51 6.49 ...
##  $ sw             : num  6.75 7.05 6.65 6.88 6.76 ...
##  $ sc_local       : num  0.0291 0.1727 -0.0256 0.0472 -0.0767 ...
##  $ mc             : num  0.562 1.044 0.805 0.737 0.615 ...

Exclude extra participants (3051 and 3050).

ex2 <- c(3055, 3063, 3068, 3069, 3076, 3117, 3121, 3120, 3032, 3051, 3050, 5398, 9999)
indDiffs <- indDiffs[!(indDiffs$Subject %in% ex2),]

Shrink dataset

indDiffs <- indDiffs[,c(1,7,13,14)]
colnames(indDiffs) <- c('partID','mSOA','sc_local','mc')

Merge with TSTM.

df <- merge(tstm_measures, indDiffs, by = "partID"); str(df)
## 'data.frame':    2784 obs. of  13 variables:
##  $ partID  : int  3001 3001 3001 3001 3001 3001 3001 3001 3001 3001 ...
##  $ trial   : int  10 8 9 5 12 3 21 22 23 11 ...
##  $ strategy: Factor w/ 3 levels "maint","prac",..: 3 3 3 3 3 3 1 1 1 3 ...
##  $ cue     : Factor w/ 2 levels "False","True": 1 1 1 1 2 1 1 1 1 2 ...
##  $ P1      : num  5 5 5 1 5 5 5 5 5 5 ...
##  $ P2      : num  5 0 5 5 5 0 5 5 5 5 ...
##  $ all     : num  10 5 10 6 10 5 10 10 10 10 ...
##  $ age_grp : Factor w/ 3 levels "a","s","t": 1 1 1 1 1 1 1 1 1 1 ...
##  $ bin     : int  1 0 1 0 1 0 1 1 1 1 ...
##  $ id      : int  8 6 7 3 2 1 3 4 5 1 ...
##  $ mSOA    : num  3.35 3.35 3.35 3.35 3.35 ...
##  $ sc_local: num  0.0291 0.0291 0.0291 0.0291 0.0291 ...
##  $ mc      : num  0.562 0.562 0.562 0.562 0.562 ...
summary(df)
##      partID         trial         strategy       cue             P1       
##  Min.   :3001   Min.   : 3.00   maint :1392   False:1392   Min.   :0.000  
##  1st Qu.:3023   1st Qu.:10.75   prac  :   0   True :1392   1st Qu.:4.000  
##  Median :3072   Median :18.50   switch:1392                Median :5.000  
##  Mean   :3063   Mean   :18.50                              Mean   :4.054  
##  3rd Qu.:3097   3rd Qu.:26.25                              3rd Qu.:5.000  
##  Max.   :3119   Max.   :34.00                              Max.   :5.000  
##        P2             all         age_grp       bin               id      
##  Min.   :0.000   Min.   : 0.000   a:1024   Min.   :0.0000   Min.   :1.00  
##  1st Qu.:5.000   1st Qu.: 6.000   s: 928   1st Qu.:0.0000   1st Qu.:2.75  
##  Median :5.000   Median :10.000   t: 832   Median :1.0000   Median :4.50  
##  Mean   :4.122   Mean   : 8.176            Mean   :0.5636   Mean   :4.50  
##  3rd Qu.:5.000   3rd Qu.:10.000            3rd Qu.:1.0000   3rd Qu.:6.25  
##  Max.   :5.000   Max.   :10.000            Max.   :1.0000   Max.   :8.00  
##       mSOA          sc_local                mc        
##  Min.   :3.275   Min.   :-0.5574095   Min.   :0.2446  
##  1st Qu.:3.459   1st Qu.:-0.1243016   1st Qu.:0.6221  
##  Median :3.907   Median :-0.0617504   Median :0.7406  
##  Mean   :4.021   Mean   :-0.0651224   Mean   :0.7475  
##  3rd Qu.:4.480   3rd Qu.: 0.0004621   3rd Qu.:0.8666  
##  Max.   :5.823   Max.   : 0.3452465   Max.   :1.1925

2. Basics

2.1 Correlations

Hmisc::rcorr(as.matrix(df[,11:13]))
##           mSOA sc_local    mc
## mSOA      1.00     0.04 -0.10
## sc_local  0.04     1.00  0.06
## mc       -0.10     0.06  1.00
## 
## n= 2784 
## 
## 
## P
##          mSOA   sc_local mc    
## mSOA            0.0357   0.0000
## sc_local 0.0357          0.0025
## mc       0.0000 0.0025

2.2 Descriptives

df %>% group_by(age_grp) %>% summarize(avgAcc = mean(bin))
## `summarise()` ungrouping output (override with `.groups` argument)
## # A tibble: 3 x 2
##   age_grp avgAcc
##   <fct>    <dbl>
## 1 a        0.741
## 2 s        0.327
## 3 t        0.609
psych::describe.by(df, group = "age_grp")
## Warning: describe.by is deprecated. Please use the describeBy function
## 
##  Descriptive statistics by group 
## group: a
##           vars    n    mean   sd  median trimmed   mad     min     max range
## partID       1 1024 3017.59 9.85 3017.50 3017.50 11.86 3001.00 3035.00 34.00
## trial        2 1024   18.50 9.24   18.50   18.50 11.86    3.00   34.00 31.00
## strategy*    3 1024    2.00 1.00    2.00    2.00  1.48    1.00    3.00  2.00
## cue*         4 1024    1.50 0.50    1.50    1.50  0.74    1.00    2.00  1.00
## P1           5 1024    4.50 1.35    5.00    4.91  0.00    0.00    5.00  5.00
## P2           6 1024    4.46 1.45    5.00    4.90  0.00    0.00    5.00  5.00
## all          7 1024    8.96 1.85   10.00    9.32  0.00    3.00   10.00  7.00
## age_grp*     8 1024    1.00 0.00    1.00    1.00  0.00    1.00    1.00  0.00
## bin          9 1024    0.74 0.44    1.00    0.80  0.00    0.00    1.00  1.00
## id          10 1024    4.50 2.29    4.50    4.50  2.97    1.00    8.00  7.00
## mSOA        11 1024    3.68 0.48    3.51    3.59  0.28    3.28    5.34  2.07
## sc_local    12 1024   -0.03 0.08   -0.04   -0.03  0.07   -0.21    0.17  0.38
## mc          13 1024    0.74 0.20    0.73    0.73  0.17    0.24    1.17  0.93
##            skew kurtosis   se
## partID     0.05    -1.08 0.31
## trial      0.00    -1.21 0.29
## strategy*  0.00    -2.00 0.03
## cue*       0.00    -2.00 0.02
## P1        -2.47     4.40 0.04
## P2        -2.42     4.13 0.05
## all       -1.32    -0.05 0.06
## age_grp*    NaN      NaN 0.00
## bin       -1.10    -0.79 0.01
## id         0.00    -1.24 0.07
## mSOA       1.66     2.49 0.02
## sc_local   0.34    -0.05 0.00
## mc         0.12     0.07 0.01
## ------------------------------------------------------------ 
## group: s
##           vars   n    mean    sd  median trimmed   mad     min     max range
## partID       1 928 3085.17 16.25 3087.00 3085.44 13.34 3054.00 3116.00 62.00
## trial        2 928   18.50  9.24   18.50   18.50 11.86    3.00   34.00 31.00
## strategy*    3 928    2.00  1.00    2.00    2.00  1.48    1.00    3.00  2.00
## cue*         4 928    1.50  0.50    1.50    1.50  0.74    1.00    2.00  1.00
## P1           5 928    3.47  1.98    5.00    3.71  0.00    0.00    5.00  5.00
## P2           6 928    3.58  1.97    5.00    3.85  0.00    0.00    5.00  5.00
## all          7 928    7.05  2.46    6.00    7.19  1.48    0.00   10.00 10.00
## age_grp*     8 928    2.00  0.00    2.00    2.00  0.00    2.00    2.00  0.00
## bin          9 928    0.33  0.47    0.00    0.28  0.00    0.00    1.00  1.00
## id          10 928    4.50  2.29    4.50    4.50  2.97    1.00    8.00  7.00
## mSOA        11 928    4.49  0.57    4.44    4.47  0.52    3.40    5.82  2.42
## sc_local    12 928   -0.10  0.16   -0.10   -0.10  0.13   -0.56    0.35  0.90
## mc          13 928    0.74  0.21    0.75    0.74  0.23    0.36    1.19  0.84
##            skew kurtosis   se
## partID    -0.14    -0.57 0.53
## trial      0.00    -1.21 0.30
## strategy*  0.00    -2.00 0.03
## cue*       0.00    -2.00 0.02
## P1        -0.75    -1.18 0.06
## P2        -0.87    -1.00 0.06
## all       -0.25    -0.57 0.08
## age_grp*    NaN      NaN 0.00
## bin        0.74    -1.46 0.02
## id         0.00    -1.24 0.08
## mSOA       0.39    -0.44 0.02
## sc_local  -0.15     1.85 0.01
## mc         0.11    -0.51 0.01
## ------------------------------------------------------------ 
## group: t
##           vars   n    mean    sd  median trimmed   mad     min     max range
## partID       1 832 3094.04 19.39 3100.50 3095.65 17.79 3053.00 3119.00 66.00
## trial        2 832   18.50  9.24   18.50   18.50 11.86    3.00   34.00 31.00
## strategy*    3 832    2.00  1.00    2.00    2.00  1.48    1.00    3.00  2.00
## cue*         4 832    1.50  0.50    1.50    1.50  0.74    1.00    2.00  1.00
## P1           5 832    4.16  1.66    5.00    4.50  0.00    0.00    5.00  5.00
## P2           6 832    4.31  1.57    5.00    4.73  0.00    0.00    5.00  5.00
## all          7 832    8.47  2.02   10.00    8.71  0.00    4.00   10.00  6.00
## age_grp*     8 832    3.00  0.00    3.00    3.00  0.00    3.00    3.00  0.00
## bin          9 832    0.61  0.49    1.00    0.64  0.00    0.00    1.00  1.00
## id          10 832    4.50  2.29    4.50    4.50  2.97    1.00    8.00  7.00
## mSOA        11 832    3.92  0.52    3.78    3.87  0.48    3.28    5.09  1.81
## sc_local    12 832   -0.07  0.11   -0.06   -0.07  0.09   -0.27    0.22  0.49
## mc          13 832    0.77  0.17    0.75    0.76  0.16    0.47    1.16  0.69
##            skew kurtosis   se
## partID    -0.63    -0.89 0.67
## trial      0.00    -1.21 0.32
## strategy*  0.00    -2.00 0.03
## cue*       0.00    -2.00 0.02
## P1        -1.56     0.62 0.06
## P2        -1.99     2.24 0.05
## all       -0.69    -1.35 0.07
## age_grp*    NaN      NaN 0.00
## bin       -0.45    -1.80 0.02
## id         0.00    -1.24 0.08
## mSOA       0.69    -0.70 0.02
## sc_local   0.16     0.28 0.00
## mc         0.28    -0.44 0.01

3. Models

3.1 Processing Speed

3.1.1 7-yos

ps_7 <- glmer(bin ~ id*cue*strategy*mSOA + (1|partID), 
                   family = binomial(link = "logit"), 
                   control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=1000000)),
                   data = df[df$age_grp == "s",])
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: large eigenvalue ratio
##  - Rescale variables?
ps_7
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: bin ~ id * cue * strategy * mSOA + (1 | partID)
##    Data: df[df$age_grp == "s", ]
##       AIC       BIC    logLik  deviance  df.resid 
##  741.7276  823.8892 -353.8638  707.7276       911 
## Random effects:
##  Groups Name        Std.Dev.
##  partID (Intercept) 1.294   
## Number of obs: 928, groups:  partID, 29
## Fixed Effects:
##                    (Intercept)                              id  
##                        -6.5305                          2.2541  
##                        cueTrue                  strategyswitch  
##                        17.9581                          9.5346  
##                           mSOA                      id:cueTrue  
##                         0.7670                         -3.2252  
##              id:strategyswitch          cueTrue:strategyswitch  
##                        -2.0127                        -15.5918  
##                        id:mSOA                    cueTrue:mSOA  
##                        -0.4151                         -3.1398  
##            strategyswitch:mSOA       id:cueTrue:strategyswitch  
##                        -2.7983                          2.9631  
##                id:cueTrue:mSOA          id:strategyswitch:mSOA  
##                         0.6671                          0.4650  
##    cueTrue:strategyswitch:mSOA  id:cueTrue:strategyswitch:mSOA  
##                         3.4770                         -0.6962  
## convergence code 0; 0 optimizer warnings; 1 lme4 warnings

3.1.1.1 LR Chi Sqr

car::Anova(ps_7, )
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: bin
##                         Chisq Df Pr(>Chisq)    
## id                    23.2993  1  1.387e-06 ***
## cue                  100.0194  1  < 2.2e-16 ***
## strategy             157.2618  1  < 2.2e-16 ***
## mSOA                   7.3322  1   0.006773 ** 
## id:cue                 7.0659  1   0.007857 ** 
## id:strategy            0.4310  1   0.511476    
## cue:strategy           3.6076  1   0.057516 .  
## id:mSOA                0.0933  1   0.759995    
## cue:mSOA               0.0002  1   0.988130    
## strategy:mSOA          0.3493  1   0.554486    
## id:cue:strategy        0.0056  1   0.940416    
## id:cue:mSOA            6.4850  1   0.010879 *  
## id:strategy:mSOA       0.0648  1   0.799054    
## cue:strategy:mSOA      0.1332  1   0.715154    
## id:cue:strategy:mSOA   2.6521  1   0.103416    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

3.1.1.2 Exponentiated Coeff

jtools::summ(ps_7)
Observations 928
Dependent variable bin
Type Mixed effects generalized linear model
Family binomial
Link logit
AIC 741.73
BIC 823.89
Pseudo-R² (fixed effects) 0.51
Pseudo-R² (total) 0.68
Fixed Effects
Est. S.E. z val. p
(Intercept) -6.53 4.29 -1.52 0.13
id 2.25 0.73 3.09 0.00
cueTrue 17.96 5.17 3.47 0.00
strategyswitch 9.53 9.59 0.99 0.32
mSOA 0.77 0.94 0.81 0.42
id:cueTrue -3.23 1.00 -3.21 0.00
id:strategyswitch -2.01 1.56 -1.29 0.20
cueTrue:strategyswitch -15.59 10.78 -1.45 0.15
id:mSOA -0.42 0.16 -2.58 0.01
cueTrue:mSOA -3.14 1.13 -2.78 0.01
strategyswitch:mSOA -2.80 2.28 -1.23 0.22
id:cueTrue:strategyswitch 2.96 1.84 1.61 0.11
id:cueTrue:mSOA 0.67 0.22 3.02 0.00
id:strategyswitch:mSOA 0.47 0.37 1.27 0.20
cueTrue:strategyswitch:mSOA 3.48 2.53 1.37 0.17
id:cueTrue:strategyswitch:mSOA -0.70 0.43 -1.63 0.10
Random Effects
Group Parameter Std. Dev.
partID (Intercept) 1.29
Grouping Variables
Group # groups ICC
partID 29 0.34

3.1.1.3 Visualizations

plot_model(ps_7, type = "pred", terms = c("mSOA [all]"))

plot_model(ps_7, type = "pred", terms = c("mSOA [all]","cue","id"))

3.1.1.4 Pairwise

emmeans::emtrends(ps_7, pairwise ~ cue, var = "mSOA")
## NOTE: Results may be misleading due to involvement in interactions
## $emtrends
##  cue   mSOA.trend    SE  df asymp.LCL asymp.UCL
##  False      -1.45 0.643 Inf     -2.71    -0.194
##  True       -1.42 0.497 Inf     -2.39    -0.444
## 
## Results are averaged over the levels of: strategy 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast     estimate    SE  df z.ratio p.value
##  False - True  -0.0343 0.524 Inf -0.065  0.9478 
## 
## Results are averaged over the levels of: strategy

3.1.2 10-yos

ps_10 <- glmer(bin ~ id*cue*strategy*mSOA + (1|partID), 
                   family = binomial(link = "logit"), 
                   control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=1000000)),
                   data = df[df$age_grp == "t",])
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: large eigenvalue ratio
##  - Rescale variables?
ps_10
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: bin ~ id * cue * strategy * mSOA + (1 | partID)
##    Data: df[df$age_grp == "t", ]
##       AIC       BIC    logLik  deviance  df.resid 
##  712.6911  792.9963 -339.3456  678.6911       815 
## Random effects:
##  Groups Name        Std.Dev.
##  partID (Intercept) 1.317   
## Number of obs: 832, groups:  partID, 26
## Fixed Effects:
##                    (Intercept)                              id  
##                      -2.346212                        0.085210  
##                        cueTrue                  strategyswitch  
##                       4.528889                       -6.257927  
##                           mSOA                      id:cueTrue  
##                      -0.812763                       -2.535200  
##              id:strategyswitch          cueTrue:strategyswitch  
##                       1.682085                        5.497196  
##                        id:mSOA                    cueTrue:mSOA  
##                       0.270871                        0.571290  
##            strategyswitch:mSOA       id:cueTrue:strategyswitch  
##                       2.232540                        0.208517  
##                id:cueTrue:mSOA          id:strategyswitch:mSOA  
##                       0.472036                       -0.597406  
##    cueTrue:strategyswitch:mSOA  id:cueTrue:strategyswitch:mSOA  
##                      -2.063920                        0.002702  
## convergence code 0; 0 optimizer warnings; 1 lme4 warnings

3.1.2.1 LR Chi Sqr

car::Anova(ps_10)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: bin
##                        Chisq Df Pr(>Chisq)    
## id                   40.9160  1  1.589e-10 ***
## cue                  94.6257  1  < 2.2e-16 ***
## strategy             12.5563  1  0.0003949 ***
## mSOA                  0.4291  1  0.5124305    
## id:cue               29.5847  1  5.352e-08 ***
## id:strategy          14.2209  1  0.0001626 ***
## cue:strategy          6.4956  1  0.0108140 *  
## id:mSOA               0.0532  1  0.8175991    
## cue:mSOA              4.7463  1  0.0293619 *  
## strategy:mSOA         3.4300  1  0.0640229 .  
## id:cue:strategy       0.8932  1  0.3446033    
## id:cue:mSOA           5.6540  1  0.0174155 *  
## id:strategy:mSOA      5.4230  1  0.0198727 *  
## cue:strategy:mSOA     3.2657  1  0.0707436 .  
## id:cue:strategy:mSOA  0.0000  1  0.9958814    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

3.1.2.2 Exponentiated Coeff

jtools::summ(ps_10)
Observations 832
Dependent variable bin
Type Mixed effects generalized linear model
Family binomial
Link logit
AIC 712.69
BIC 793.00
Pseudo-R² (fixed effects) 0.54
Pseudo-R² (total) 0.70
Fixed Effects
Est. S.E. z val. p
(Intercept) -2.35 5.94 -0.39 0.69
id 0.09 1.11 0.08 0.94
cueTrue 4.53 6.98 0.65 0.52
strategyswitch -6.26 6.51 -0.96 0.34
mSOA -0.81 1.53 -0.53 0.60
id:cueTrue -2.54 1.74 -1.45 0.15
id:strategyswitch 1.68 1.27 1.32 0.19
cueTrue:strategyswitch 5.50 8.20 0.67 0.50
id:mSOA 0.27 0.29 0.93 0.35
cueTrue:mSOA 0.57 1.83 0.31 0.75
strategyswitch:mSOA 2.23 1.67 1.34 0.18
id:cueTrue:strategyswitch 0.21 1.94 0.11 0.91
id:cueTrue:mSOA 0.47 0.48 0.99 0.32
id:strategyswitch:mSOA -0.60 0.33 -1.82 0.07
cueTrue:strategyswitch:mSOA -2.06 2.12 -0.97 0.33
id:cueTrue:strategyswitch:mSOA 0.00 0.52 0.01 1.00
Random Effects
Group Parameter Std. Dev.
partID (Intercept) 1.32
Grouping Variables
Group # groups ICC
partID 26 0.35

3.1.2.3 Visualizations

plot_model(ps_10, type = "pred", terms = c("mSOA [all]","cue"))

plot_model(ps_10, type = "pred", terms = c("mSOA [all]","cue","id"))

plot_model(ps_7, type = "pred", terms = c("mSOA [all]","strategy","id"))

3.1.2.4 Pairwise

emmeans::emtrends(ps_10, pairwise ~ cue, var = "mSOA")
## NOTE: Results may be misleading due to involvement in interactions
## $emtrends
##  cue   mSOA.trend    SE  df asymp.LCL asymp.UCL
##  False      0.178 0.573 Inf    -0.945      1.30
##  True       1.848 0.766 Inf     0.347      3.35
## 
## Results are averaged over the levels of: strategy 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast     estimate    SE  df z.ratio p.value
##  False - True    -1.67 0.649 Inf -2.572  0.0101 
## 
## Results are averaged over the levels of: strategy
emmeans::emtrends(ps_10, pairwise ~ strategy, var = "mSOA")
## NOTE: Results may be misleading due to involvement in interactions
## $emtrends
##  strategy mSOA.trend    SE  df asymp.LCL asymp.UCL
##  maint         1.754 0.775 Inf     0.236      3.27
##  switch        0.272 0.556 Inf    -0.817      1.36
## 
## Results are averaged over the levels of: cue 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast       estimate    SE  df z.ratio p.value
##  maint - switch     1.48 0.639 Inf 2.319   0.0204 
## 
## Results are averaged over the levels of: cue

3.1.3 Adults

ps_adult <- glmer(bin ~ id*cue*strategy*mSOA + (1|partID), 
                   family = binomial(link = "logit"), 
                   control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=1000000)),
                   data = df[df$age_grp == "a",])
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: large eigenvalue ratio
##  - Rescale variables?
ps_adult
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: bin ~ id * cue * strategy * mSOA + (1 | partID)
##    Data: df[df$age_grp == "a", ]
##       AIC       BIC    logLik  deviance  df.resid 
##  699.0617  782.8967 -332.5308  665.0617      1007 
## Random effects:
##  Groups Name        Std.Dev.
##  partID (Intercept) 1.366   
## Number of obs: 1024, groups:  partID, 32
## Fixed Effects:
##                    (Intercept)                              id  
##                       -0.53945                         0.70911  
##                        cueTrue                  strategyswitch  
##                       -8.46010                        -4.79045  
##                           mSOA                      id:cueTrue  
##                       -0.51157                         1.82279  
##              id:strategyswitch          cueTrue:strategyswitch  
##                        0.46159                        18.64662  
##                        id:mSOA                    cueTrue:mSOA  
##                        0.05954                         3.90584  
##            strategyswitch:mSOA       id:cueTrue:strategyswitch  
##                        1.01492                        -2.82711  
##                id:cueTrue:mSOA          id:strategyswitch:mSOA  
##                       -0.65114                        -0.19638  
##    cueTrue:strategyswitch:mSOA  id:cueTrue:strategyswitch:mSOA  
##                       -5.40730                         0.81518  
## convergence code 0; 0 optimizer warnings; 1 lme4 warnings

3.1.3.1 LR Chi Sqr

car::Anova(ps_adult)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: bin
##                         Chisq Df Pr(>Chisq)    
## id                    98.6081  1  < 2.2e-16 ***
## cue                  131.0947  1  < 2.2e-16 ***
## strategy              67.5208  1  < 2.2e-16 ***
## mSOA                   0.5340  1  0.4649161    
## id:cue                13.8075  1  0.0002025 ***
## id:strategy            3.5246  1  0.0604650 .  
## cue:strategy           0.1903  1  0.6626407    
## id:mSOA                0.3108  1  0.5772183    
## cue:mSOA               1.2804  1  0.2578324    
## strategy:mSOA          0.0013  1  0.9716313    
## id:cue:strategy        0.3219  1  0.5704705    
## id:cue:mSOA            0.0486  1  0.8254369    
## id:strategy:mSOA       0.0017  1  0.9673948    
## cue:strategy:mSOA      1.7884  1  0.1811253    
## id:cue:strategy:mSOA   1.9218  1  0.1656552    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

3.1.3.2 Exponentiated Coeff

jtools::summ(ps_adult)
Observations 1024
Dependent variable bin
Type Mixed effects generalized linear model
Family binomial
Link logit
AIC 699.06
BIC 782.90
Pseudo-R² (fixed effects) 0.54
Pseudo-R² (total) 0.71
Fixed Effects
Est. S.E. z val. p
(Intercept) -0.54 3.83 -0.14 0.89
id 0.71 0.87 0.81 0.42
cueTrue -8.46 9.48 -0.89 0.37
strategyswitch -4.79 4.59 -1.04 0.30
mSOA -0.51 1.04 -0.49 0.62
id:cueTrue 1.82 2.01 0.91 0.37
id:strategyswitch 0.46 1.04 0.44 0.66
cueTrue:strategyswitch 18.65 10.32 1.81 0.07
id:mSOA 0.06 0.24 0.25 0.80
cueTrue:mSOA 3.91 2.69 1.45 0.15
strategyswitch:mSOA 1.01 1.23 0.82 0.41
id:cueTrue:strategyswitch -2.83 2.18 -1.30 0.19
id:cueTrue:mSOA -0.65 0.55 -1.19 0.23
id:strategyswitch:mSOA -0.20 0.28 -0.70 0.48
cueTrue:strategyswitch:mSOA -5.41 2.90 -1.87 0.06
id:cueTrue:strategyswitch:mSOA 0.82 0.59 1.39 0.17
Random Effects
Group Parameter Std. Dev.
partID (Intercept) 1.37
Grouping Variables
Group # groups ICC
partID 32 0.36

3.2 Local Switch Costs

dumb <- lme4::glmer(bin ~ id*cue*strategy*sc_local + (1|partID), 
                   family = binomial(link = "logit"), 
                   control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=1000000)),
                   data = df[df$age_grp == "s",])

3.2.1 7-yos

lsc_7 <- glmer(bin ~ id*cue*strategy*sc_local + (1|partID), 
                   family = binomial(link = "logit"), 
                   control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=1000000)),
                   data = df[df$age_grp == "s",])
lsc_7
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: bin ~ id * cue * strategy * sc_local + (1 | partID)
##    Data: df[df$age_grp == "s", ]
##       AIC       BIC    logLik  deviance  df.resid 
##  740.1232  822.2848 -353.0616  706.1232       911 
## Random effects:
##  Groups Name        Std.Dev.
##  partID (Intercept) 1.25    
## Number of obs: 928, groups:  partID, 29
## Fixed Effects:
##                        (Intercept)                                  id  
##                            -2.5751                              0.2197  
##                            cueTrue                      strategyswitch  
##                             2.8909                             -3.8862  
##                           sc_local                          id:cueTrue  
##                             4.0991                             -0.0932  
##                  id:strategyswitch              cueTrue:strategyswitch  
##                             0.3317                              1.5090  
##                        id:sc_local                    cueTrue:sc_local  
##                            -1.5318                             -7.1346  
##            strategyswitch:sc_local           id:cueTrue:strategyswitch  
##                           -10.3291                             -0.4626  
##                id:cueTrue:sc_local          id:strategyswitch:sc_local  
##                             0.6604                              2.4922  
##    cueTrue:strategyswitch:sc_local  id:cueTrue:strategyswitch:sc_local  
##                            13.1226                             -2.1691

3.2.1.1 LR Chi Sqr

car::Anova(lsc_7)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: bin
##                             Chisq Df Pr(>Chisq)    
## id                        23.4713  1  1.268e-06 ***
## cue                      101.4493  1  < 2.2e-16 ***
## strategy                 147.3795  1  < 2.2e-16 ***
## sc_local                   5.9950  1    0.01435 *  
## id:cue                     4.5718  1    0.03250 *  
## id:strategy                1.1660  1    0.28022    
## cue:strategy               6.1232  1    0.01334 *  
## id:sc_local                5.5991  1    0.01797 *  
## cue:sc_local               4.7503  1    0.02929 *  
## strategy:sc_local          5.4544  1    0.01952 *  
## id:cue:strategy            0.8872  1    0.34625    
## id:cue:sc_local            0.0147  1    0.90347    
## id:strategy:sc_local       1.2631  1    0.26107    
## cue:strategy:sc_local      0.0940  1    0.75914    
## id:cue:strategy:sc_local   1.3900  1    0.23841    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

3.2.1.2 Exponentiated Coeff

jtools::summ(lsc_7)
Observations 928
Dependent variable bin
Type Mixed effects generalized linear model
Family binomial
Link logit
AIC 740.12
BIC 822.28
Pseudo-R² (fixed effects) 0.50
Pseudo-R² (total) 0.66
Fixed Effects
Est. S.E. z val. p
(Intercept) -2.58 0.64 -4.01 0.00
id 0.22 0.11 2.05 0.04
cueTrue 2.89 0.73 3.97 0.00
strategyswitch -3.89 1.74 -2.23 0.03
sc_local 4.10 3.95 1.04 0.30
id:cueTrue -0.09 0.14 -0.66 0.51
id:strategyswitch 0.33 0.27 1.23 0.22
cueTrue:strategyswitch 1.51 1.88 0.80 0.42
id:sc_local -1.53 0.66 -2.33 0.02
cueTrue:sc_local -7.13 4.53 -1.58 0.12
strategyswitch:sc_local -10.33 9.94 -1.04 0.30
id:cueTrue:strategyswitch -0.46 0.31 -1.50 0.13
id:cueTrue:sc_local 0.66 0.92 0.72 0.47
id:strategyswitch:sc_local 2.49 1.58 1.58 0.11
cueTrue:strategyswitch:sc_local 13.12 10.87 1.21 0.23
id:cueTrue:strategyswitch:sc_local -2.17 1.84 -1.18 0.24
Random Effects
Group Parameter Std. Dev.
partID (Intercept) 1.25
Grouping Variables
Group # groups ICC
partID 29 0.32

3.2.1.3 Visualizations

plot_model(lsc_7, type = "pred", terms = c("sc_local [all]"))

plot_model(lsc_7, type = "pred", terms = c("sc_local [all]","cue"))

plot_model(lsc_7, type = "pred", terms = c("sc_local [all]", "strategy"))

NOTE: Cue included in this figure for display purposes - no 3way indicated.

plot_model(lsc_7, type = "pred", terms = c("sc_local [all]", "cue", "id"))

3.2.1.4 Pairwise

emmeans::emtrends(lsc_7, pairwise ~ cue, var = "sc_local")
## NOTE: Results may be misleading due to involvement in interactions
## $emtrends
##  cue   sc_local.trend   SE  df asymp.LCL asymp.UCL
##  False          -2.35 2.50 Inf     -7.25      2.55
##  True           -4.83 1.83 Inf     -8.41     -1.25
## 
## Results are averaged over the levels of: strategy 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast     estimate   SE  df z.ratio p.value
##  False - True     2.48 2.25 Inf 1.103   0.2701 
## 
## Results are averaged over the levels of: strategy
emmeans::emtrends(lsc_7, pairwise ~ strategy, var = "sc_local")
## NOTE: Results may be misleading due to involvement in interactions
## $emtrends
##  strategy sc_local.trend   SE  df asymp.LCL asymp.UCL
##  maint             -4.88 1.80 Inf     -8.40     -1.35
##  switch            -2.31 2.54 Inf     -7.28      2.66
## 
## Results are averaged over the levels of: cue 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast       estimate   SE  df z.ratio p.value
##  maint - switch    -2.57 2.29 Inf -1.122  0.2618 
## 
## Results are averaged over the levels of: cue

3.2.2 10-yos

lsc_10 <- glmer(bin ~ id*cue*strategy*sc_local + (1|partID), 
                   family = binomial(link = "logit"), 
                   control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=1000000)),
                   data = df[df$age_grp == "t",])
lsc_10
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: bin ~ id * cue * strategy * sc_local + (1 | partID)
##    Data: df[df$age_grp == "t", ]
##       AIC       BIC    logLik  deviance  df.resid 
##  702.9959  783.3010 -334.4979  668.9959       815 
## Random effects:
##  Groups Name        Std.Dev.
##  partID (Intercept) 1.399   
## Number of obs: 832, groups:  partID, 26
## Fixed Effects:
##                        (Intercept)                                  id  
##                           -5.61061                             1.15808  
##                            cueTrue                      strategyswitch  
##                            6.98198                             2.68702  
##                           sc_local                          id:cueTrue  
##                           -0.39519                            -0.84694  
##                  id:strategyswitch              cueTrue:strategyswitch  
##                           -0.56024                            -2.48356  
##                        id:sc_local                    cueTrue:sc_local  
##                            0.06202                            -5.41512  
##            strategyswitch:sc_local           id:cueTrue:strategyswitch  
##                            4.04833                             0.27226  
##                id:cueTrue:sc_local          id:strategyswitch:sc_local  
##                            1.62713                             1.50034  
##    cueTrue:strategyswitch:sc_local  id:cueTrue:strategyswitch:sc_local  
##                            8.52716                            -3.13651

3.2.2.1 LR Chi Sqr

car::Anova(lsc_10)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: bin
##                             Chisq Df Pr(>Chisq)    
## id                        44.1495  1  3.042e-11 ***
## cue                      104.8497  1  < 2.2e-16 ***
## strategy                  14.2477  1  0.0001603 ***
## sc_local                   2.7377  1  0.0980042 .  
## id:cue                    37.9700  1  7.184e-10 ***
## id:strategy               13.0832  1  0.0002980 ***
## cue:strategy               3.7669  1  0.0522759 .  
## id:sc_local                2.7938  1  0.0946294 .  
## cue:sc_local               0.3848  1  0.5350443    
## strategy:sc_local         15.9864  1  6.380e-05 ***
## id:cue:strategy            5.1857  1  0.0227741 *  
## id:cue:sc_local            0.1112  1  0.7387513    
## id:strategy:sc_local       0.1579  1  0.6911375    
## cue:strategy:sc_local      1.9920  1  0.1581370    
## id:cue:strategy:sc_local   2.4759  1  0.1156046    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

3.2.2.2 Exponentiated Coeff

jtools::summ(lsc_10)
Observations 832
Dependent variable bin
Type Mixed effects generalized linear model
Family binomial
Link logit
AIC 703.00
BIC 783.30
Pseudo-R² (fixed effects) 0.47
Pseudo-R² (total) 0.67
Fixed Effects
Est. S.E. z val. p
(Intercept) -5.61 0.89 -6.29 0.00
id 1.16 0.16 7.20 0.00
cueTrue 6.98 1.02 6.86 0.00
strategyswitch 2.69 0.96 2.80 0.01
sc_local -0.40 7.05 -0.06 0.96
id:cueTrue -0.85 0.21 -4.01 0.00
id:strategyswitch -0.56 0.19 -2.98 0.00
cueTrue:strategyswitch -2.48 1.21 -2.05 0.04
id:sc_local 0.06 1.22 0.05 0.96
cueTrue:sc_local -5.42 8.03 -0.67 0.50
strategyswitch:sc_local 4.05 7.97 0.51 0.61
id:cueTrue:strategyswitch 0.27 0.25 1.08 0.28
id:cueTrue:sc_local 1.63 1.57 1.04 0.30
id:strategyswitch:sc_local 1.50 1.54 0.97 0.33
cueTrue:strategyswitch:sc_local 8.53 10.04 0.85 0.40
id:cueTrue:strategyswitch:sc_local -3.14 1.99 -1.57 0.12
Random Effects
Group Parameter Std. Dev.
partID (Intercept) 1.40
Grouping Variables
Group # groups ICC
partID 26 0.37

3.2.2.3 Visualizations

plot_model(lsc_10, type = "pred", terms = c("sc_local [all]"))

plot_model(lsc_10, type = "pred", terms = c("sc_local [all]", "strategy"))

NOTE: Cue included in this figure for display purposes - no 3way indicated.

plot_model(lsc_10, type = "pred", terms = c("sc_local [all]", "cue","id"))

3.2.2.4 Pairwise

emmeans::emtrends(lsc_10, pairwise ~ cue, var = "sc_local")
## NOTE: Results may be misleading due to involvement in interactions
## $emtrends
##  cue   sc_local.trend   SE  df asymp.LCL asymp.UCL
##  False           5.28 2.99 Inf    -0.568      11.1
##  True            4.40 2.95 Inf    -1.394      10.2
## 
## Results are averaged over the levels of: strategy 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast     estimate   SE  df z.ratio p.value
##  False - True    0.887 2.18 Inf 0.406   0.6847 
## 
## Results are averaged over the levels of: strategy

3.2.3 Adults

lsc_adult <- glmer(bin ~ id*cue*strategy*sc_local + (1|partID), 
                   family = binomial(link = "logit"), 
                   control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=1000000)),
                   data = df[df$age_grp == "a",])
lsc_adult
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: bin ~ id * cue * strategy * sc_local + (1 | partID)
##    Data: df[df$age_grp == "a", ]
##       AIC       BIC    logLik  deviance  df.resid 
##  694.3113  778.1463 -330.1556  660.3113      1007 
## Random effects:
##  Groups Name        Std.Dev.
##  partID (Intercept) 1.368   
## Number of obs: 1024, groups:  partID, 32
## Fixed Effects:
##                        (Intercept)                                  id  
##                           -2.60477                             0.95968  
##                            cueTrue                      strategyswitch  
##                            5.34456                            -0.95080  
##                           sc_local                          id:cueTrue  
##                           -5.55058                            -0.09754  
##                  id:strategyswitch              cueTrue:strategyswitch  
##                           -0.30107                            -0.75376  
##                        id:sc_local                    cueTrue:sc_local  
##                            0.88938                             5.71059  
##            strategyswitch:sc_local           id:cueTrue:strategyswitch  
##                            4.23135                            -0.28244  
##                id:cueTrue:sc_local          id:strategyswitch:sc_local  
##                            3.89479                            -1.55178  
##    cueTrue:strategyswitch:sc_local  id:cueTrue:strategyswitch:sc_local  
##                          -10.67330                            -2.43307

3.2.3.1 LR Chi Sqr

car::Anova(lsc_adult)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: bin
##                             Chisq Df Pr(>Chisq)    
## id                        95.9972  1  < 2.2e-16 ***
## cue                      123.4714  1  < 2.2e-16 ***
## strategy                  61.9257  1  3.567e-15 ***
## sc_local                   0.9157  1  0.3386126    
## id:cue                    13.5611  1  0.0002309 ***
## id:strategy                3.6725  1  0.0553160 .  
## cue:strategy               0.1627  1  0.6866680    
## id:sc_local                0.3705  1  0.5427499    
## cue:sc_local               1.7901  1  0.1809146    
## strategy:sc_local          1.9929  1  0.1580375    
## id:cue:strategy            0.0410  1  0.8396212    
## id:cue:sc_local            1.8016  1  0.1795204    
## id:strategy:sc_local       1.9312  1  0.1646309    
## cue:strategy:sc_local      4.7877  1  0.0286641 *  
## id:cue:strategy:sc_local   0.4460  1  0.5042241    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

3.2.3.2 Exponentiated Coeff

jtools::summ(lsc_adult)
Observations 1024
Dependent variable bin
Type Mixed effects generalized linear model
Family binomial
Link logit
AIC 694.31
BIC 778.15
Pseudo-R² (fixed effects) 0.64
Pseudo-R² (total) 0.77
Fixed Effects
Est. S.E. z val. p
(Intercept) -2.60 0.53 -4.95 0.00
id 0.96 0.12 7.69 0.00
cueTrue 5.34 1.25 4.28 0.00
strategyswitch -0.95 0.64 -1.49 0.14
sc_local -5.55 5.83 -0.95 0.34
id:cueTrue -0.10 0.45 -0.22 0.83
id:strategyswitch -0.30 0.15 -2.05 0.04
cueTrue:strategyswitch -0.75 1.37 -0.55 0.58
id:sc_local 0.89 1.44 0.62 0.54
cueTrue:sc_local 5.71 12.22 0.47 0.64
strategyswitch:sc_local 4.23 7.12 0.59 0.55
id:cueTrue:strategyswitch -0.28 0.46 -0.61 0.54
id:cueTrue:sc_local 3.89 3.34 1.17 0.24
id:strategyswitch:sc_local -1.55 1.72 -0.90 0.37
cueTrue:strategyswitch:sc_local -10.67 14.11 -0.76 0.45
id:cueTrue:strategyswitch:sc_local -2.43 3.64 -0.67 0.50
Random Effects
Group Parameter Std. Dev.
partID (Intercept) 1.37
Grouping Variables
Group # groups ICC
partID 32 0.36

3.2.3.4 Pairwise

emmeans::emtrends(lsc_adult, pairwise ~ cue*strategy, var = "sc_local")
## NOTE: Results may be misleading due to involvement in interactions
## $emtrends
##  cue   strategy sc_local.trend   SE  df asymp.LCL asymp.UCL
##  False maint             -1.55 4.16 Inf     -9.70      6.60
##  True  maint             21.69 8.99 Inf      4.07     39.31
##  False switch            -4.30 3.50 Inf    -11.15      2.55
##  True  switch            -2.69 3.98 Inf    -10.48      5.11
## 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast                   estimate   SE  df z.ratio p.value
##  False maint - True maint     -23.24 9.04 Inf -2.571  0.0497 
##  False maint - False switch     2.75 3.62 Inf  0.759  0.8726 
##  False maint - True switch      1.14 3.98 Inf  0.286  0.9919 
##  True maint - False switch     25.99 8.76 Inf  2.967  0.0159 
##  True maint - True switch      24.37 9.00 Inf  2.708  0.0342 
##  False switch - True switch    -1.62 3.42 Inf -0.472  0.9652 
## 
## P value adjustment: tukey method for comparing a family of 4 estimates

3.3 Mixing Costs

3.3.1 7-yos

mc_7 <- glmer(bin ~ id*cue*strategy*mc + (1|partID), 
                   family = binomial(link = "logit"), 
                   control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=1000000)),
                   data = df[df$age_grp == "s",])
mc_7
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: bin ~ id * cue * strategy * mc + (1 | partID)
##    Data: df[df$age_grp == "s", ]
##       AIC       BIC    logLik  deviance  df.resid 
##  750.5043  832.6659 -358.2522  716.5043       911 
## Random effects:
##  Groups Name        Std.Dev.
##  partID (Intercept) 1.414   
## Number of obs: 928, groups:  partID, 29
## Fixed Effects:
##                  (Intercept)                            id  
##                     -5.78672                       0.61961  
##                      cueTrue                strategyswitch  
##                      2.56441                      -2.01823  
##                           mc                    id:cueTrue  
##                      3.41903                       0.10752  
##            id:strategyswitch        cueTrue:strategyswitch  
##                      0.02954                      -0.72525  
##                        id:mc                    cueTrue:mc  
##                     -0.26807                       1.94394  
##            strategyswitch:mc     id:cueTrue:strategyswitch  
##                     -0.79241                      -0.41199  
##                id:cueTrue:mc          id:strategyswitch:mc  
##                     -0.48430                      -0.01210  
##    cueTrue:strategyswitch:mc  id:cueTrue:strategyswitch:mc  
##                      0.30279                       0.42211

3.3.1.1 LR Chi Sqr

car::Anova(mc_7)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: bin
##                       Chisq Df Pr(>Chisq)    
## id                  25.2713  1  4.981e-07 ***
## cue                103.2514  1  < 2.2e-16 ***
## strategy           156.9205  1  < 2.2e-16 ***
## mc                   2.5166  1   0.112650    
## id:cue               8.8466  1   0.002936 ** 
## id:strategy          0.1619  1   0.687410    
## cue:strategy         4.3179  1   0.037714 *  
## id:mc                4.2521  1   0.039203 *  
## cue:mc               0.0555  1   0.813679    
## strategy:mc          0.3429  1   0.558155    
## id:cue:strategy      0.1735  1   0.677005    
## id:cue:mc            0.6572  1   0.417547    
## id:strategy:mc       0.4108  1   0.521551    
## cue:strategy:mc      1.2864  1   0.256716    
## id:cue:strategy:mc   0.1421  1   0.706165    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

3.3.1.2 Exponentiated Coeff

jtools::summ(mc_7)
Observations 928
Dependent variable bin
Type Mixed effects generalized linear model
Family binomial
Link logit
AIC 750.50
BIC 832.67
Pseudo-R² (fixed effects) 0.46
Pseudo-R² (total) 0.67
Fixed Effects
Est. S.E. z val. p
(Intercept) -5.79 2.09 -2.77 0.01
id 0.62 0.32 1.94 0.05
cueTrue 2.56 2.32 1.11 0.27
strategyswitch -2.02 4.88 -0.41 0.68
mc 3.42 2.57 1.33 0.18
id:cueTrue 0.11 0.43 0.25 0.80
id:strategyswitch 0.03 0.77 0.04 0.97
cueTrue:strategyswitch -0.73 5.39 -0.13 0.89
id:mc -0.27 0.39 -0.68 0.49
cueTrue:mc 1.94 2.93 0.66 0.51
strategyswitch:mc -0.79 6.17 -0.13 0.90
id:cueTrue:strategyswitch -0.41 0.88 -0.47 0.64
id:cueTrue:mc -0.48 0.54 -0.89 0.37
id:strategyswitch:mc -0.01 0.98 -0.01 0.99
cueTrue:strategyswitch:mc 0.30 6.81 0.04 0.96
id:cueTrue:strategyswitch:mc 0.42 1.12 0.38 0.71
Random Effects
Group Parameter Std. Dev.
partID (Intercept) 1.41
Grouping Variables
Group # groups ICC
partID 29 0.38

3.3.1.3 Visualizations

plot_model(mc_7, type = "pred", terms = c("mc [all]", "cue","id"))

3.3.2 10-yos

mc_10 <- glmer(bin ~ id*cue*strategy*mc + (1|partID), 
                   family = binomial(link = "logit"), 
                   control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=1000000)),
                   data = df[df$age_grp == "t",])
mc_10
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: bin ~ id * cue * strategy * mc + (1 | partID)
##    Data: df[df$age_grp == "t", ]
##       AIC       BIC    logLik  deviance  df.resid 
##  726.9583  807.2635 -346.4792  692.9583       815 
## Random effects:
##  Groups Name        Std.Dev.
##  partID (Intercept) 1.35    
## Number of obs: 832, groups:  partID, 26
## Fixed Effects:
##                  (Intercept)                            id  
##                     -3.47109                       0.74201  
##                      cueTrue                strategyswitch  
##                      6.65009                       0.29540  
##                           mc                    id:cueTrue  
##                     -2.70900                      -1.07789  
##            id:strategyswitch        cueTrue:strategyswitch  
##                     -0.34727                       0.94987  
##                        id:mc                    cueTrue:mc  
##                      0.52396                       0.74749  
##            strategyswitch:mc     id:cueTrue:strategyswitch  
##                      2.96554                      -0.02709  
##                id:cueTrue:mc          id:strategyswitch:mc  
##                      0.17723                      -0.42389  
##    cueTrue:strategyswitch:mc  id:cueTrue:strategyswitch:mc  
##                     -5.11628                       0.64203

3.3.2.1 LR Chi Sqr

car::Anova(mc_10)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: bin
##                       Chisq Df Pr(>Chisq)    
## id                  45.5423  1  1.494e-11 ***
## cue                104.5452  1  < 2.2e-16 ***
## strategy            18.0020  1  2.207e-05 ***
## mc                   0.0376  1    0.84633    
## id:cue              38.2573  1  6.200e-10 ***
## id:strategy         15.2907  1  9.217e-05 ***
## cue:strategy         4.2079  1    0.04024 *  
## id:mc                4.6318  1    0.03138 *  
## cue:mc               0.0811  1    0.77581    
## strategy:mc          0.0342  1    0.85322    
## id:cue:strategy      4.7543  1    0.02922 *  
## id:cue:mc            1.2238  1    0.26861    
## id:strategy:mc       0.0010  1    0.97432    
## cue:strategy:mc      0.7348  1    0.39133    
## id:cue:strategy:mc   0.2839  1    0.59416    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

3.2.2.2 Exponentiated Coeff

jtools::summ(mc_10)
Observations 832
Dependent variable bin
Type Mixed effects generalized linear model
Family binomial
Link logit
AIC 726.96
BIC 807.26
Pseudo-R² (fixed effects) 0.44
Pseudo-R² (total) 0.64
Fixed Effects
Est. S.E. z val. p
(Intercept) -3.47 3.55 -0.98 0.33
id 0.74 0.63 1.18 0.24
cueTrue 6.65 3.98 1.67 0.09
strategyswitch 0.30 3.92 0.08 0.94
mc -2.71 4.70 -0.58 0.56
id:cueTrue -1.08 0.78 -1.39 0.16
id:strategyswitch -0.35 0.73 -0.47 0.64
cueTrue:strategyswitch 0.95 4.79 0.20 0.84
id:mc 0.52 0.83 0.63 0.53
cueTrue:mc 0.75 5.17 0.14 0.88
strategyswitch:mc 2.97 5.19 0.57 0.57
id:cueTrue:strategyswitch -0.03 0.93 -0.03 0.98
id:cueTrue:mc 0.18 1.01 0.17 0.86
id:strategyswitch:mc -0.42 0.96 -0.44 0.66
cueTrue:strategyswitch:mc -5.12 6.18 -0.83 0.41
id:cueTrue:strategyswitch:mc 0.64 1.20 0.53 0.59
Random Effects
Group Parameter Std. Dev.
partID (Intercept) 1.35
Grouping Variables
Group # groups ICC
partID 26 0.36

3.3.2.3 Visualizations

plot_model(mc_10, type = "pred", terms = c("mc [all]", "cue","id"))

3.3.3 Adults

mc_adult <- glmer(bin ~ id*cue*strategy*mc + (1|partID), 
                   family = binomial(link = "logit"), 
                   control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=1000000)),
                   data = df[df$age_grp == "a",])
mc_adult
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: bin ~ id * cue * strategy * mc + (1 | partID)
##    Data: df[df$age_grp == "a", ]
##       AIC       BIC    logLik  deviance  df.resid 
##  697.8578  781.6928 -331.9289  663.8578      1007 
## Random effects:
##  Groups Name        Std.Dev.
##  partID (Intercept) 1.427   
## Number of obs: 1024, groups:  partID, 32
## Fixed Effects:
##                  (Intercept)                            id  
##                      -3.1304                        1.3715  
##                      cueTrue                strategyswitch  
##                       6.5032                       -2.7296  
##                           mc                    id:cueTrue  
##                       0.8937                       -0.2449  
##            id:strategyswitch        cueTrue:strategyswitch  
##                      -0.3982                        1.9284  
##                        id:mc                    cueTrue:mc  
##                      -0.5693                       -1.2609  
##            strategyswitch:mc     id:cueTrue:strategyswitch  
##                       2.2034                       -0.5422  
##                id:cueTrue:mc          id:strategyswitch:mc  
##                      -0.3239                        0.1752  
##    cueTrue:strategyswitch:mc  id:cueTrue:strategyswitch:mc  
##                      -3.6583                        0.8198

3.3.3.1 LR Chi Sqr

car::Anova(mc_adult)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: bin
##                       Chisq Df Pr(>Chisq)    
## id                  96.9261  1  < 2.2e-16 ***
## cue                129.0987  1  < 2.2e-16 ***
## strategy            68.2818  1  < 2.2e-16 ***
## mc                   0.0039  1  0.9499994    
## id:cue              14.3554  1  0.0001513 ***
## id:strategy          3.6394  1  0.0564260 .  
## cue:strategy         0.9461  1  0.3307061    
## id:mc                1.3328  1  0.2483013    
## cue:mc               4.3999  1  0.0359413 *  
## strategy:mc          4.6967  1  0.0302198 *  
## id:cue:strategy      0.2022  1  0.6529364    
## id:cue:mc            0.3206  1  0.5712510    
## id:strategy:mc       0.4371  1  0.5085194    
## cue:strategy:mc      0.0952  1  0.7576364    
## id:cue:strategy:mc   0.3786  1  0.5383375    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

3.3.3.2 Exponentiated Coeff

jtools::summ(mc_adult)
Observations 1024
Dependent variable bin
Type Mixed effects generalized linear model
Family binomial
Link logit
AIC 697.86
BIC 781.69
Pseudo-R² (fixed effects) 0.56
Pseudo-R² (total) 0.73
Fixed Effects
Est. S.E. z val. p
(Intercept) -3.13 1.84 -1.70 0.09
id 1.37 0.44 3.10 0.00
cueTrue 6.50 3.68 1.77 0.08
strategyswitch -2.73 2.24 -1.22 0.22
mc 0.89 2.35 0.38 0.70
id:cueTrue -0.24 1.02 -0.24 0.81
id:strategyswitch -0.40 0.53 -0.75 0.45
cueTrue:strategyswitch 1.93 4.28 0.45 0.65
id:mc -0.57 0.55 -1.04 0.30
cueTrue:mc -1.26 4.55 -0.28 0.78
strategyswitch:mc 2.20 2.81 0.78 0.43
id:cueTrue:strategyswitch -0.54 1.13 -0.48 0.63
id:cueTrue:mc -0.32 1.18 -0.27 0.78
id:strategyswitch:mc 0.18 0.67 0.26 0.79
cueTrue:strategyswitch:mc -3.66 5.33 -0.69 0.49
id:cueTrue:strategyswitch:mc 0.82 1.33 0.62 0.54
Random Effects
Group Parameter Std. Dev.
partID (Intercept) 1.43
Grouping Variables
Group # groups ICC
partID 32 0.38

3.3.3.3 Visualizations

plot_model(mc_adult, type = "pred", terms = c("mc [all]", "cue"))

plot_model(mc_adult, type = "pred", terms = c("mc [all]", "strategy"))

3.3.3.4 Pairwise

emmeans::emtrends(mc_adult, pairwise ~ cue, var = "mc")
## NOTE: Results may be misleading due to involvement in interactions
## $emtrends
##  cue   mc.trend   SE  df asymp.LCL asymp.UCL
##  False   -0.172 1.45 Inf     -3.00      2.66
##  True    -2.875 1.98 Inf     -6.76      1.01
## 
## Results are averaged over the levels of: strategy 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast     estimate   SE  df z.ratio p.value
##  False - True      2.7 1.64 Inf 1.647   0.0995 
## 
## Results are averaged over the levels of: strategy
emmeans::emtrends(mc_adult, pairwise ~ strategy, var = "mc")
## NOTE: Results may be misleading due to involvement in interactions
## $emtrends
##  strategy mc.trend   SE  df asymp.LCL asymp.UCL
##  maint     -3.0274 1.97 Inf     -6.89     0.835
##  switch    -0.0201 1.44 Inf     -2.85     2.809
## 
## Results are averaged over the levels of: cue 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast       estimate   SE  df z.ratio p.value
##  maint - switch    -3.01 1.61 Inf -1.862  0.0625 
## 
## Results are averaged over the levels of: cue