Refinement of hypothesis GLM

Aim

This document shows how the hypothesis GLM for PDon vs PDoff with ‘maximal’ random effects is reduced systematically, arriving at the most appropriate model for analysis.

Warning: package 'sjPlot' was built under R version 4.2.3
#refugeeswelcome
Warning: package 'ggpubr' was built under R version 4.2.2
Loading required package: ggplot2
Warning: package 'ggplot2' was built under R version 4.2.2
Loading required package: pacman
Warning: package 'pacman' was built under R version 4.2.2
Rows: 17439 Columns: 130
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (86): LARS_EP, LARS_INT, LARS_INI, LARS_NS, LARS_M, LARS_ER, LARS_C, LAR...
dbl (44): ID, Patient_Control, ACE_Attention, ACE_Memory, ACE_Fluency, ACE_L...

ℹ 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.
Warning: NAs introduced by coercion

Model selection

Below shows the output and principle components analysis for the hypothesis model with maximal random effect structure (singular fit).

maxmax.red0.PDonvsPDoff <- glmer(Choice ~ Group*Recipient_s2z*scale(Reward) + 
                                     Group*Recipient_s2z*scale(Effort) +
                                    (1 + Group*Recipient_s2z*scale(Reward) + Group*Recipient_s2z*scale(Effort) || ID), family='binomial', data=PD.df, control=glmerControl(optimizer='bobyqa', optCtrl=list(maxfun=2e5)))
boundary (singular) fit: see help('isSingular')
maxmax.red0.PDonvsPDoff
Generalized linear mixed model fit by maximum likelihood (Laplace
  Approximation) [glmerMod]
 Family: binomial  ( logit )
Formula: 
Choice ~ Group * Recipient_s2z * scale(Reward) + Group * Recipient_s2z *  
    scale(Effort) + (1 + Group * Recipient_s2z * scale(Reward) +  
    Group * Recipient_s2z * scale(Effort) || ID)
   Data: PD.df
      AIC       BIC    logLik  deviance  df.resid 
 4746.882  5206.995 -2310.441  4620.882     10912 
Random effects:
 Groups Name                                         Std.Dev. Corr             
 ID     (Intercept)                                  2.14621                   
 ID.1   GroupPD off                                  0.94436                   
        GroupPD on                                   1.73342  0.29             
 ID.2   Recipient_s2zself                            1.38673                   
        Recipient_s2zother                           1.58506  0.81             
 ID.3   scale(Reward)                                0.00000                   
 ID.4   scale(Effort)                                0.01512                   
 ID.5   GroupPD off:Recipient_s2zself                1.68842                   
        GroupPD on:Recipient_s2zself                 0.75089   0.40            
        GroupPD off:Recipient_s2zother               1.43284   0.05  0.01      
        GroupPD on:Recipient_s2zother                1.31414  -0.67 -0.34  0.58
 ID.6   GroupPD off:scale(Reward)                    0.62406                   
        GroupPD on:scale(Reward)                     0.12628  1.00             
 ID.7   Recipient_s2zself:scale(Reward)              0.12635                   
        Recipient_s2zother:scale(Reward)             0.08408  -1.00            
 ID.8   GroupPD off:scale(Effort)                    0.04461                   
        GroupPD on:scale(Effort)                     0.05304  1.00             
 ID.9   Recipient_s2zself:scale(Effort)              0.03055                   
        Recipient_s2zother:scale(Effort)             0.03078  1.00             
 ID.10  GroupPD off:Recipient_s2zself:scale(Reward)  1.31339                   
        GroupPD on:Recipient_s2zself:scale(Reward)   1.62812  0.81             
        GroupPD off:Recipient_s2zother:scale(Reward) 1.11230  0.86  0.99       
        GroupPD on:Recipient_s2zother:scale(Reward)  1.46744  0.53  0.92  0.88 
 ID.11  GroupPD off:Recipient_s2zself:scale(Effort)  1.05065                   
        GroupPD on:Recipient_s2zself:scale(Effort)   1.22862  0.78             
        GroupPD off:Recipient_s2zother:scale(Effort) 1.11228  1.00  0.76       
        GroupPD on:Recipient_s2zother:scale(Effort)  1.25223  0.73  1.00  0.71 
Number of obs: 10975, groups:  ID, 37
Fixed Effects:
                            (Intercept)  
                                4.66799  
                             GroupPD on  
                                0.20586  
                         Recipient_s2z1  
                                0.93176  
                          scale(Reward)  
                                1.49964  
                          scale(Effort)  
                               -1.44918  
              GroupPD on:Recipient_s2z1  
                               -0.26075  
               GroupPD on:scale(Reward)  
                                0.23480  
           Recipient_s2z1:scale(Reward)  
                                0.14094  
               GroupPD on:scale(Effort)  
                               -0.00963  
           Recipient_s2z1:scale(Effort)  
                                0.02481  
