# tDCS reaching study — figure and methods

![Learning curves and per-phase learning rate](matlab/results/figure_learning.png)

**Figure 1.** (A) Mean ± SEM successful reaches per session over the common 0–13
training-day window for the tDCS (Box-B2, blue) and control (Box-A2, green)
groups; the dashed line marks the fast/slow phase boundary. (B) Per-animal
learning slope (mean, 95% CI) in the fast (0–5) and slow (6–13) phases.

## Methods

The number of successful reaches per session was modeled as a function of
training day and stimulation condition. Sessions were indexed by training day
(day 0 = the first analyzed day, i.e. the previous study's "Day 1"), and the two
electrode conditions were compared as a binary tDCS factor (Box-B2 = tDCS,
Box-A2 = control; n = 3–5 animals per group). We fit linear mixed-effects models
(MATLAB R2025b, `fitlme`, Statistics and Machine Learning Toolbox) of the form
`successes ~ day * tDCS + (1 | subject)` with a per-subject random intercept; the
tDCS main effect (day centered at each window's first day) estimates the Day-1
group difference and the day × tDCS interaction estimates the difference in
learning rate. Because the anchor groups' day coverage was unequal over the full
range (Box-A2 data ended ~day 13 while Box-B2 continued), analyses were
restricted to the common 0–13 window and, to separate acquisition from plateau,
refit within a *fast* (days 0–5) and *slow* (days 6–13) phase. Given the small
number of animals, the subject was treated as the unit of inference: per-animal
learning slopes were compared between groups (Welch *t*, Mann–Whitney) and within
groups across phases (paired *t*). For each interaction we report three
denominator-DF treatments: (i) **residual DF** (the paper's method), (ii)
**Satterthwaite DF**, and (iii) an **honest random-slope test** from the richer
model `successes ~ day * tDCS + (day | subject)`. On a random-*intercept* model
the slope's error is estimated at the session level, so Satterthwaite DF stays
≈ residual and does *not* correct the pseudoreplication; only a random *slope*
lets between-animal slope variance enter the standard error, collapsing the
interaction DF toward the number of animals and agreeing with the per-animal
slope test. The random-slope test (and the per-animal test) are therefore the
honest inference; the residual/Satterthwaite `fitlme` interaction p-values are
anticonservative at this sample size and reported for comparison only.
Statistical power was estimated by
Monte-Carlo simulation from the fitted early-phase model across a range of
per-group sample sizes and effect sizes. Overall accuracy (successes/attempts)
and counts were additionally modeled with binomial and Poisson GLMMs. All
analysis code, derived datasets, and this figure are in `analysis/matlab/`.

## Design rationale (control grouping)

Box-A2 exists by design as a **sham / sensory control**: it delivers the
stimulation *sensation* without the effective modulation, so that a Box-B2
benefit can be attributed to the treatment itself rather than to the experience
of being stimulated (arousal, attention, cutaneous sensation). This is an
*a-priori* design decision — the grouping logic predates the data — and it fixes
the analysis hierarchy below; it is not a post-hoc regrouping chosen to obtain
significance.

- **Primary, sensation-controlled contrast — B2 vs A2.** Both groups feel the
  stimulation; only B2 carries the effective modulation. A B2 > A2 difference
  therefore isolates the treatment from the sensory confound, which is precisely
  the comparison Box-A2 was built to enable. This is the pre-specified primary
  test. On its own it is underpowered (n = 3 vs 4).

- **Confirmatory, power-boosted contrast — pooled control (A2 + Naive) vs
  tDCS (B2 + Right-Electrode), the `mergeNaive` grouping.** Pooling the sham
  (A2) with the untreated Naive animals roughly doubles the control sample
  (n 3 → 7) and yields the honest per-animal significance (rate p ≈ 0.003) and
  the paper-matching day × tDCS interaction. Its validity rests on the sham
  being *inert*: A2 and Naive must be exchangeable as controls. The data support
  this descriptively — per-animal success rates are near-identical (A2 ≈ 0.44 vs
  Naive ≈ 0.50; difference n.s., Welch p ≈ 0.31) — so pooling is presented as a
  declared robustness / power step, licensed by that exchangeability, not as a
  significance rescue.

- **Caveat.** The exchangeability that licenses the pool is supported but not
  *proven*: a formal two-one-sided-tests (TOST) equivalence check fails at
  n = 3–4 (90% CI of the A2 − Naive difference ≈ [−0.18, +0.06], too wide for a
  ±0.10 margin). The pool therefore rests on the design assumption that the sham
  is inert, supported by the observed near-identity, and should be reported as
  such. Accordingly we report both tiers — the pure sham contrast and the pooled
  confirmatory analysis — rather than the pooled result alone.

## Results (summary)

Both groups showed strong session-to-session learning (day effect, p < 10⁻¹³),
following a fast-then-slow trajectory (Fig. 1A): steep gains over days 0–5 that
flattened toward a plateau by day 13. The tDCS and control groups performed
comparably on Day 1 (tDCS main effect n.s.), and the tDCS group acquired faster
during the early phase (Fig. 1B; slope ≈ 15 vs 10 reaches/day; interaction +4.6,
95% CI [+1.0, +8.2]), converging by the late phase. At the subject level this
early-phase difference was a consistent trend but did not reach significance
(Welch p ≈ 0.11–0.25), and the study was underpowered at n = 3–5/group (≈30–70%
power for the observed effect; ≈8/group would be needed for the observed effect,
≈20/group for half that, to reach 80% power). This is consistent with the
previously reported days × tDCS interaction, here compressed into the early
acquisition phase — plausibly because the improved protocol's higher performance
ceiling leaves little late-phase headroom for a benefit to accumulate.

### Honest inference (random-slope test)

Under observation-level DF the early-phase days × tDCS interaction is
"significant" in several scenarios, but this is anticonservative. **Satterthwaite
DF barely changes it** (e.g. `unmerge_d0_5` p = 0.015 → 0.015; `mergeA2_full`
0.009 → 0.009), confirming that on the random-intercept model the correction is
inert. The **honest random-slope test** — where the interaction DF collapses
toward the animal count — separates the real signal from the pseudoreplicated
one:

| scenario | resid p | Satterthwaite p | **random-slope p** | verdict |
|---|---|---|---|---|
| `mergeA2_full` (unequal coverage) | 0.009 | 0.009 | **0.75** (df ≈ 10) | artifact — collapses |
| `unmerge_d0_5` (B2 vs A2, n = 3+3) | 0.015 | 0.015 | **0.13** | underpowered — n.s. |
| `right_only_d0_5` | 0.006 | 0.006 | **0.088** | n.s. |
| **`naive_a2_d0_5`** (pooled control) | 0.001 | 0.001 | **0.028** | **survives** |
| **`naive_boxa_d0_5`** (pooled control) | 0.003 | 0.003 | **0.036** | **survives** |
| **`paper_mergeNaive_d0_13`** | 0.009 | 0.009 | **0.014** | **survives** |

The pattern is coherent: the full-range/unequal-coverage interaction is a
truncation artifact that vanishes under honest DF; the pure two-anchor early
window (n = 3 + 3) shows the effect directionally but is underpowered; and the
effect reaches **honest significance only in the pre-specified pooled-control
scenarios** (`naive_a2`, `naive_boxa`, `mergeNaive`), where the larger control
sample makes the between-animal slope variance estimable. This matches the
per-animal (cluster-honest) tests exactly and is the inference we report. The
`d0_5` matched-effort and slow-phase (`d6_*`) windows do not survive.

## Scenario notation

Each analysis is named `<grouping>_<window>`, optionally prefixed by a model
family. Group codes: **B2** = Box-B2 (anodal / contralateral tDCS, the
treatment); **A2** = Box-A2 (ipsilateral sham, the control); **Naive** =
untreated; **Right** = Right-Electrode, **Box-A** = the two single-animal
"unknown" conditions.

**Groupings** (treatment = stim 1 vs control = stim 0; other groups dropped):

| name | treatment (stim = 1) | control (stim = 0) |
|---|---|---|
| `unmerge` / `unmerged` | B2 | A2 |
| `right_only` | B2 + Right | A2 |
| `naive_a2` | B2 | A2 + Naive |
| `naive_boxa` | B2 | A2 + Naive + Box-A |
| `mergeNaive` | B2 + Right | A2 + Naive |
| `mergeA2` | B2 + Right | A2 + Box-A |
| `mergeB2` | B2 + Right + Box-A | A2 |

**Windows** (training day, 0-indexed; day 0 = the previous study's "Day 1"):
`full` = all days; `d0_5` = 0–5 (fast/acquisition phase); `d0_10` = 0–10;
`d0_13` = 0–13 (last day Box-A2 has data — the fair equal-coverage window for the
anchors); `d6_10`, `d6_13` = 6–10 / 6–13 (slow/plateau phase).

**Model families:** `lme_*` = linear `successes ~ day*tDCS + (1|subject)`;
`paper_*` = the paper's formula `behavior ~ stim + day + stim:day + (1|rat)`
(same model, paper's term order); `phase_*` = the LME refit within fast/slow
phases; GLMM = Poisson (count) and Binomial (rate) mixed models.

**Interaction p-value columns:** *resid* = observation-level DF (paper's method,
anticonservative); *Satterthwaite* = Satterthwaite DF; *random-slope* / *HONEST*
= random-slope model, DF ≈ animal count (the honest test); *per-animal* =
Welch/Mann–Whitney on per-subject slopes or rates (cluster-honest).

**Previous study (`_f`, Forouzan, N = 24):** `b2_f` = Anodal (treatment),
`a2_f` = Control; validated because `b2_f`-as-stim reproduces the paper's
positive tDCS × day interaction (t(227) = 2.66, F(1) = 7.09, p = 0.008).
