Files
Experiments DB Dev 0e9263b958 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>
2026-07-20 14:21:34 -04:00

29 lines
1.3 KiB
Matlab

function s = tdcs_model_summary(model, label)
%TDCS_MODEL_SUMMARY Full native fitlme/fitglme model summary as plain text.
% S = TDCS_MODEL_SUMMARY(MODEL) captures DISP(MODEL) -- the complete summary
% MATLAB prints for a fitted LinearMixedModel / GeneralizedLinearMixedModel
% (model information and fit statistics, the formula, the fixed-effects
% coefficient table with 95% CIs, and the random-effects covariance) -- and
% strips the Command-Window-only <strong>...</strong> bold markup that EVALC
% would otherwise emit as literal text, so the result is plain text suitable
% for the console and the results/*.txt files.
%
% S = TDCS_MODEL_SUMMARY(MODEL, LABEL) prefixes a titled banner naming the
% model (typically its formula), so each scenario's output carries a
% self-describing copy of the raw GLM/LME summary.
%
% This is the single place that renders a fitted model verbatim; every report
% (tdcs_report, tdcs_lme_report, tdcs_paper_lme, tdcs_phase_lme) routes
% through it so that ALL scenarios print the full summary generated by the
% MATLAB model-fitting functions.
raw = evalc('disp(model)');
s = regexprep(raw, '</?strong>', '');
if nargin > 1 && ~isempty(label)
bar = repmat('=', 1, 78);
s = sprintf('%s\nFULL MODEL SUMMARY -- %s\n%s\n%s', bar, label, bar, s);
end
end