feat(matlab): phased days x tDCS LME + Monte-Carlo power analysis

Adds tdcs_phase_lme (same LME refit within learning phases 0-5/6-10/6-13, with
per-phase slopes + interaction 95% CI) as phase_* switch cases, and
tdcs_power_sim (Monte-Carlo power for the early-phase interaction, scored by the
cluster-honest per-animal test and the LME test) + run_power. Findings: the
Box-B2 faster-acquisition signal is in the early phase; at n=3-5/group honest
power is 0.3-0.7 even at the observed effect (need ~8/group if effect is as
observed, ~20/group if half). Adds tPhasePower tests. Suite 35/35.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Experiments DB Dev
2026-07-20 11:06:51 -04:00
parent 89bb95088f
commit e730aa0020
7 changed files with 263 additions and 3 deletions
+21
View File
@@ -107,3 +107,24 @@ sensitivity sections — `report_anchor_only` (a two-anchor-only refit) and
`report_mixed` (a Bayesian MAP random-intercept model) — are intentionally
**not** ported: the anchor-only refit is closely tracked by the main-model H2
term, and MATLAB's native `fitglme` already *is* the random-intercept model.
## Phased learning analysis and power
- **Phased days × tDCS LME** — the same `success ~ day*tDCS + (1|subject)` model refit within
learning phases (05, 610, 613), Box-B2 vs Box-A2, with per-phase slopes and the interaction
95% CI:
```
matlab -batch "tdcs_glm('phase_mergeA2')" # or phase_unmerged / phase_mergeB2
```
The Box-B2 faster-acquisition signal sits in the early (05) phase; late phases converge. The
interaction p/CI use fitlme observation-level DF and are anticonservative at these small n
(see power analysis).
- **Monte-Carlo power** — power to detect the early-phase interaction, scored with the
cluster-honest per-animal test and the LME test, across subjects-per-group and effect sizes:
```
matlab -batch "run_power" # default: mergeA2, phase 05
```
Result: at our n (35/group) honest power is ~0.30.7 even at the observed effect; ~8/group
reaches ~8090% if the effect is as large as observed, ~20/group if it is half that. The LME
test is anticonservative only at small n and converges to the honest test by n≈12.