feat(matlab): print full native fitlme/fitglme summary in every scenario

Add tdcs_model_summary as the single place that renders a fitted model
verbatim (disp(model) with the Command-Window <strong> markup stripped),
and route every report through it so all scenarios emit the complete
model-fitting output:

- tdcs_report: adds the learning-rate GLMM's full summary (count/rate
  already had theirs); localCleanDisp now delegates to the shared helper.
- tdcs_lme_report / tdcs_paper_lme: embed the full fitlme summary before
  the curated effect table.
- tdcs_phase_lme: appends each phase's full fitlme summary.

Tests: tReport asserts 3 native summaries in a GLMM report; tLme asserts
the lme_*/paper_*/phase_* reports embed 1/1/3 summaries with markup
stripped. Suite 39/39.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Experiments DB Dev
2026-07-20 14:21:34 -04:00
parent d59ff2b659
commit 0e9263b958
41 changed files with 4637 additions and 7 deletions
+22
View File
@@ -59,6 +59,28 @@ classdef tLme < matlab.unittest.TestCase
testCase.verifyError(@() tdcs_glm('lme_nonsense'), 'tdcs_glm:badScenario');
end
function testReportsIncludeFullModelSummary(testCase)
% Every scenario prints the full native fitlme summary. The lme_*,
% paper_*, and phase_* reports each embed disp(model), whose
% 'Fixed effects coefficients' header is the marker (phase_* has
% one per phase -> 3). Markup must be stripped.
here = fileparts(fileparts(mfilename('fullpath'))); % analysis/matlab
resDir = fullfile(here, 'results');
cases = struct( ...
'lme_mergeA2_full', 1, ...
'paper_mergeA2', 1, ...
'phase_mergeA2', 3);
for sc = fieldnames(cases)'
name = sc{1};
evalc(sprintf('tdcs_glm(''%s'')', name));
txt = fileread(fullfile(resDir, [name '.txt']));
testCase.verifyEqual(count(txt, 'Fixed effects coefficients (95% CIs):'), ...
cases.(name), sprintf('%s: missing full model summary', name));
testCase.verifyFalse(contains(txt, '<strong>'), ...
sprintf('%s: markup not stripped', name));
end
end
function testMergeNaiveGrouping(testCase)
% mergeNaive: control = Box-A2 + Naive (7), tDCS = Box-B2 + Right (4),
% Box-A unchanged (1); Naive is relabeled away.
+4
View File
@@ -28,6 +28,10 @@ classdef tReport < matlab.unittest.TestCase
testCase.verifyTrue(contains(txt, 'CAVEATS'));
% Command-Window-only markup must be stripped from the report.
testCase.verifyFalse(contains(txt, '<strong>'));
% Full native GLMM summary is present for all three models
% (count, rate, learning-rate): each disp() prints this header.
testCase.verifyEqual(count(txt, 'Fixed effects coefficients (95% CIs):'), 3, ...
'Expected the full fitglme summary for count, rate, and learning GLMMs.');
end
function testUnmergedScenarioIncludesClassification(testCase)