diff --git a/analysis/matlab/make_matched_effort.m b/analysis/matlab/make_matched_effort.m new file mode 100644 index 0000000..24dd0f8 --- /dev/null +++ b/analysis/matlab/make_matched_effort.m @@ -0,0 +1,99 @@ +function make_matched_effort() +%MAKE_MATCHED_EFFORT Compare the previous (_f) study to the current study at +% EQUAL cumulative effort (total attempts), not equal calendar days. +% +% The current animals attempt far more reaches per session than the previous +% (Forouzan) animals, so at equal day counts they have far more practice. This +% picks the current-study day cutoff 0..D whose per-animal cumulative attempts +% best matches the previous study's FULL (days 0-9) per-animal attempts, then +% builds two variation subfolders under variations/ and fits the paper's LME +% (behavior ~ stim + day + stim:day + (1|rat), on the success COUNT) in each: +% +% variations/prev_f_full/ previous study, b2_f vs a2_f, days 0-9 +% variations/matched_current_d0_/ current anchors Box-B2 vs Box-A2, 0..D +% +% Each folder holds the usual three files (data.csv, analyze.m, result.txt). +% A comparison of the two interaction estimates is printed at the end. + +thisDir = fileparts(mfilename('fullpath')); +template = fullfile(thisDir, 'variation_analyze.m'); +root = fullfile(thisDir, 'variations'); +if ~exist(root, 'dir'); mkdir(root); end + +Tf = forouzan_load_data(); +Tc = tdcs_load_data(); +B2 = 'Electrode-Box-B2'; A2 = 'Electrode-Box-A2'; + +% Target: previous study's per-animal cumulative attempts over its full span. +target = localPerAnimalMeanTotal(Tf, 0, 9); +fprintf('Previous (_f) full 0-9: %.0f attempts/animal\n', target); + +% Choose the current-study cutoff whose cumulative attempts best matches it. +anc = Tc(ismember(cellstr(Tc.group), {A2, B2}), :); +bestD = NaN; bestDiff = inf; bestVal = NaN; +for d = 2:9 + v = localPerAnimalMeanTotal(anc, 0, d); + fprintf(' current anchors 0-%d: %.0f attempts/animal\n', d, v); + if abs(v - target) < bestDiff + bestDiff = abs(v - target); bestD = d; bestVal = v; + end +end +fprintf('=> matched-effort window: current days 0-%d (%.0f vs %.0f attempts/animal)\n\n', ... + bestD, bestVal, target); + +% Build the two comparison folders and fit the paper LME in each. +prevName = 'prev_f_full'; +currName = sprintf('matched_current_d0_%d', bestD); +rPrev = localBuildAndRun(root, prevName, ... + localStimTable(Tf, 'b2_f'), template); +rCurr = localBuildAndRun(root, currName, ... + localStimTable(anc(anc.day >= 0 & anc.day <= bestD, :), B2), template); + +fprintf('\n=== PAPER LME interaction (stim x day) at matched effort ===\n'); +fprintf('%-26s %5s %5s %-22s %-14s\n', 'dataset', 'nRat', 'nObs', 'interaction', 'stim(Day1)'); +localCmpRow(prevName, rPrev); +localCmpRow(currName, rCurr); +fprintf(['\n(Both now represent ~%.0f attempts/animal of practice. The previous\n' ... + 'study spreads that over 10 sessions; the current study reaches it in %d days.)\n'], ... + target, bestD); + +end + +% ---- per-animal mean cumulative attempts over a day window -------------- +function m = localPerAnimalMeanTotal(T, lo, hi) +T = T(T.day >= lo & T.day <= hi, :); +subj = unique(T.subject); +tot = zeros(numel(subj), 1); +for i = 1:numel(subj) + tot(i) = sum(T.total(T.subject == subj(i))); +end +m = mean(tot); +end + +% ---- add a stim column (1 for treatGroup, 0 otherwise) ----------------- +function D = localStimTable(T, treatGroup) +stim = double(strcmp(cellstr(T.group), treatGroup)); +D = table(string(T.subject), string(T.group), T.day, T.success, T.total, stim, ... + 'VariableNames', {'subject', 'group', 'day', 'success', 'total', 'stim'}); +end + +% ---- write data.csv + analyze.m, run it (isolated), return VARRESULT ---- +function r = localBuildAndRun(root, name, D, template) +folder = fullfile(root, name); +if ~exist(folder, 'dir'); mkdir(folder); end +writetable(D, fullfile(folder, 'data.csv')); +copyfile(template, fullfile(folder, 'analyze.m')); +r = localRun(fullfile(folder, 'analyze.m')); +end + +function r = localRun(scriptPath) +run(scriptPath); +r = VARRESULT; %#ok +end + +function localCmpRow(name, r) +sig = 'n.s.'; +if r.interP < 0.05; sig = 'SIG'; end +fprintf('%-26s %5d %5d %+6.2f/day p=%.3f %-4s p=%.3f\n', ... + name, r.nRats, r.nObs, r.interEst, r.interP, sig, r.stimP); +end diff --git a/analysis/matlab/variations/matched_current_d0_3/analyze.m b/analysis/matlab/variations/matched_current_d0_3/analyze.m new file mode 100644 index 0000000..5fcbc92 --- /dev/null +++ b/analysis/matlab/variations/matched_current_d0_3/analyze.m @@ -0,0 +1,74 @@ +% Variation analysis -- the paper's linear mixed model on the successful-reach +% COUNT, fit on this folder's curated data subset. +% +% model: behavior ~ stim + day + stim:day + (1|rat) +% behavior = successful reaches (count per session) +% stim = 1 for the treatment group(s), 0 for the control group(s) +% day = training day within this window (0 = first analyzed day) +% rat = subject (random intercept) +% +% Self-contained: reads data.csv beside this script and writes result.txt. +% Run headless from this folder with: matlab -batch "analyze" +% (This is a copy of analysis/matlab/variation_analyze.m; see make_variations.m.) + +here = fileparts(mfilename('fullpath')); +if isempty(here); here = pwd; end +vname = regexprep(here, '.*[/\\]', ''); % folder name = variation id + +D = readtable(fullfile(here, 'data.csv'), 'TextType', 'string'); + +tbl = table(D.success, D.day - min(D.day), double(D.stim), categorical(D.subject), ... + 'VariableNames', {'behavior', 'day', 'stim', 'rat'}); +m = fitlme(tbl, 'behavior ~ stim + day + stim:day + (1|rat)'); +C = m.Coefficients; A = anova(m); ci = coefCI(m); + +gi = @(t) find(strcmp(C.Name, t), 1); +ga = @(t) find(strcmp(A.Term, t), 1); +row = @(nm, t) sprintf('%-26s t(%d)=%6.2f F(%d)=%8.3f p=%.4g\n', nm, ... + C.DF(gi(t)), C.tStat(gi(t)), A.DF1(ga(t)), A.FStat(ga(t)), C.pValue(gi(t))); + +maxT = max(D.day(D.stim == 1)); minT = min(D.day(D.stim == 1)); +maxC = max(D.day(D.stim == 0)); minC = min(D.day(D.stim == 0)); +if abs(maxT - maxC) > 2 + cov = '** WARNING: unequal day coverage -- interaction may be confounded. **'; +else + cov = '(equal day coverage over this window)'; +end + +ii = gi('day:stim'); pI = C.pValue(ii); eI = C.Estimate(ii); +if pI >= 0.05 + verdict = 'n.s. -- slopes parallel (no differential learning rate)'; +elseif eI > 0 + verdict = 'SIGNIFICANT positive -- treatment improves FASTER (benefit accumulates)'; +else + verdict = 'SIGNIFICANT negative -- treatment improves SLOWER (groups converge)'; +end + +bar = repmat('=', 1, 78); +raw = regexprep(evalc('disp(m)'), '', ''); +s = sprintf('%s\nVARIATION: %s\n%s\n', bar, vname, bar); +s = [s sprintf('model: behavior ~ stim + day + stim:day + (1|rat) (behavior = success COUNT)\n')]; +s = [s sprintf('day = training day within window (0 = first analyzed day)\n')]; +s = [s sprintf('treatment (stim=1): %s\n', strjoin(cellstr(unique(D.group(D.stim == 1))), ', '))]; +s = [s sprintf('control (stim=0): %s\n', strjoin(cellstr(unique(D.group(D.stim == 0))), ', '))]; +s = [s sprintf('N = %d rats, %d sessions raw day coverage: treat %d..%d, control %d..%d\n', ... + numel(unique(D.subject)), height(D), minT, maxT, minC, maxC)]; +s = [s sprintf('%s\n\n%s\nFULL MODEL SUMMARY -- fitlme\n%s\n%s\n', cov, bar, bar, raw)]; +s = [s sprintf('%-26s %-13s %-13s %s\n%s\n', 'effect', 't (df)', 'F (df1)', 'p', repmat('-', 1, 66))]; +s = [s row('stim x day (interaction)', 'day:stim')]; +s = [s row('day (learning)', 'day')]; +s = [s row('stim (main, window start)', 'stim')]; +s = [s sprintf('interaction 95%% CI: [%+.2f, %+.2f]\n', ci(ii, 1), ci(ii, 2))]; +s = [s sprintf('INTERPRETATION: stim x day interaction %s (p=%.4g, slope diff=%+.2f)\n', verdict, pI, eI)]; +s = [s sprintf('Paper (N=24): interaction t(227)=2.68, F(1)=7.12, p=0.008.\n')]; + +fprintf('%s', s); +fid = fopen(fullfile(here, 'result.txt'), 'w'); +fprintf(fid, '%s', s); +fclose(fid); + +% Machine-readable handoff for the summary table (see make_variations.m). +VARRESULT = struct('name', vname, 'nRats', numel(unique(D.subject)), ... + 'nObs', height(D), 'interP', pI, 'interEst', eI, ... + 'stimP', C.pValue(gi('stim')), 'dayP', C.pValue(gi('day')), ... + 'covEqual', abs(maxT - maxC) <= 2); diff --git a/analysis/matlab/variations/matched_current_d0_3/data.csv b/analysis/matlab/variations/matched_current_d0_3/data.csv new file mode 100644 index 0000000..23ad20d --- /dev/null +++ b/analysis/matlab/variations/matched_current_d0_3/data.csv @@ -0,0 +1,25 @@ +subject,group,day,success,total,stim +Banh-mi-1,Electrode-Box-B2,0,13,84,1 +Banh-mi-1,Electrode-Box-B2,1,35,86,1 +Banh-mi-1,Electrode-Box-B2,2,47,110,1 +Banh-mi-1,Electrode-Box-B2,3,65,140,1 +Banh-mi-2,Electrode-Box-A2,0,25,97,0 +Banh-mi-2,Electrode-Box-A2,1,22,101,0 +Banh-mi-2,Electrode-Box-A2,2,22,119,0 +Banh-mi-2,Electrode-Box-A2,3,29,118,0 +Egg-tart-1,Electrode-Box-B2,0,7,56,1 +Egg-tart-1,Electrode-Box-B2,1,16,78,1 +Egg-tart-1,Electrode-Box-B2,2,23,103,1 +Egg-tart-1,Electrode-Box-B2,3,63,120,1 +Egg-tart-2,Electrode-Box-A2,0,9,32,0 +Egg-tart-2,Electrode-Box-A2,1,2,38,0 +Egg-tart-2,Electrode-Box-A2,2,31,93,0 +Egg-tart-2,Electrode-Box-A2,3,44,101,0 +Root-beer-1,Electrode-Box-B2,0,11,85,1 +Root-beer-1,Electrode-Box-B2,1,18,76,1 +Root-beer-1,Electrode-Box-B2,2,40,105,1 +Root-beer-1,Electrode-Box-B2,3,55,134,1 +Root-beer-2,Electrode-Box-A2,0,22,74,0 +Root-beer-2,Electrode-Box-A2,1,31,87,0 +Root-beer-2,Electrode-Box-A2,2,49,134,0 +Root-beer-2,Electrode-Box-A2,3,31,89,0 diff --git a/analysis/matlab/variations/matched_current_d0_3/result.txt b/analysis/matlab/variations/matched_current_d0_3/result.txt new file mode 100644 index 0000000..f0fc9d2 --- /dev/null +++ b/analysis/matlab/variations/matched_current_d0_3/result.txt @@ -0,0 +1,65 @@ +============================================================================== +VARIATION: matched_current_d0_3 +============================================================================== +model: behavior ~ stim + day + stim:day + (1|rat) (behavior = success COUNT) +day = training day within window (0 = first analyzed day) +treatment (stim=1): Electrode-Box-B2 +control (stim=0): Electrode-Box-A2 +N = 6 rats, 24 sessions raw day coverage: treat 0..3, control 0..3 +(equal day coverage over this window) + +============================================================================== +FULL MODEL SUMMARY -- fitlme +============================================================================== + +Linear mixed-effects model fit by ML + +Model information: + Number of observations 24 + Fixed effects coefficients 4 + Random effects coefficients 6 + Covariance parameters 2 + +Formula: + behavior ~ 1 + day*stim + (1 | rat) + +Model fit statistics: + AIC BIC LogLikelihood Deviance + 185.35 192.42 -86.676 173.35 + +Fixed effects coefficients (95% CIs): + Name Estimate SE tStat DF pValue + {'(Intercept)'} 16.867 4.4554 3.7856 20 0.0011608 + {'day' } 6.3667 2.2049 2.8875 20 0.0091051 + {'stim' } -8.9667 6.3009 -1.4231 20 0.17013 + {'day:stim' } 10.2 3.1182 3.2711 20 0.0038217 + + + Lower Upper + 7.5728 26.161 + 1.7673 10.966 + -22.11 4.1769 + 3.6955 16.705 + +Random effects covariance parameters (95% CIs): +Group: rat (6 Levels) + Name1 Name2 Type Estimate + {'(Intercept)'} {'(Intercept)'} {'std'} 2.9163 + + + Lower Upper + 0.43116 19.725 + +Group: Error + Name Estimate Lower Upper + {'Res Std'} 8.5397 6.1599 11.839 + + +effect t (df) F (df1) p +------------------------------------------------------------------ +stim x day (interaction) t(20)= 3.27 F(1)= 10.700 p=0.003822 +day (learning) t(20)= 2.89 F(1)= 8.337 p=0.009105 +stim (main, window start) t(20)= -1.42 F(1)= 2.025 p=0.1701 +interaction 95% CI: [+3.70, +16.70] +INTERPRETATION: stim x day interaction SIGNIFICANT positive -- treatment improves FASTER (benefit accumulates) (p=0.003822, slope diff=+10.20) +Paper (N=24): interaction t(227)=2.68, F(1)=7.12, p=0.008. diff --git a/analysis/matlab/variations/prev_f_full/analyze.m b/analysis/matlab/variations/prev_f_full/analyze.m new file mode 100644 index 0000000..5fcbc92 --- /dev/null +++ b/analysis/matlab/variations/prev_f_full/analyze.m @@ -0,0 +1,74 @@ +% Variation analysis -- the paper's linear mixed model on the successful-reach +% COUNT, fit on this folder's curated data subset. +% +% model: behavior ~ stim + day + stim:day + (1|rat) +% behavior = successful reaches (count per session) +% stim = 1 for the treatment group(s), 0 for the control group(s) +% day = training day within this window (0 = first analyzed day) +% rat = subject (random intercept) +% +% Self-contained: reads data.csv beside this script and writes result.txt. +% Run headless from this folder with: matlab -batch "analyze" +% (This is a copy of analysis/matlab/variation_analyze.m; see make_variations.m.) + +here = fileparts(mfilename('fullpath')); +if isempty(here); here = pwd; end +vname = regexprep(here, '.*[/\\]', ''); % folder name = variation id + +D = readtable(fullfile(here, 'data.csv'), 'TextType', 'string'); + +tbl = table(D.success, D.day - min(D.day), double(D.stim), categorical(D.subject), ... + 'VariableNames', {'behavior', 'day', 'stim', 'rat'}); +m = fitlme(tbl, 'behavior ~ stim + day + stim:day + (1|rat)'); +C = m.Coefficients; A = anova(m); ci = coefCI(m); + +gi = @(t) find(strcmp(C.Name, t), 1); +ga = @(t) find(strcmp(A.Term, t), 1); +row = @(nm, t) sprintf('%-26s t(%d)=%6.2f F(%d)=%8.3f p=%.4g\n', nm, ... + C.DF(gi(t)), C.tStat(gi(t)), A.DF1(ga(t)), A.FStat(ga(t)), C.pValue(gi(t))); + +maxT = max(D.day(D.stim == 1)); minT = min(D.day(D.stim == 1)); +maxC = max(D.day(D.stim == 0)); minC = min(D.day(D.stim == 0)); +if abs(maxT - maxC) > 2 + cov = '** WARNING: unequal day coverage -- interaction may be confounded. **'; +else + cov = '(equal day coverage over this window)'; +end + +ii = gi('day:stim'); pI = C.pValue(ii); eI = C.Estimate(ii); +if pI >= 0.05 + verdict = 'n.s. -- slopes parallel (no differential learning rate)'; +elseif eI > 0 + verdict = 'SIGNIFICANT positive -- treatment improves FASTER (benefit accumulates)'; +else + verdict = 'SIGNIFICANT negative -- treatment improves SLOWER (groups converge)'; +end + +bar = repmat('=', 1, 78); +raw = regexprep(evalc('disp(m)'), '', ''); +s = sprintf('%s\nVARIATION: %s\n%s\n', bar, vname, bar); +s = [s sprintf('model: behavior ~ stim + day + stim:day + (1|rat) (behavior = success COUNT)\n')]; +s = [s sprintf('day = training day within window (0 = first analyzed day)\n')]; +s = [s sprintf('treatment (stim=1): %s\n', strjoin(cellstr(unique(D.group(D.stim == 1))), ', '))]; +s = [s sprintf('control (stim=0): %s\n', strjoin(cellstr(unique(D.group(D.stim == 0))), ', '))]; +s = [s sprintf('N = %d rats, %d sessions raw day coverage: treat %d..%d, control %d..%d\n', ... + numel(unique(D.subject)), height(D), minT, maxT, minC, maxC)]; +s = [s sprintf('%s\n\n%s\nFULL MODEL SUMMARY -- fitlme\n%s\n%s\n', cov, bar, bar, raw)]; +s = [s sprintf('%-26s %-13s %-13s %s\n%s\n', 'effect', 't (df)', 'F (df1)', 'p', repmat('-', 1, 66))]; +s = [s row('stim x day (interaction)', 'day:stim')]; +s = [s row('day (learning)', 'day')]; +s = [s row('stim (main, window start)', 'stim')]; +s = [s sprintf('interaction 95%% CI: [%+.2f, %+.2f]\n', ci(ii, 1), ci(ii, 2))]; +s = [s sprintf('INTERPRETATION: stim x day interaction %s (p=%.4g, slope diff=%+.2f)\n', verdict, pI, eI)]; +s = [s sprintf('Paper (N=24): interaction t(227)=2.68, F(1)=7.12, p=0.008.\n')]; + +fprintf('%s', s); +fid = fopen(fullfile(here, 'result.txt'), 'w'); +fprintf(fid, '%s', s); +fclose(fid); + +% Machine-readable handoff for the summary table (see make_variations.m). +VARRESULT = struct('name', vname, 'nRats', numel(unique(D.subject)), ... + 'nObs', height(D), 'interP', pI, 'interEst', eI, ... + 'stimP', C.pValue(gi('stim')), 'dayP', C.pValue(gi('day')), ... + 'covEqual', abs(maxT - maxC) <= 2); diff --git a/analysis/matlab/variations/prev_f_full/data.csv b/analysis/matlab/variations/prev_f_full/data.csv new file mode 100644 index 0000000..303f9cb --- /dev/null +++ b/analysis/matlab/variations/prev_f_full/data.csv @@ -0,0 +1,232 @@ +subject,group,day,success,total,stim +Afrasyab,a2_f,0,1,13,0 +Afrasyab,a2_f,1,8,24,0 +Afrasyab,a2_f,2,13,35,0 +Afrasyab,a2_f,3,8,29,0 +Afrasyab,a2_f,4,21,43,0 +Afrasyab,a2_f,5,14,42,0 +Afrasyab,a2_f,6,18,46,0 +Afrasyab,a2_f,7,21,52,0 +Afrasyab,a2_f,8,21,41,0 +Afrasyab,a2_f,9,21,55,0 +Arash,b2_f,0,9,34,1 +Arash,b2_f,1,12,41,1 +Arash,b2_f,2,15,43,1 +Arash,b2_f,3,18,44,1 +Arash,b2_f,4,16,33,1 +Arash,b2_f,5,18,47,1 +Arash,b2_f,6,13,48,1 +Arash,b2_f,7,9,38,1 +Arash,b2_f,8,18,43,1 +Arash,b2_f,9,15,47,1 +Ashkas,a2_f,0,2,30,0 +Ashkas,a2_f,1,11,35,0 +Ashkas,a2_f,2,10,30,0 +Ashkas,a2_f,3,9,33,0 +Ashkas,a2_f,4,9,41,0 +Ashkas,a2_f,5,10,36,0 +Ashkas,a2_f,6,13,46,0 +Ashkas,a2_f,7,9,42,0 +Ashkas,a2_f,8,6,36,0 +Ashkas,a2_f,9,15,48,0 +Fariborz,a2_f,0,8,32,0 +Fariborz,a2_f,1,10,32,0 +Fariborz,a2_f,2,9,34,0 +Fariborz,a2_f,3,11,35,0 +Fariborz,a2_f,4,13,35,0 +Fariborz,a2_f,5,5,38,0 +Fariborz,a2_f,6,12,44,0 +Garsivaz,b2_f,0,10,34,1 +Garsivaz,b2_f,1,12,30,1 +Garsivaz,b2_f,2,14,35,1 +Garsivaz,b2_f,3,27,56,1 +Garsivaz,b2_f,4,22,41,1 +Garsivaz,b2_f,5,30,57,1 +Garsivaz,b2_f,6,34,52,1 +Garsivaz,b2_f,7,25,49,1 +Garsivaz,b2_f,8,29,46,1 +Garsivaz,b2_f,9,25,44,1 +Iraj,b2_f,0,6,29,1 +Iraj,b2_f,1,13,37,1 +Iraj,b2_f,2,15,32,1 +Iraj,b2_f,3,20,49,1 +Iraj,b2_f,4,17,47,1 +Iraj,b2_f,5,21,47,1 +Iraj,b2_f,6,24,49,1 +Khosrow,b2_f,0,6,23,1 +Khosrow,b2_f,1,7,27,1 +Khosrow,b2_f,2,10,27,1 +Khosrow,b2_f,3,10,26,1 +Khosrow,b2_f,4,14,35,1 +Khosrow,b2_f,5,20,41,1 +Khosrow,b2_f,6,11,37,1 +Khosrow,b2_f,7,13,34,1 +Khosrow,b2_f,8,13,30,1 +Khosrow,b2_f,9,15,40,1 +Kiyanoush,b2_f,0,11,19,1 +Kiyanoush,b2_f,1,22,52,1 +Kiyanoush,b2_f,2,34,58,1 +Kiyanoush,b2_f,3,30,52,1 +Kiyanoush,b2_f,4,27,56,1 +Kiyanoush,b2_f,5,46,65,1 +Kiyanoush,b2_f,6,32,58,1 +Kiyanoush,b2_f,7,47,61,1 +Kiyanoush,b2_f,8,49,68,1 +Kiyanoush,b2_f,9,41,49,1 +Manuchehr,b2_f,0,1,22,1 +Manuchehr,b2_f,1,8,18,1 +Manuchehr,b2_f,2,9,41,1 +Manuchehr,b2_f,3,14,47,1 +Manuchehr,b2_f,4,25,60,1 +Manuchehr,b2_f,5,22,70,1 +Manuchehr,b2_f,6,37,74,1 +Manuchehr,b2_f,7,40,75,1 +Manuchehr,b2_f,8,32,55,1 +Manuchehr,b2_f,9,29,69,1 +Mehrab,a2_f,0,8,28,0 +Mehrab,a2_f,1,13,26,0 +Mehrab,a2_f,2,16,45,0 +Mehrab,a2_f,3,17,34,0 +Mehrab,a2_f,4,21,45,0 +Mehrab,a2_f,5,21,55,0 +Mehrab,a2_f,6,22,51,0 +Mehrab,a2_f,7,21,48,0 +Mehrab,a2_f,8,21,48,0 +Mehrab,a2_f,9,23,45,0 +Merdas,a2_f,0,7,30,0 +Merdas,a2_f,1,9,36,0 +Merdas,a2_f,2,8,33,0 +Merdas,a2_f,3,17,48,0 +Merdas,a2_f,4,21,45,0 +Merdas,a2_f,5,13,39,0 +Merdas,a2_f,6,19,43,0 +Merdas,a2_f,7,10,48,0 +Merdas,a2_f,8,19,52,0 +Merdas,a2_f,9,20,47,0 +Nozar,a2_f,0,4,20,0 +Nozar,a2_f,1,5,23,0 +Nozar,a2_f,2,8,43,0 +Nozar,a2_f,3,8,48,0 +Nozar,a2_f,4,11,40,0 +Nozar,a2_f,5,13,53,0 +Nozar,a2_f,6,15,50,0 +Nozar,a2_f,7,19,46,0 +Nozar,a2_f,8,18,56,0 +Nozar,a2_f,9,20,47,0 +Pashang,b2_f,0,5,32,1 +Pashang,b2_f,1,7,51,1 +Pashang,b2_f,2,18,49,1 +Pashang,b2_f,3,16,43,1 +Pashang,b2_f,4,21,36,1 +Pashang,b2_f,5,16,53,1 +Pashang,b2_f,6,18,42,1 +Pashang,b2_f,7,23,44,1 +Pashang,b2_f,8,20,43,1 +Pashang,b2_f,9,34,57,1 +Pashin,a2_f,0,7,27,0 +Pashin,a2_f,1,9,22,0 +Pashin,a2_f,2,11,41,0 +Pashin,a2_f,3,14,40,0 +Pashin,a2_f,4,12,36,0 +Pashin,a2_f,5,14,43,0 +Pashin,a2_f,6,11,42,0 +Pashin,a2_f,7,14,47,0 +Pashin,a2_f,8,13,50,0 +Pashin,a2_f,9,18,45,0 +Rostam,b2_f,0,9,29,1 +Rostam,b2_f,1,12,36,1 +Rostam,b2_f,2,14,42,1 +Rostam,b2_f,3,18,41,1 +Rostam,b2_f,4,15,45,1 +Rostam,b2_f,5,20,49,1 +Rostam,b2_f,6,21,51,1 +Rostam,b2_f,7,24,48,1 +Rostam,b2_f,8,19,46,1 +Rostam,b2_f,9,23,48,1 +Salm,a2_f,0,7,28,0 +Salm,a2_f,1,10,36,0 +Salm,a2_f,2,16,50,0 +Salm,a2_f,3,18,49,0 +Salm,a2_f,4,21,62,0 +Salm,a2_f,5,26,60,0 +Salm,a2_f,6,27,53,0 +Salm,a2_f,7,32,62,0 +Salm,a2_f,8,16,40,0 +Salm,a2_f,9,16,43,0 +Sam,b2_f,0,8,28,1 +Sam,b2_f,1,11,32,1 +Sam,b2_f,2,10,26,1 +Sam,b2_f,3,11,39,1 +Sam,b2_f,4,12,36,1 +Sam,b2_f,5,14,34,1 +Sam,b2_f,6,15,43,1 +Sam,b2_f,7,9,31,1 +Sam,b2_f,8,23,51,1 +Sam,b2_f,9,19,45,1 +Siavash,a2_f,0,10,21,0 +Siavash,a2_f,1,3,25,0 +Siavash,a2_f,2,7,39,0 +Siavash,a2_f,3,13,36,0 +Siavash,a2_f,4,12,35,0 +Siavash,a2_f,5,18,32,0 +Siavash,a2_f,6,18,45,0 +Siavash,a2_f,7,22,37,0 +Siavash,a2_f,8,18,36,0 +Siavash,a2_f,9,17,34,0 +Sohrab,b2_f,0,8,23,1 +Sohrab,b2_f,1,11,34,1 +Sohrab,b2_f,2,15,45,1 +Sohrab,b2_f,3,19,47,1 +Sohrab,b2_f,4,18,50,1 +Sohrab,b2_f,5,18,45,1 +Sohrab,b2_f,6,16,45,1 +Sohrab,b2_f,7,20,49,1 +Sohrab,b2_f,8,14,32,1 +Sohrab,b2_f,9,23,43,1 +Tahmasb,b2_f,0,7,32,1 +Tahmasb,b2_f,1,11,38,1 +Tahmasb,b2_f,2,8,37,1 +Tahmasb,b2_f,3,7,26,1 +Tahmasb,b2_f,4,12,35,1 +Tahmasb,b2_f,5,13,39,1 +Tahmasb,b2_f,6,11,41,1 +Tahmasb,b2_f,7,15,52,1 +Tahmasb,b2_f,8,23,61,1 +Tahmasb,b2_f,9,22,61,1 +Tur,a2_f,0,6,39,0 +Tur,a2_f,1,11,36,0 +Tur,a2_f,2,9,35,0 +Tur,a2_f,3,16,45,0 +Tur,a2_f,4,19,52,0 +Tur,a2_f,5,14,47,0 +Tur,a2_f,6,21,46,0 +Tus,b2_f,0,4,32,1 +Tus,b2_f,1,9,39,1 +Tus,b2_f,2,5,40,1 +Tus,b2_f,3,15,42,1 +Tus,b2_f,4,21,50,1 +Tus,b2_f,5,16,52,1 +Tus,b2_f,6,19,59,1 +Tus,b2_f,7,28,57,1 +Tus,b2_f,8,27,62,1 +Tus,b2_f,9,27,60,1 +Zal,a2_f,0,5,34,0 +Zal,a2_f,1,12,36,0 +Zal,a2_f,2,16,37,0 +Zal,a2_f,3,18,40,0 +Zal,a2_f,4,14,34,0 +Zal,a2_f,5,15,41,0 +Zal,a2_f,6,16,46,0 +Zal,a2_f,7,15,44,0 +Zal,a2_f,8,20,46,0 +Zal,a2_f,9,18,50,0 +Zav,a2_f,0,4,28,0 +Zav,a2_f,1,7,37,0 +Zav,a2_f,2,7,41,0 +Zav,a2_f,3,4,32,0 +Zav,a2_f,4,8,37,0 +Zav,a2_f,5,4,37,0 +Zav,a2_f,6,7,36,0 +Zav,a2_f,7,15,56,0 +Zav,a2_f,8,19,54,0 +Zav,a2_f,9,21,49,0 diff --git a/analysis/matlab/variations/prev_f_full/result.txt b/analysis/matlab/variations/prev_f_full/result.txt new file mode 100644 index 0000000..5a903a8 --- /dev/null +++ b/analysis/matlab/variations/prev_f_full/result.txt @@ -0,0 +1,65 @@ +============================================================================== +VARIATION: prev_f_full +============================================================================== +model: behavior ~ stim + day + stim:day + (1|rat) (behavior = success COUNT) +day = training day within window (0 = first analyzed day) +treatment (stim=1): b2_f +control (stim=0): a2_f +N = 24 rats, 231 sessions raw day coverage: treat 0..9, control 0..9 +(equal day coverage over this window) + +============================================================================== +FULL MODEL SUMMARY -- fitlme +============================================================================== + +Linear mixed-effects model fit by ML + +Model information: + Number of observations 231 + Fixed effects coefficients 4 + Random effects coefficients 24 + Covariance parameters 2 + +Formula: + behavior ~ 1 + day*stim + (1 | rat) + +Model fit statistics: + AIC BIC LogLikelihood Deviance + 1416.2 1436.9 -702.11 1404.2 + +Fixed effects coefficients (95% CIs): + Name Estimate SE tStat DF pValue + {'(Intercept)'} 7.7376 1.4647 5.2828 227 2.9782e-07 + {'day' } 1.3487 0.15094 8.9352 227 1.4298e-16 + {'stim' } 1.8961 2.0698 0.9161 227 0.36059 + {'day:stim' } 0.56023 0.21043 2.6623 227 0.0083151 + + + Lower Upper + 4.8515 10.624 + 1.0513 1.6461 + -2.1823 5.9745 + 0.14559 0.97488 + +Random effects covariance parameters (95% CIs): +Group: rat (24 Levels) + Name1 Name2 Type Estimate + {'(Intercept)'} {'(Intercept)'} {'std'} 4.3164 + + + Lower Upper + 3.1535 5.9081 + +Group: Error + Name Estimate Lower Upper + {'Res Std'} 4.4892 4.0771 4.9429 + + +effect t (df) F (df1) p +------------------------------------------------------------------ +stim x day (interaction) t(227)= 2.66 F(1)= 7.088 p=0.008315 +day (learning) t(227)= 8.94 F(1)= 79.838 p=1.43e-16 +stim (main, window start) t(227)= 0.92 F(1)= 0.839 p=0.3606 +interaction 95% CI: [+0.15, +0.97] +INTERPRETATION: stim x day interaction SIGNIFICANT positive -- treatment improves FASTER (benefit accumulates) (p=0.008315, slope diff=+0.56) +Paper (N=24): interaction t(227)=2.68, F(1)=7.12, p=0.008.