GroupPD on:Recipient_s2z1:scale(Reward)  
                               -0.11201  
GroupPD on:Recipient_s2z1:scale(Effort)  
                                0.04706  
optimizer (bobyqa) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 

Remove Group * Recipient * Effort from random effects and convert to two way interactions. Keep Group * Recipient * Reward three-way interaction

maxmax.red1.PDonvsPDoff <- glmer(Choice ~ Group*Recipient_s2z*scale(Reward) + 
                                     Group*Recipient_s2z*scale(Effort) +
                                    (1 + Group*Recipient_s2z*scale(Reward) + scale(Effort)*Recipient_s2z + scale(Effort)*Group || ID), family='binomial', data=PD.df, control=glmerControl(optimizer='bobyqa', optCtrl=list(maxfun=2e5)))
boundary (singular) fit: see help('isSingular')
maxmax.red1.PDonvsPDoff
Generalized linear mixed model fit by maximum likelihood (Laplace
  Approximation) [glmerMod]
 Family: binomial  ( logit )
Formula: 
Choice ~ Group * Recipient_s2z * scale(Reward) + Group * Recipient_s2z *  
    scale(Effort) + (1 + Group * Recipient_s2z * scale(Reward) +  
    scale(Effort) * Recipient_s2z + scale(Effort) * Group ||      ID)
   Data: PD.df
      AIC       BIC    logLik  deviance  df.resid 
 4727.436  5114.515 -2310.718  4621.436     10922 
Random effects:
 Groups Name                                         Std.Dev.  Corr       
 ID     (Intercept)                                  2.537e+00            
 ID.1   GroupPD off                                  1.200e+00            
        GroupPD on                                   1.426e+00 -0.10      
 ID.2   Recipient_s2zself                            7.520e-01            
        Recipient_s2zother                           1.081e+00 0.40       
 ID.3   scale(Reward)                                6.743e-06            
 ID.4   scale(Effort)                                1.138e-01            
 ID.5   GroupPD off:Recipient_s2zself                1.427e+00            
        GroupPD on:Recipient_s2zself                 1.067e+00  0.53      
        GroupPD off:Recipient_s2zother               9.369e-01 -0.56  0.26
        GroupPD on:Recipient_s2zother                1.457e+00 -0.56  0.16
 ID.6   GroupPD off:scale(Reward)                    6.251e-01            
        GroupPD on:scale(Reward)                     1.864e-01 1.00       
 ID.7   Recipient_s2zself:scale(Reward)              1.186e-01            
        Recipient_s2zother:scale(Reward)             1.295e-01 -1.00      
 ID.8   Recipient_s2zself:scale(Effort)              1.022e+00            
        Recipient_s2zother:scale(Effort)             1.030e+00 1.00       
 ID.9   GroupPD off:scale(Effort)                    3.283e-01            
        GroupPD on:scale(Effort)                     6.864e-01 -0.26      
 ID.10  GroupPD off:Recipient_s2zself:scale(Reward)  1.327e+00            
        GroupPD on:Recipient_s2zself:scale(Reward)   1.632e+00 0.80       
        GroupPD off:Recipient_s2zother:scale(Reward) 1.091e+00 0.87  0.99 
        GroupPD on:Recipient_s2zother:scale(Reward)  1.444e+00 0.52  0.93 
      
      
      
      
      
      
      
      
      
      
      
  0.85
      
      
      
      
      
      
      
      
      
      
      
 0.87 
Number of obs: 10975, groups:  ID, 37
Fixed Effects:
                            (Intercept)  
                               4.675921  
                             GroupPD on  
                               0.196684  
                         Recipient_s2z1  
                               0.964324  
                          scale(Reward)  
                               1.499867  
                          scale(Effort)  
                              -1.449129  
              GroupPD on:Recipient_s2z1  
                              -0.274799  
               GroupPD on:scale(Reward)  
                               0.234028  
           Recipient_s2z1:scale(Reward)  
                               0.151682  
               GroupPD on:scale(Effort)  
                              -0.008908  
           Recipient_s2z1:scale(Effort)  
                               0.017343  
GroupPD on:Recipient_s2z1:scale(Reward)  
                              -0.114024  
GroupPD on:Recipient_s2z1:scale(Effort)  
                               0.042630  
optimizer (bobyqa) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 

SINGULAR FIT

Next try removing Group * Recipient * Reward from random effects and convert to two way interactions (keeping Group * Recipient * Effort interaction).

