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:
@@ -59,6 +59,18 @@ classdef tLme < matlab.unittest.TestCase
|
||||
testCase.verifyError(@() tdcs_glm('lme_nonsense'), 'tdcs_glm:badScenario');
|
||||
end
|
||||
|
||||
function testPaperFormulaReplicatesInteraction(testCase)
|
||||
% The paper's exact formula (behavior ~ stim + day + stim:day +
|
||||
% (1|rat)) on mergeA2 reproduces the paper's interaction
|
||||
% (paper F(1)=7.12, p=0.008) -- same fit as the day*tDCS form.
|
||||
cfg = tdcs_config();
|
||||
evalc('L = tdcs_paper_lme(''mergeA2'', cfg);');
|
||||
testCase.verifyEqual(L.interaction.df1, 1);
|
||||
testCase.verifyEqual(L.interaction.F, 7.09, 'AbsTol', 0.1);
|
||||
testCase.verifyEqual(L.interaction.p, 0.009, 'AbsTol', 0.002);
|
||||
testCase.verifyLessThan(L.day.p, 1e-6); % strong learning
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user