==============================================================================
tDCS GLM report -- scenario: unmerged_d0_10
==============================================================================
merge key: unmerged   day window: 0..10   observations: 126
==============================================================================
DESCRIPTIVES
==============================================================================
group                  n_subj n_sessions  mean_success  mean_rate  max_day
--------------------------------------------------------------------------
Electrode-Box-B2            3         33          70.0      0.555       10
Electrode-Box-A             1         11          58.9      0.499       10
Electrode-Box-A2            3         28          52.1      0.433       10
Naive                       4         43          46.8      0.440       10
Right-Electrode             1         11          63.4      0.499       10

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

Generalized linear mixed-effects model fit by PL

Model information:
    Number of observations             126
    Fixed effects coefficients           7
    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
    301.01    323.7    -142.51          285.01  

Fixed effects coefficients (95% CIs):
    Name                              Estimate     SE           tStat       DF 
    {'(Intercept)'           }           4.2892      0.10522      40.765    119
    {'group_Electrode-Box-A' }         -0.16759      0.20935    -0.80052    119
    {'group_Electrode-Box-A2'}         -0.14442      0.14887    -0.97013    119
    {'group_Naive'           }         -0.44336      0.13882     -3.1938    119
    {'group_Right-Electrode' }        -0.094696      0.20909    -0.45289    119
    {'day_c'                 }          0.20188    0.0052727      38.287    119
    {'day_c2'                }        -0.024069    0.0015714     -15.317    119


    pValue        Lower       Upper    
    9.1655e-72      4.0809       4.4976
         0.425    -0.58213      0.24695
       0.33395    -0.43919      0.15035
     0.0017973    -0.71824     -0.16848
       0.65145    -0.50872      0.31933
    9.4346e-69     0.19144      0.21232
    6.4425e-30    -0.02718    -0.020957

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

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             124
    Fixed effects coefficients           7
    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
    366.74    389.3    -175.37          350.74  

Fixed effects coefficients (95% CIs):
    Name                              Estimate     SE           tStat       DF 
    {'(Intercept)'           }          0.21772      0.13736       1.585    117
    {'group_Electrode-Box-A' }         -0.27791       0.2726     -1.0195    117
    {'group_Electrode-Box-A2'}         -0.37423      0.19356     -1.9334    117
    {'group_Naive'           }         -0.64393      0.18075     -3.5625    117
    {'group_Right-Electrode' }         -0.25889      0.27218    -0.95118    117
    {'day_c'                 }          0.21668    0.0069264      31.283    117
    {'day_c2'                }        -0.013737    0.0021988     -6.2475    117


    pValue        Lower        Upper     
       0.11567    -0.054325       0.48976
       0.31008     -0.81779       0.26196
        0.0556     -0.75756     0.0091015
     0.0005325      -1.0019      -0.28596
       0.34348     -0.79792       0.28014
    1.1453e-58      0.20296        0.2304
    6.9755e-09    -0.018092    -0.0093824

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

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             126
    Fixed effects coefficients          11
    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
    305.19    339.23    -140.6           281.19  

Fixed effects coefficients (95% CIs):
    Name                                    Estimate     SE           tStat   
    {'(Intercept)'                 }           4.3338      0.10278      42.165
    {'group_Electrode-Box-A'       }         -0.23805      0.20569     -1.1574
    {'group_Electrode-Box-A2'      }         -0.17701      0.14533      -1.218
    {'group_Naive'                 }         -0.54258      0.13655     -3.9736
    {'group_Right-Electrode'       }         -0.15185      0.20519    -0.74005
    {'day_c'                       }          0.17638    0.0080904      21.802
    {'day_c2'                      }        -0.024639    0.0015803     -15.591
    {'group_Electrode-Box-A:day_c' }         0.044079     0.016893      2.6093
    {'group_Electrode-Box-A2:day_c'}         0.011922     0.012896     0.92443
    {'group_Naive:day_c'           }         0.059567     0.011689      5.0961
    {'group_Right-Electrode:day_c' }         0.036369     0.016336      2.2263


    DF     pValue        Lower        Upper    
    115    8.6925e-72       4.1302       4.5374
    115       0.24953     -0.64548      0.16937
    115       0.22572     -0.46489      0.11086
    115    0.00012391     -0.81305     -0.27211
    115       0.46078      -0.5583      0.25459
    115    1.1738e-42      0.16036      0.19241
    115    3.8845e-30    -0.027769    -0.021509
    115      0.010278     0.010617      0.07754
    115        0.3572    -0.013623     0.037467
    115    1.3744e-06     0.036414      0.08272
    115      0.027945      0.00401     0.068729

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

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=9.52, Box-A2 mean=8.96
  Welch two-sided p=0.643, Mann-Whitney p=0.700 (nB=3, nA=3)  -> 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=115) 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.16x Box-A2  (one-sided p=0.1660)  -> not supported
  [rate/level ] Box-B2 = 1.45x Box-A2  (one-sided p=0.0266)  -> SUPPORTED

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

Classification -- is each UNKNOWN condition A2-like or B2-like?
(ratio >1 = above that anchor; p = differs from that anchor)

  Electrode-Box-A:
    [count/level] vs Box-A2: 0.98x p=0.912   vs Box-B2: 0.85x p=0.425
                 -> AMBIGUOUS (nearer Electrode-Box-A2)
    [rate/level ] vs Box-A2: 1.10x p=0.725   vs Box-B2: 0.76x p=0.310
                 -> AMBIGUOUS (nearer Electrode-Box-A2)

  Right-Electrode:
    [count/level] vs Box-A2: 1.05x p=0.813   vs Box-B2: 0.91x p=0.651
                 -> AMBIGUOUS (nearer Electrode-Box-A2)
    [rate/level ] vs Box-A2: 1.12x p=0.673   vs Box-B2: 0.77x p=0.343
                 -> AMBIGUOUS (nearer Electrode-Box-A2)

  NOTE: each unknown has ONLY 1 subject. 'Matches' means 'not statistically
  distinguishable', weak evidence at n=1, not proof of equivalence.

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