diff --git a/analysis/matlab/README.md b/analysis/matlab/README.md index 8fbd77c..32af9d0 100644 --- a/analysis/matlab/README.md +++ b/analysis/matlab/README.md @@ -97,3 +97,13 @@ for the small, unbalanced groups in this study. What should agree is the condition classifies as A2-like/B2-like/ambiguous, and whether the learning rates differ across groups. Treat the MATLAB numbers as a sensitivity check on the Python's conclusions, not as a numerically-identical reproduction. + +## Scope vs. the Python + +The MATLAB port reproduces the Python's three core models (count, rate, +learning-rate), per-animal tests, unknown-group classification, and the H2 +verdict (read off the main model's A2-vs-B2 term). The Python's two auxiliary +sensitivity sections — `report_anchor_only` (a two-anchor-only refit) and +`report_mixed` (a Bayesian MAP random-intercept model) — are intentionally +**not** ported: the anchor-only refit is closely tracked by the main-model H2 +term, and MATLAB's native `fitglme` already *is* the random-intercept model. diff --git a/analysis/matlab/tdcs_scenario_data.m b/analysis/matlab/tdcs_scenario_data.m index 29065df..4e605ad 100644 --- a/analysis/matlab/tdcs_scenario_data.m +++ b/analysis/matlab/tdcs_scenario_data.m @@ -66,6 +66,8 @@ groupCell = groupCell(dayMask); % level). Only categories actually present after merge+window survive. S.group = categorical(groupCell); allCats = categories(S.group); +assert(ismember(cfg.ref, allCats), 'tdcs_scenario_data:refMissing', ... + 'Reference group "%s" is absent from scenario "%s".', cfg.ref, char(scenario)); otherCats = allCats(~strcmp(allCats, cfg.ref)); S.group = reordercats(S.group, [{cfg.ref}; otherCats]);