==============================================================================
tDCS GLM report -- scenario: mergeNaive_full
==============================================================================
merge key: mergeNaive   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-A             1         15          70.7      0.557       14
Electrode-Box-A2            7        107          58.4      0.479       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
    569.28    588.6    -278.64          557.28  

Fixed effects coefficients (95% CIs):
    Name                              Estimate      SE            tStat   
    {'(Intercept)'           }            4.5235      0.074032      61.102
    {'group_Electrode-Box-A' }          -0.12346       0.16529    -0.74694
    {'group_Electrode-Box-A2'}          -0.26481      0.093039     -2.8462
    {'day_c'                 }           0.10065     0.0023081      43.608
    {'day_c2'                }        -0.0064638    0.00024915     -25.944


    DF     pValue         Lower         Upper     
    180    2.6809e-122        4.3774        4.6696
    180        0.45607      -0.44962        0.2027
    180      0.0049387      -0.44839     -0.081217
    180     1.2924e-97      0.096096       0.10521
    180     1.0244e-62    -0.0069555    -0.0059722

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

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
    663.16    682.41    -325.58          651.16  

Fixed effects coefficients (95% CIs):
    Name                              Estimate      SE            tStat   
    {'(Intercept)'           }           0.62291       0.11692      5.3275
    {'group_Electrode-Box-A' }          -0.21631       0.26048    -0.83042
    {'group_Electrode-Box-A2'}           -0.5314       0.14632     -3.6318
    {'day_c'                 }           0.12505      0.003415      36.618
    {'day_c2'                }        -0.0069489    0.00035361     -19.651


    DF     pValue        Lower         Upper     
    178     2.981e-07       0.39218       0.85365
    178       0.40742      -0.73034       0.29772
    178    0.00036793      -0.82014      -0.24265
    178    8.6013e-85       0.11831       0.13179
    178    1.8602e-46    -0.0076467    -0.0062511

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

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
    561.97    587.73    -272.98          545.97  

Fixed effects coefficients (95% CIs):
    Name                                    Estimate      SE            tStat   
    {'(Intercept)'                 }            4.5372      0.083001      54.664
    {'group_Electrode-Box-A'       }          -0.13394       0.18535    -0.72264
    {'group_Electrode-Box-A2'      }          -0.27771       0.10424     -2.6641
    {'day_c'                       }          0.090249     0.0032246      27.988
    {'day_c2'                      }        -0.0066704    0.00025769     -25.885
    {'group_Electrode-Box-A:day_c' }          0.010369     0.0086089      1.2044
    {'group_Electrode-Box-A2:day_c'}          0.020125     0.0041158      4.8897


    DF     pValue         Lower         Upper     
    178    3.3741e-113        4.3734         4.701
    178        0.47085       -0.4997       0.23182
    178      0.0084289      -0.48341     -0.071999
    178     4.2889e-67      0.083886      0.096613
    178     3.0498e-62    -0.0071789    -0.0061619
    178        0.23002    -0.0066197      0.027358
    178     2.2462e-06      0.012003      0.028247

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

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=6.25
  Welch two-sided p=0.689, Mann-Whitney p=0.527 (nB=4, nA=7)  -> 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.30x Box-A2  (one-sided p=0.0022)  -> SUPPORTED
  [rate/level ] Box-B2 = 1.70x Box-A2  (one-sided p=0.0001)  -> SUPPORTED

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

(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.