maxmax.red2.PDonvsPDoff <- glmer(Choice ~ Group*Recipient_s2z*scale(Reward) + 
                                     Group*Recipient_s2z*scale(Effort) +
                                    (1 + Group*Recipient_s2z*scale(Effort) + 
                                       scale(Reward)*Recipient_s2z + scale(Reward)*Group || ID), family='binomial', data=PD.df, control=glmerControl(optimizer='bobyqa', optCtrl=list(maxfun=2e5)))
boundary (singular) fit: see help('isSingular')
maxmax.red2.PDonvsPDoff
Generalized linear mixed model fit by maximum likelihood (Laplace
  Approximation) [glmerMod]
 Family: binomial  ( logit )
Formula: 
Choice ~ Group * Recipient_s2z * scale(Reward) + Group * Recipient_s2z *  
    scale(Effort) + (1 + Group * Recipient_s2z * scale(Effort) +  
    scale(Reward) * Recipient_s2z + scale(Reward) * Group ||      ID)
   Data: PD.df
      AIC       BIC    logLik  deviance  df.resid 
 4733.265  5120.344 -2313.633  4627.265     10922 
Random effects:
 Groups Name                                         Std.Dev. Corr             
 ID     (Intercept)                                  2.01557                   
 ID.1   GroupPD off                                  1.52686                   
        GroupPD on                                   2.01935  0.44             
 ID.2   Recipient_s2zself                            1.17809                   
        Recipient_s2zother                           1.42102  0.54             
 ID.3   scale(Effort)                                0.04052                   
 ID.4   scale(Reward)                                1.04940                   
 ID.5   GroupPD off:Recipient_s2zself                1.59595                   
        GroupPD on:Recipient_s2zself                 0.73656   0.64            
        GroupPD off:Recipient_s2zother               0.98572   0.02  0.35      
        GroupPD on:Recipient_s2zother                1.49570  -0.25  0.22  0.77
 ID.6   GroupPD off:scale(Effort)                    0.10923                   
        GroupPD on:scale(Effort)                     0.11596  1.00             
 ID.7   Recipient_s2zself:scale(Effort)              0.01068                   
        Recipient_s2zother:scale(Effort)             0.01066  1.00             
 ID.8   Recipient_s2zself:scale(Reward)              0.92726                   
        Recipient_s2zother:scale(Reward)             0.31015  0.97             
 ID.9   GroupPD off:scale(Reward)                    0.40639                   
        GroupPD on:scale(Reward)                     1.14781  0.71             
 ID.10  GroupPD off:Recipient_s2zself:scale(Effort)  1.05807                   
        GroupPD on:Recipient_s2zself:scale(Effort)   1.22409  0.78             
        GroupPD off:Recipient_s2zother:scale(Effort) 1.07468  1.00  0.76       
        GroupPD on:Recipient_s2zother:scale(Effort)  1.27385  0.72  1.00  0.71 
Number of obs: 10975, groups:  ID, 37
Fixed Effects:
                            (Intercept)  
                               4.610107  
                             GroupPD on  
                               0.301397  
                         Recipient_s2z1  
                               0.991673  
                          scale(Reward)  
                               1.480207  
                          scale(Effort)  
                              -1.439516  
              GroupPD on:Recipient_s2z1  
                              -0.362802  
               GroupPD on:scale(Reward)  
                               0.241764  
           Recipient_s2z1:scale(Reward)  
                               0.163185  
               GroupPD on:scale(Effort)  
                              -0.032556  
           Recipient_s2z1:scale(Effort)  
                               0.003744  
GroupPD on:Recipient_s2z1:scale(Reward)  
                              -0.149347  
GroupPD on:Recipient_s2z1:scale(Effort)  
                               0.079684  
optimizer (bobyqa) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 

SINGULAR FIT

Next try model only containing (all possible) two way interactions in random effects

maxmax.red3.PDonvsPDoff <- glmer(Choice ~ Group*Recipient_s2z*scale(Reward) + 
                                     Group*Recipient_s2z*scale(Effort) +
                                    (1 + Group*Recipient_s2z + Group*scale(Effort) + Group*scale(Reward) +
                                       scale(Reward)*Recipient_s2z + scale(Reward)*Group +
                                      scale(Effort)*Recipient_s2z + scale(Effort)*Group || ID), family='binomial', data=PD.df, control=glmerControl(optimizer='bobyqa', optCtrl=list(maxfun=2e5)))
boundary (singular) fit: see help('isSingular')
maxmax.red3.PDonvsPDoff
Generalized linear mixed model fit by maximum likelihood (Laplace
  Approximation) [glmerMod]
 Family: binomial  ( logit )
