feat(matlab): add 0-13 day window (lme_*_d0_13) + coverage warning

Box-A2 has no data past ~day 13, so the full-range days x tDCS interaction
extrapolates A2's slope and is confounded (spuriously significant, wrong sign).
Add the _d0_13 window (equal anchor coverage) and a report warning when the two
groups' day coverage is unequal. In the fair 0-13 window the interaction is n.s.
with a POSITIVE slope diff and the Day-1 tDCS effect is n.s. -- matching the
paper's 'equal on Day 1' direction (underpowered at n=8). Suite 32/32.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Experiments DB Dev
2026-07-20 09:58:19 -04:00
parent f0ce978bd4
commit 89bb95088f
6 changed files with 51 additions and 7 deletions
+16
View File
@@ -59,5 +59,21 @@ classdef tLme < matlab.unittest.TestCase
testCase.verifyError(@() tdcs_glm('lme_nonsense'), 'tdcs_glm:badScenario');
end
function testD0_13WindowFairCoverageAndParallel(testCase)
% The 0-13 window caps both anchor groups at day 13 (equal coverage),
% unlike the full window where Box-A2 stops at 13 but Box-B2 runs on.
cfg = tdcs_config();
Lfull = tdcs_lme(tdcs_scenario_data('mergeA2_full'), cfg);
L13 = tdcs_lme(tdcs_scenario_data('mergeA2_d0_13'), cfg);
% Full window: unequal coverage (A2 ends ~13, B2 runs later).
testCase.verifyGreaterThan(abs(Lfull.maxDayB - Lfull.maxDayA), 2);
% 0-13 window: equal coverage and the (truncation-driven) interaction
% is no longer significant -- the fair-window result.
testCase.verifyLessThanOrEqual(L13.maxDayA, 13);
testCase.verifyLessThanOrEqual(L13.maxDayB, 13);
testCase.verifyGreaterThan(L13.interaction.p, 0.05);
testCase.verifyLessThan(L13.day.p, 1e-6); % learning still strong
end
end
end