analysis(matlab): add log(day) model + Cohen's f + power to every variation

Add variation_logpower.m (self-contained) + make_variation_logpower.m,
dropping logpowersim.m + logpower_result.txt into all 28 variation folders.
Matches the paper's power code: models behavior ~ stim + log(day) +
stim:log(day) + (1|rat) (log(day+1), since our day 0 = paper Day 1), reports
Cohen's f (partial eta^2 of the interaction) and the interaction under
residual/Satterthwaite/honest random-slope DF, then runs the Monte-Carlo power
sim on the log-day ground truth (per-animal cluster-honest + LME power).

Notable: under log(day) the accumulating divergence is captured more sharply,
so several full-window scenarios reach honest significance that were n.s. under
raw day (e.g. right_only_d0_13 honest p=0.003, unmerge_d0_13 0.021,
unmerge_d0_10 0.036); Cohen's f is small-medium (~0.10-0.34).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Experiments DB Dev
2026-07-23 14:37:50 -04:00
parent bb5e2d88c0
commit 378ad6da05
58 changed files with 5328 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
function make_variation_logpower()
%MAKE_VARIATION_LOGPOWER Add the log-day model + Cohen's f + power to each variation.
% MAKE_VARIATION_LOGPOWER() copies variation_logpower.m into every
% variations/<name>/ folder with a data.csv (as logpowersim.m) and runs it,
% producing logpower_result.txt. Re-runnable; picks up new folders.
thisDir = fileparts(mfilename('fullpath'));
template = fullfile(thisDir, 'variation_logpower.m');
root = fullfile(thisDir, 'variations');
d = dir(root);
n = 0;
for i = 1:numel(d)
if ~d(i).isdir || ismember(d(i).name, {'.', '..'}); continue; end
folder = fullfile(root, d(i).name);
if ~exist(fullfile(folder, 'data.csv'), 'file'); continue; end
copyfile(template, fullfile(folder, 'logpowersim.m'));
fprintf('\n### %s ###\n', d(i).name);
localRun(fullfile(folder, 'logpowersim.m'));
n = n + 1;
end
fprintf('\nAdded logpowersim.m + logpower_result.txt to %d variation folders.\n', n);
end
function localRun(scriptPath)
run(scriptPath);
end