Formula: 
Choice ~ Group * Recipient_s2z * scale(Reward) + Group * Recipient_s2z *  
    scale(Effort) + (1 + Group * Recipient_s2z + Group * scale(Effort) +  
    Group * scale(Reward) + scale(Reward) * Recipient_s2z + scale(Reward) *  
    Group + scale(Effort) * Recipient_s2z + scale(Effort) * Group ||      ID)
   Data: PD.df
      AIC       BIC    logLik  deviance  df.resid 
 4713.783  5027.828 -2313.891  4627.783     10932 
Random effects:
 Groups Name                             Std.Dev.  Corr             
 ID     (Intercept)                      2.1837677                  
 ID.1   GroupPD off                      1.2457169                  
        GroupPD on                       1.8084785 0.45             
 ID.2   Recipient_s2zself                1.2525408                  
        Recipient_s2zother               1.5362644 0.40             
 ID.3   scale(Effort)                    0.0004292                  
 ID.4   scale(Reward)                    0.8586418                  
 ID.5   GroupPD off:Recipient_s2zself    1.6004410                  
        GroupPD on:Recipient_s2zself     0.7793218  0.25            
        GroupPD off:Recipient_s2zother   0.7864164  0.22  0.07      
        GroupPD on:Recipient_s2zother    1.3506402 -0.38  0.46  0.32
 ID.6   GroupPD off:scale(Effort)        0.1826596                  
        GroupPD on:scale(Effort)         0.6807199 -0.84            
 ID.7   GroupPD off:scale(Reward)        0.4179265                  
        GroupPD on:scale(Reward)         1.1534829 0.72             
 ID.8   Recipient_s2zself:scale(Reward)  1.1174467                  
        Recipient_s2zother:scale(Reward) 0.6530178 0.87             
 ID.9   Recipient_s2zself:scale(Effort)  1.0584458                  
        Recipient_s2zother:scale(Effort) 1.0497424 1.00             
Number of obs: 10975, groups:  ID, 37
Fixed Effects:
                            (Intercept)  
                              4.6128104  
                             GroupPD on  
                              0.2987193  
                         Recipient_s2z1  
                              1.0103610  
                          scale(Reward)  
                              1.4788458  
                          scale(Effort)  
                             -1.4400608  
              GroupPD on:Recipient_s2z1  
                             -0.3489802  
               GroupPD on:scale(Reward)  
                              0.2439612  
           Recipient_s2z1:scale(Reward)  
                              0.1692088  
               GroupPD on:scale(Effort)  
                             -0.0281807  
           Recipient_s2z1:scale(Effort)  
                             -0.0007723  
GroupPD on:Recipient_s2z1:scale(Reward)  
                             -0.1404463  
GroupPD on:Recipient_s2z1:scale(Effort)  
                              0.0688750  
optimizer (bobyqa) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
summary(rePCA(maxmax.red3.PDonvsPDoff))
$ID
Importance of components:
                         [,1]   [,2]   [,3]   [,4]    [,5]    [,6]    [,7]
Standard deviation     2.1838 1.9349 1.7577 1.6798 1.49073 1.32780 1.26327
Proportion of Variance 0.1851 0.1453 0.1199 0.1095 0.08624 0.06842 0.06193
Cumulative Proportion  0.1851 0.3303 0.4502 0.5597 0.64599 0.71441 0.77634
                          [,8]    [,9]   [,10]   [,11]  [,12]   [,13]   [,14]
Standard deviation     1.19494 1.05226 1.03859 0.85864 0.7580 0.69813 0.42937
Proportion of Variance 0.05541 0.04297 0.04186 0.02861 0.0223 0.01891 0.00715
Cumulative Proportion  0.83176 0.87472 0.91659 0.94520 0.9675 0.98641 0.99356
                         [,15]  [,16]   [,17]     [,18] [,19]
Standard deviation     0.28154 0.2781 0.09677 0.0004292     0
Proportion of Variance 0.00308 0.0030 0.00036 0.0000000     0
Cumulative Proportion  0.99664 0.9996 1.00000 1.0000000     1

Singular fit. Remove recipient:effort as correlation of 1

maxmax.red4.PDonvsPDoff <- glmer(Choice ~ Group*Recipient_s2z*scale(Reward) + 
                                     Group*Recipient_s2z*scale(Effort) +
                                    (1 + Group*Recipient_s2z + Group*scale(Effort) + Group*scale(Reward) +
                                       scale(Reward)*Recipient_s2z + scale(Reward)*Group +
                                       scale(Effort)*Group || ID), family='binomial', data=PD.df, control=glmerControl(optimizer='bobyqa', optCtrl=list(maxfun=2e5)))

maxmax.red4.PDonvsPDoff
Generalized linear mixed model fit by maximum likelihood (Laplace
  Approximation) [glmerMod]
 Family: binomial  ( logit )
