feat(matlab): mergeNaive grouping (control=A2+Naive, tDCS=B2+Right) + GLM/power

Adds cfg.mergeNaive and scenario/paper/phase/power support. This pooled grouping
is the closest replication of the paper's full pattern: paper LME interaction
F(1)=7.30, p=0.008 (paper 7.12/0.008), stim main n.s. (p=0.21 = equal on Day 1),
strong day effect; the overall tDCS advantage is significant at the cluster-honest
per-animal level (rate p=0.003) and well powered. Adds a grouping test. Suite 38/38.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Experiments DB Dev
2026-07-20 12:50:35 -04:00
parent 7b5c27df8c
commit 77b631bcac
6 changed files with 62 additions and 2 deletions
+12
View File
@@ -59,6 +59,18 @@ classdef tLme < matlab.unittest.TestCase
testCase.verifyError(@() tdcs_glm('lme_nonsense'), 'tdcs_glm:badScenario');
end
function testMergeNaiveGrouping(testCase)
% mergeNaive: control = Box-A2 + Naive (7), tDCS = Box-B2 + Right (4),
% Box-A unchanged (1); Naive is relabeled away.
[S, ~] = tdcs_scenario_data('mergeNaive_full');
sg = unique(S(:, {'subject','group'}));
n = @(g) sum(sg.group == g);
testCase.verifyEqual(n('Electrode-Box-A2'), 7);
testCase.verifyEqual(n('Electrode-Box-B2'), 4);
testCase.verifyEqual(n('Electrode-Box-A'), 1);
testCase.verifyFalse(any(sg.group == 'Naive'));
end
function testPaperFormulaReplicatesInteraction(testCase)
% The paper's exact formula (behavior ~ stim + day + stim:day +
% (1|rat)) on mergeA2 reproduces the paper's interaction