==============================================================================
tDCS GLM report -- scenario: mergeB2_d0_10
==============================================================================
merge key: mergeB2   day window: 0..10   observations: 126
==============================================================================
DESCRIPTIVES
==============================================================================
group                  n_subj n_sessions  mean_success  mean_rate  max_day
--------------------------------------------------------------------------
Electrode-Box-B2            5         55          66.4      0.533       10
Electrode-Box-A2            3         28          52.1      0.433       10
Naive                       4         43          46.8      0.440       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           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
    297.84    314.85    -142.92          285.84  

Fixed effects coefficients (95% CIs):
    Name                              Estimate     SE           tStat       DF 
    {'(Intercept)'           }           4.2369      0.08452      50.129    121
    {'group_Electrode-Box-A2'}        -0.091837      0.13759    -0.66748    121
    {'group_Naive'           }         -0.39133      0.12596     -3.1068    121
    {'day_c'                 }           0.2019    0.0052735      38.287    121
    {'day_c2'                }        -0.024069    0.0015714     -15.317    121


    pValue        Lower       Upper    
     8.553e-83      4.0696       4.4042
       0.50574    -0.36423      0.18055
     0.0023571    -0.64071     -0.14196
     1.787e-69     0.19146      0.21235
    4.1977e-30    -0.02718    -0.020958

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

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           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
    364.15    381.07    -176.07          352.15  

Fixed effects coefficients (95% CIs):
    Name                              Estimate     SE           tStat      DF 
    {'(Intercept)'           }          0.11026      0.11374    0.96938    119
    {'group_Electrode-Box-A2'}         -0.26616      0.18448    -1.4427    119
    {'group_Naive'           }         -0.53698      0.16912    -3.1751    119
    {'day_c'                 }          0.21673    0.0069278     31.283    119
    {'day_c2'                }        -0.013726    0.0021988    -6.2424    119


    pValue        Lower       Upper    
       0.33432    -0.11496      0.33548
       0.15172    -0.63144      0.09913
     0.0019073    -0.87186      -0.2021
    2.9856e-59     0.20301      0.23044
    6.8729e-09    -0.01808    -0.009372

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

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           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
    304.98    327.67    -144.49          288.98  

Fixed effects coefficients (95% CIs):
    Name                                    Estimate      SE           tStat   
    {'(Intercept)'                 }            4.2592     0.082682      51.513
    {'group_Electrode-Box-A2'      }          -0.10296      0.13455    -0.76522
    {'group_Naive'                 }          -0.46886       0.1243     -3.7722
    {'day_c'                       }            0.1907    0.0067258      28.354
    {'day_c2'                      }          -0.02454    0.0015791     -15.541
    {'group_Electrode-Box-A2:day_c'}        -0.0023862     0.012062    -0.19783
    {'group_Naive:day_c'           }          0.045036     0.010729      4.1975


    DF     pValue        Lower        Upper    
    119    3.2785e-83       4.0955        4.423
    119       0.44566     -0.36937      0.16346
    119    0.00025365     -0.71498     -0.22275
    119     9.114e-55      0.17738      0.20402
    119    2.0273e-30    -0.027667    -0.021413
    119       0.84352     -0.02627     0.021498
    119    5.2317e-05     0.023791     0.066281

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

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.74, Box-A2 mean=8.96
  Welch two-sided p=0.517, Mann-Whitney p=0.571 (nB=5, nA=3)  -> parallel learning (no slope difference detected)
(Reference only: the GLMM group x day_c joint F-test gives p=0.0001, but with just
 observation-level DF (df2=119) 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.10x Box-A2  (one-sided p=0.2522)  -> not supported
  [rate/level ] Box-B2 = 1.30x Box-A2  (one-sided p=0.0745)  -> not supported

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

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