Formula: 
Choice ~ Group * Recipient_s2z * scale(Reward) + Group * Recipient_s2z *  
    scale(Effort) + (1 + Group * Recipient_s2z + Group * scale(Effort) +  
    Group * scale(Reward) + scale(Reward) * Recipient_s2z + scale(Reward) *  
    Group + scale(Effort) * Group || ID)
   Data: PD.df
      AIC       BIC    logLik  deviance  df.resid 
 4707.790  4999.925 -2313.895  4627.790     10935 
Random effects:
 Groups Name                             Std.Dev. Corr             
 ID     (Intercept)                      2.2235                    
 ID.1   GroupPD off                      1.2331                    
        GroupPD on                       1.8712   0.45             
 ID.2   Recipient_s2zself                1.1686                    
        Recipient_s2zother               1.5370   0.33             
 ID.3   scale(Effort)                    0.7876                    
 ID.4   scale(Reward)                    0.9636                    
 ID.5   GroupPD off:Recipient_s2zself    1.6147                    
        GroupPD on:Recipient_s2zself     0.6215    0.30            
        GroupPD off:Recipient_s2zother   0.6963    0.27  0.02      
        GroupPD on:Recipient_s2zother    1.1942   -0.44  0.33  0.17
 ID.6   GroupPD off:scale(Effort)        0.7222                    
        GroupPD on:scale(Effort)         0.9751   0.54             
 ID.7   GroupPD off:scale(Reward)        0.4462                    
        GroupPD on:scale(Reward)         1.1633   0.72             
 ID.8   Recipient_s2zself:scale(Reward)  1.0145                    
        Recipient_s2zother:scale(Reward) 0.4611   0.90             
Number of obs: 10975, groups:  ID, 37
Fixed Effects:
                            (Intercept)  
                              4.6119728  
                             GroupPD on  
                              0.2983879  
                         Recipient_s2z1  
                              1.0068875  
                          scale(Reward)  
                              1.4786511  
                          scale(Effort)  
                             -1.4404275  
              GroupPD on:Recipient_s2z1  
                             -0.3486789  
               GroupPD on:scale(Reward)  
                              0.2437653  
           Recipient_s2z1:scale(Reward)  
                              0.1678096  
               GroupPD on:scale(Effort)  
                             -0.0280351  
           Recipient_s2z1:scale(Effort)  
                              0.0002695  
GroupPD on:Recipient_s2z1:scale(Reward)  
                             -0.1402762  
GroupPD on:Recipient_s2z1:scale(Effort)  
                              0.0683914  

This model converges and seems to be the most complex possible structure.

The following shows the summary output and principle components analysis, and comparison with complex model

summary(maxmax.red4.PDonvsPDoff)
Generalized linear mixed model fit by maximum likelihood (Laplace
  Approximation) [glmerMod]
 Family: binomial  ( logit )
Formula: 
Choice ~ Group * Recipient_s2z * scale(Reward) + Group * Recipient_s2z *  
    scale(Effort) + (1 + Group * Recipient_s2z + Group * scale(Effort) +  
    Group * scale(Reward) + scale(Reward) * Recipient_s2z + scale(Reward) *  
    Group + scale(Effort) * Group || ID)
   Data: PD.df
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e+05))

     AIC      BIC   logLik deviance df.resid 
  4707.8   4999.9  -2313.9   4627.8    10935 

Scaled residuals: 
     Min       1Q   Median       3Q      Max 
-104.173    0.009    0.048    0.181   13.436 

Random effects:
 Groups Name                             Variance Std.Dev. Corr             
 ID     (Intercept)                      4.9438   2.2235                    
 ID.1   GroupPD off                      1.5205   1.2331                    
        GroupPD on                       3.5014   1.8712   0.45             
 ID.2   Recipient_s2zself                1.3657   1.1686                    
        Recipient_s2zother               2.3625   1.5370   0.33             
 ID.3   scale(Effort)                    0.6203   0.7876                    
 ID.4   scale(Reward)                    0.9285   0.9636                    
 ID.5   GroupPD off:Recipient_s2zself    2.6073   1.6147                    
        GroupPD on:Recipient_s2zself     0.3863   0.6215    0.30            
        GroupPD off:Recipient_s2zother   0.4849   0.6963    0.27  0.02      
        GroupPD on:Recipient_s2zother    1.4261   1.1942   -0.44  0.33  0.17
 ID.6   GroupPD off:scale(Effort)        0.5216   0.7222                    
        GroupPD on:scale(Effort)         0.9509   0.9751   0.54             
 ID.7   GroupPD off:scale(Reward)        0.1991   0.4462                    
        GroupPD on:scale(Reward)         1.3533   1.1633   0.72             
 ID.8   Recipient_s2zself:scale(Reward)  1.0292   1.0145                    
        Recipient_s2zother:scale(Reward) 0.2126   0.4611   0.90             
