==============================================================================
tDCS GLM report -- scenario: mergeA2_full
==============================================================================
merge key: mergeA2   day window: 0..26   observations: 185
==============================================================================
DESCRIPTIVES
==============================================================================
group                  n_subj n_sessions  mean_success  mean_rate  max_day
--------------------------------------------------------------------------
Electrode-Box-B2            4         63          80.2      0.605       22
Electrode-Box-A2            4         46          60.4      0.484       14
Naive                       4         76          59.6      0.492       26

==============================================================================
(A) LEVEL / COUNT -- Poisson GLMM (subject random intercept)
==============================================================================

Generalized linear mixed-effects model fit by PL

Model information:
    Number of observations             185
    Fixed effects coefficients           5
    Random effects coefficients         12
    Covariance parameters                1
    Distribution                    Poisson
    Link                            Log   
    FitMethod                       MPL   

Formula:
    success ~ 1 + group + day_c + day_c2 + (1 | subject)

Model fit statistics:
    AIC       BIC       LogLikelihood    Deviance
    564.95    584.27    -276.47          552.95  

Fixed effects coefficients (95% CIs):
    Name                              Estimate      SE            tStat      DF 
    {'(Intercept)'           }            4.5232      0.058089     77.867    180
    {'group_Electrode-Box-A2'}           -0.1219      0.083374    -1.4621    180
    {'group_Naive'           }          -0.36897      0.082023    -4.4984    180
    {'day_c'                 }           0.10078      0.002307     43.684    180
    {'day_c2'                }        -0.0064744    0.00024857    -26.047    180


    pValue         Lower         Upper     
    1.4699e-140        4.4086        4.6379
        0.14547      -0.28641      0.042619
     1.2247e-05      -0.53082      -0.20712
     9.6816e-98      0.096227       0.10533
     5.8173e-63    -0.0069649    -0.0059839

Random effects covariance parameters:
Group: subject (12 Levels)
    Name1                  Name2                  Type           Estimate
    {'(Intercept)'}        {'(Intercept)'}        {'std'}        0.11179 

Group: Error
    Name                        Estimate
    {'sqrt(Dispersion)'}        1       


==============================================================================
(B) LEVEL / RATE -- Binomial GLMM (subject random intercept)
==============================================================================

Generalized linear mixed-effects model fit by PL

Model information:
    Number of observations             183
    Fixed effects coefficients           5
    Random effects coefficients         12
    Covariance parameters                1
    Distribution                    Binomial
    Link                            Logit 
    FitMethod                       MPL   

Formula:
    success ~ 1 + group + day_c + day_c2 + (1 | subject)

Model fit statistics:
    AIC       BIC       LogLikelihood    Deviance
    661.66    680.91    -324.83          649.66  

Fixed effects coefficients (95% CIs):
    Name                              Estimate      SE            tStat      DF 
    {'(Intercept)'           }           0.62325       0.10794     5.7739    178
    {'group_Electrode-Box-A2'}          -0.33496       0.15306    -2.1884    178
    {'group_Naive'           }          -0.64512       0.15201    -4.2441    178
    {'day_c'                 }           0.12541     0.0034219     36.649    178
    {'day_c2'                }        -0.0069611    0.00035344    -19.695    178


    pValue        Lower         Upper     
    3.3843e-08       0.41024       0.83626
      0.029941      -0.63701     -0.032914
    3.5275e-05      -0.94509      -0.34516
    7.5329e-85       0.11866       0.13216
    1.4145e-46    -0.0076585    -0.0062636

Random effects covariance parameters:
Group: subject (12 Levels)
    Name1                  Name2                  Type           Estimate
    {'(Intercept)'}        {'(Intercept)'}        {'std'}        0.20951 

Group: Error
    Name                        Estimate
    {'sqrt(Dispersion)'}        1       


==============================================================================
(C) LEARNING RATE -- Poisson GLMM (group x day interaction)
==============================================================================

Generalized linear mixed-effects model fit by PL

