feat(matlab): verbatim paper LME (behavior ~ stim+day+stim:day+(1|rat)) + power sim on it

Adds tdcs_paper_lme replicating the paper's exact formula/variable names (paper_*
switch cases): mergeA2 reproduces the interaction F(1)=7.09 vs 7.12, p=0.009 vs
0.008, with a coverage-confound warning. Rewrites tdcs_power_sim to fit that same
formula (interaction term canonicalized to day:stim). Adds a replication test.
Suite 37/37.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Experiments DB Dev
2026-07-20 12:40:26 -04:00
parent 800189371b
commit 7b5c27df8c
6 changed files with 178 additions and 47 deletions
+13
View File
@@ -142,3 +142,16 @@ term, and MATLAB's native `fitglme` already *is* the random-intercept model.
```
Produces `curated_all.csv`, `scenarios/<merge>_<window>.csv` (9), `anchors/<merge>_B2vsA2.csv`
(3, with the binary tDCS factor), and `phases/<merge>_phase_<lo>-<hi>.csv` (9), plus a MANIFEST.
## Paper replication (verbatim formula)
The paper's model, `fitlme(tbl, 'behavior ~ stim + day + stim:day + (1|rat)')`, is
replicated verbatim (behavior = successful reaches, stim = tDCS [Box-B2=1 vs Box-A2=0],
rat = subject) over the full training range:
```
matlab -batch "tdcs_glm('paper_mergeA2')" # or paper_unmerged / paper_mergeB2
```
`paper_mergeA2` reproduces the paper's interaction (F(1)=7.09 vs 7.12, p=0.009 vs 0.008); it
also warns that the full-range interaction is confounded by unequal day coverage (Box-A2 ends
~day 13) — see the _d0_13 and phased analyses. The Monte-Carlo power analysis (`run_power`,
`tdcs_power_sim`) uses this same `behavior ~ stim + day + stim:day + (1|rat)` model.