Number of obs: 10975, groups:  ID, 37

Fixed effects:
                                          Estimate Std. Error z value Pr(>|z|)
(Intercept)                              4.6119728  0.5195696   8.877  < 2e-16
GroupPD on                               0.2983879  0.4462602   0.669   0.5037
Recipient_s2z1                           1.0068875  0.2405970   4.185 2.85e-05
scale(Reward)                            1.4786511  0.2364835   6.253 4.04e-10
scale(Effort)                           -1.4404275  0.1990988  -7.235 4.66e-13
GroupPD on:Recipient_s2z1               -0.3486789  0.2047100  -1.703   0.0885
GroupPD on:scale(Reward)                 0.2437653  0.2100617   1.160   0.2459
Recipient_s2z1:scale(Reward)             0.1678096  0.0977907   1.716   0.0862
GroupPD on:scale(Effort)                -0.0280351  0.1899532  -0.148   0.8827
Recipient_s2z1:scale(Effort)             0.0002695  0.0687693   0.004   0.9969
GroupPD on:Recipient_s2z1:scale(Reward) -0.1402762  0.1044689  -1.343   0.1794
GroupPD on:Recipient_s2z1:scale(Effort)  0.0683914  0.0942539   0.726   0.4681
                                           
(Intercept)                             ***
GroupPD on                                 
Recipient_s2z1                          ***
scale(Reward)                           ***
scale(Effort)                           ***
GroupPD on:Recipient_s2z1               .  
GroupPD on:scale(Reward)                   
Recipient_s2z1:scale(Reward)            .  
GroupPD on:scale(Effort)                   
Recipient_s2z1:scale(Effort)               
GroupPD on:Recipient_s2z1:scale(Reward)    
GroupPD on:Recipient_s2z1:scale(Effort)    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
             (Intr) GrpPDo Rcp_21 scl(R) scl(E) GrPDo:R_21 GPDo:(R R_21:(R
GroupPD on   -0.314                                                       
Recpnt_s2z1   0.176 -0.266                                                
scale(Rwrd)   0.104 -0.094  0.083                                         
scal(Effrt)  -0.095  0.090 -0.049 -0.054                                  
GrpPDo:R_21  -0.175  0.241 -0.534 -0.069  0.054                           
GrpPDon:(R)  -0.094  0.275 -0.056 -0.095  0.054  0.115                    
Rcpn_21:(R)   0.083 -0.057  0.301  0.370 -0.029 -0.241     -0.103         
GrpPDon:(E)   0.079 -0.225  0.038  0.048 -0.297 -0.077     -0.141   0.019 
Rcpn_21:(E)  -0.047  0.035 -0.267 -0.020  0.096  0.271      0.012  -0.236 
GPDo:R_21:(R -0.057  0.083 -0.211 -0.083  0.027  0.451      0.138  -0.525 
GPDo:R_21:(E  0.028 -0.037  0.168  0.014 -0.065 -0.370     -0.014   0.145 
             GPDo:(E R_21:(E GPDo:R_21:(R
GroupPD on                               
Recpnt_s2z1                              
scale(Rwrd)                              
scal(Effrt)                              
GrpPDo:R_21                              
GrpPDon:(R)                              
Rcpn_21:(R)                              
GrpPDon:(E)                              
Rcpn_21:(E)  -0.090                      
GPDo:R_21:(R -0.034   0.199              
GPDo:R_21:(E  0.098  -0.698  -0.282      
summary(rePCA(maxmax.red4.PDonvsPDoff))
$ID
Importance of components:
                         [,1]   [,2]   [,3]   [,4]    [,5]    [,6]    [,7]
Standard deviation     2.2235 1.9883 1.7552 1.6239 1.20967 1.10256 1.09882
Proportion of Variance 0.2025 0.1619 0.1262 0.1080 0.05994 0.04979 0.04946
Cumulative Proportion  0.2025 0.3644 0.4906 0.5986 0.65855 0.70835 0.75780
                          [,8]   [,9]   [,10]   [,11]   [,12]   [,13]   [,14]
Standard deviation     1.08443 1.0446 1.03375 0.96360 0.78760 0.66755 0.54453
Proportion of Variance 0.04817 0.0447 0.04377 0.03803 0.02541 0.01825 0.01215
Cumulative Proportion  0.80597 0.8507 0.89444 0.93247 0.95788 0.97613 0.98828
                         [,15]   [,16]   [,17]
Standard deviation     0.40321 0.29851 0.18562
Proportion of Variance 0.00666 0.00365 0.00141
Cumulative Proportion  0.99494 0.99859 1.00000
anova(maxmax.red0.PDonvsPDoff, maxmax.red4.PDonvsPDoff)
Data: PD.df
Models:
maxmax.red4.PDonvsPDoff: Choice ~ Group * Recipient_s2z * scale(Reward) + Group * Recipient_s2z * scale(Effort) + (1 + Group * Recipient_s2z + Group * scale(Effort) + Group * scale(Reward) + scale(Reward) * Recipient_s2z + scale(Reward) * Group + scale(Effort) * Group || ID)
maxmax.red0.PDonvsPDoff: Choice ~ Group * Recipient_s2z * scale(Reward) + Group * Recipient_s2z * scale(Effort) + (1 + Group * Recipient_s2z * scale(Reward) + Group * Recipient_s2z * scale(Effort) || ID)
                        npar    AIC    BIC  logLik deviance  Chisq Df
maxmax.red4.PDonvsPDoff   40 4707.8 4999.9 -2313.9   4627.8          
maxmax.red0.PDonvsPDoff   63 4746.9 5207.0 -2310.4   4620.9 6.9078 23
                        Pr(>Chisq)
maxmax.red4.PDonvsPDoff           
maxmax.red0.PDonvsPDoff     0.9995

This shows that the reduced model is not inferior to the singular-fitting maximal model

Finally, as per Bates et al, I will build the same model but with correlation parameter

maxmax.red4corr.PDonvsPDoff <- glmer(Choice ~ Group*Recipient_s2z*scale(Reward) + 
                                     Group*Recipient_s2z*scale(Effort) +
                                    (1 + Group*Recipient_s2z + Group*scale(Effort) + Group*scale(Reward) +
                                       scale(Reward)*Recipient_s2z + scale(Reward)*Group +
                                       scale(Effort)*Group | ID), family='binomial', data=PD.df, control=glmerControl(optimizer='bobyqa', optCtrl=list(maxfun=2e5)))
summary(maxmax.red4corr.PDonvsPDoff)
Generalized linear mixed model fit by maximum likelihood (Laplace
  Approximation) [glmerMod]
 Family: binomial  ( logit )
Formula: 
Choice ~ Group * Recipient_s2z * scale(Reward) + Group * Recipient_s2z *  
    scale(Effort) + (1 + Group * Recipient_s2z + Group * scale(Effort) +  
    Group * scale(Reward) + scale(Reward) * Recipient_s2z + scale(Reward) *  
    Group + scale(Effort) * Group | ID)
   Data: PD.df
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e+05))

     AIC      BIC   logLik deviance df.resid 
  4701.0   5117.3  -2293.5   4587.0    10918 

Scaled residuals: 
     Min       1Q   Median       3Q      Max 
-121.296    0.008    0.047    0.181   14.307 

Random effects:
 Groups Name                         Variance Std.Dev. Corr                   
 ID     (Intercept)                  8.7303   2.9547                          
        GroupPD on                   5.2725   2.2962   -0.28                  
        Recipient_s2z1               1.5141   1.2305   -0.04 -0.28            
        scale(Effort)                1.2697   1.1268    0.27  0.08  0.21      
        scale(Reward)                1.7014   1.3044    0.42 -0.06  0.16 -0.11
        GroupPD on:Recipient_s2z1    0.3700   0.6083   -0.02  0.19 -0.47  0.11
        GroupPD on:scale(Effort)     0.7991   0.8939   -0.03 -0.20  0.07 -0.26
        GroupPD on:scale(Reward)     1.0313   1.0155   -0.10  0.17 -0.56  0.01
        Recipient_s2z1:scale(Reward) 0.1616   0.4019   -0.25 -0.08  0.88  0.13
                        
                        
                        
                        
                        
                        
 -0.33                  
 -0.18 -0.28            
 -0.08  0.40 -0.06      
  0.25 -0.48 -0.27 -0.58
Number of obs: 10975, groups:  ID, 37

Fixed effects:
                                        Estimate Std. Error z value Pr(>|z|)
(Intercept)                              4.65860    0.53996   8.628  < 2e-16
GroupPD on                               0.24239    0.50946   0.476 0.634241
Recipient_s2z1                           0.88953    0.26796   3.320 0.000901
scale(Reward)                            1.78506    0.27350   6.527 6.72e-11
scale(Effort)                           -1.32823    0.21855  -6.078 1.22e-09
GroupPD on:Recipient_s2z1               -0.30530    0.22499  -1.357 0.174786
GroupPD on:scale(Reward)                 0.12295    0.28794   0.427 0.669376
Recipient_s2z1:scale(Reward)             0.17421    0.13497   1.291 0.196809
GroupPD on:scale(Effort)                -0.03339    0.22862  -0.146 0.883888
Recipient_s2z1:scale(Effort)             0.02133    0.06991   0.305 0.760321
GroupPD on:Recipient_s2z1:scale(Reward) -0.20496    0.11518  -1.779 0.075160
GroupPD on:Recipient_s2z1:scale(Effort)  0.06411    0.09702   0.661 0.508761
                                           
(Intercept)                             ***
GroupPD on                                 
Recipient_s2z1                          ***
scale(Reward)                           ***
scale(Effort)                           ***
GroupPD on:Recipient_s2z1                  
GroupPD on:scale(Reward)                   
Recipient_s2z1:scale(Reward)               
GroupPD on:scale(Effort)                   
Recipient_s2z1:scale(Effort)               
GroupPD on:Recipient_s2z1:scale(Reward) .  
GroupPD on:Recipient_s2z1:scale(Effort)    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
             (Intr) GrpPDo Rcp_21 scl(R) scl(E) GrPDo:R_21 GPDo:(R R_21:(R
GroupPD on   -0.375                                                       
Recpnt_s2z1   0.100 -0.262                                                
scale(Rwrd)   0.499 -0.219  0.224                                         
scal(Effrt)   0.099  0.172  0.090 -0.118                                  
GrpPDo:R_21  -0.117  0.257 -0.498 -0.202  0.097                           
GrpPDon:(R)  -0.224  0.474 -0.332 -0.351  0.060  0.205                    
Rcpn_21:(R)   0.006 -0.103  0.721  0.301  0.049 -0.322     -0.284         
GrpPDon:(E)   0.078 -0.345  0.059 -0.050 -0.414 -0.163     -0.119  -0.101 
Rcpn_21:(E)  -0.040  0.037 -0.222  0.002  0.099  0.260     -0.003  -0.134 
GPDo:R_21:(R -0.062  0.094 -0.189 -0.099  0.023  0.441      0.145  -0.412 
GPDo:R_21:(E  0.024 -0.047  0.141 -0.008 -0.068 -0.359      0.007   0.071 
             GPDo:(E R_21:(E GPDo:R_21:(R
GroupPD on                               
Recpnt_s2z1                              
scale(Rwrd)                              
scal(Effrt)                              
GrpPDo:R_21                              
GrpPDon:(R)                              
Rcpn_21:(R)                              
GrpPDon:(E)                              
Rcpn_21:(E)  -0.091                      
GPDo:R_21:(R -0.039   0.172              
GPDo:R_21:(E  0.115  -0.697  -0.248      

This model selection procedure followed published guidelines for refinement of the ‘maximal’ random effect structure as set out by Barr et al (2013) and Bates et al (2015), and conforms to the methods reported in other lab outputs relating to this task. The model identified is not inferior to the ‘maximal’ model.

Finally I will demonstrate that the above model outperforms the model with only first order random effects (i.e. Choice ~ Fixed effects + (1 + Effort + Reward + Recipient + Group | ID), and therefore does not justify use of the simpler model)

first.orderREs.PDonvsPDoff <- glmer(Choice ~ Group*Recipient_s2z*scale(Reward) + 
                                     Group*Recipient_s2z*scale(Effort) +
                                    (1 + Group + Recipient_s2z + scale(Effort) + scale(Reward) 
                                        | ID), family='binomial', data=PD.df, control=glmerControl(optimizer='bobyqa', optCtrl=list(maxfun=2e5)))
anova(maxmax.red4corr.PDonvsPDoff,first.orderREs.PDonvsPDoff)
Data: PD.df
Models:
first.orderREs.PDonvsPDoff: Choice ~ Group * Recipient_s2z * scale(Reward) + Group * Recipient_s2z * scale(Effort) + (1 + Group + Recipient_s2z + scale(Effort) + scale(Reward) | ID)
maxmax.red4corr.PDonvsPDoff: Choice ~ Group * Recipient_s2z * scale(Reward) + Group * Recipient_s2z * scale(Effort) + (1 + Group * Recipient_s2z + Group * scale(Effort) + Group * scale(Reward) + scale(Reward) * Recipient_s2z + scale(Reward) * Group + scale(Effort) * Group | ID)
                            npar    AIC    BIC  logLik deviance  Chisq Df
first.orderREs.PDonvsPDoff    27 4749.4 4946.6 -2347.7   4695.4          
maxmax.red4corr.PDonvsPDoff   57 4701.0 5117.3 -2293.5   4587.0 108.43 30
                            Pr(>Chisq)    
first.orderREs.PDonvsPDoff                
maxmax.red4corr.PDonvsPDoff  8.275e-11 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1