Model information:
    Number of observations             185
    Fixed effects coefficients           7
    Random effects coefficients         12
    Covariance parameters                1
    Distribution                    Poisson
    Link                            Log   
    FitMethod                       MPL   

Formula:
    success ~ 1 + day_c2 + group*day_c + (1 | subject)

Model fit statistics:
    AIC       BIC       LogLikelihood    Deviance
    557.88    583.64    -270.94          541.88  

Fixed effects coefficients (95% CIs):
    Name                                    Estimate      SE           tStat  
    {'(Intercept)'                 }            4.5419     0.060057     75.626
    {'group_Electrode-Box-A2'      }          -0.13686     0.086298    -1.5859
    {'group_Naive'                 }          -0.41002     0.085075    -4.8196
    {'day_c'                       }          0.090967    0.0032463     28.021
    {'day_c2'                      }        -0.0068957    0.0002769    -24.904
    {'group_Electrode-Box-A2:day_c'}         0.0071293    0.0064228       1.11
    {'group_Naive:day_c'           }          0.023329    0.0043517     5.3609


    DF     pValue         Lower         Upper     
    178    3.0366e-137        4.4233        4.6604
    178        0.11453      -0.30716      0.033436
    178     3.0699e-06      -0.57791      -0.24214
    178     3.6033e-67      0.084561      0.097373
    178     6.7558e-60    -0.0074422    -0.0063493
    178         0.2685    -0.0055454      0.019804
    178     2.5437e-07      0.014742      0.031917

Random effects covariance parameters:
Group: subject (12 Levels)
    Name1                  Name2                  Type           Estimate
    {'(Intercept)'}        {'(Intercept)'}        {'std'}        0.11568 

Group: Error
    Name                        Estimate
    {'sqrt(Dispersion)'}        1       


Per-animal OLS slope test (Box-B2 vs Box-A2), cluster-honest:
Per-subject OLS slope of success vs day: Box-B2 mean=6.92, Box-A2 mean=7.95
  Welch two-sided p=0.531, Mann-Whitney p=0.886 (nB=4, nA=4)  -> parallel learning (no slope difference detected)
(Reference only: the GLMM group x day_c joint F-test gives p=0.0000, but with just
 observation-level DF (df2=178) it is ANTICONSERVATIVE for this few-subject design and is
 NOT the basis for the conclusion above.)

==============================================================================
INTERPRETATION
==============================================================================
Note: these are subject-level GLMMs (Laplace-approximated fitglme), not the
Python reference's population-average GEE -- directions/magnitudes should agree,
exact ratios and p-values will differ.

Anchor check -- H2: Box-B2 BETTER than Box-A2 (the two anchors must differ)
  [count/level] Box-B2 = 1.13x Box-A2  (one-sided p=0.0719)  -> not supported
  [rate/level ] Box-B2 = 1.40x Box-A2  (one-sided p=0.0143)  -> SUPPORTED

Per-animal (Box-B2 n=4 vs Box-A2 n=4), pure stats (no GLME):
  count (per-subject mean success): Welch two-sided p=0.0348, Mann-Whitney one-sided (B2>A2) p=0.0286
  rate  (per-subject pooled success/total): Welch two-sided p=0.0555, Mann-Whitney one-sided (B2>A2) p=0.0286

(No unknown groups -- they were merged into the anchors; only the H2 anchor
contrast applies.)

==============================================================================
CAVEATS
==============================================================================
  - Tiny groups: each arm has only n=3-4 subjects (Naive n=4; anchor arms n=3-5
    depending on merge), and -- in unmerged scenarios -- each unknown condition
    (Electrode-Box-A, Right-Electrode) has only n=1 subject. Treat every group
    comparison here as preliminary.
  - Single-subject classification: for a 1-subject unknown, 'matches anchor X'
    means 'not statistically distinguishable from X', NOT proof of equivalence;
    inference with a single subject in a group is fragile.
  - Count vs rate: 'success' alone is a raw count; the rate model
    (success/attempts) is the fairer accuracy comparison when attempt counts differ
    between groups.
