Commit Graph

64 Commits

Author SHA1 Message Date
Experiments DB Dev 8caa0419b3 fix(matlab): halved y-label offset, batch 4
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 10:09:01 -04:00
Experiments DB Dev e07599d489 fix(matlab): halved y-label offset, batch 3
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 10:09:00 -04:00
Experiments DB Dev b04d692a3b fix(matlab): halved y-label offset, batch 2
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 10:09:00 -04:00
Experiments DB Dev c9fcd5e261 fix(matlab): halved y-label offset, batch 1
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 10:08:59 -04:00
Experiments DB Dev 353f8fb44a fix(matlab): halve y-axis label offset (0.06 -> 0.03)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 10:08:59 -04:00
Experiments DB Dev 4504a7aa4c fix(matlab): horizontal x + padded y label, batch 4
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 10:05:22 -04:00
Experiments DB Dev cfac649b93 fix(matlab): horizontal x + padded y label, batch 3
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 10:05:21 -04:00
Experiments DB Dev 28a7341100 fix(matlab): horizontal x + padded y label, batch 2
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 10:05:21 -04:00
Experiments DB Dev fa16b6116f fix(matlab): horizontal x + padded y label, batch 1
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 10:05:21 -04:00
Experiments DB Dev eafc2566f8 fix(matlab): force horizontal x labels + pad y-axis label
variation_plot: set XTickLabelRotation 0 after xticklabels('auto') so many-day
windows (e.g. unmerge_d0_10, 11 ticks) no longer auto-rotate to vertical; nudge
the y-axis label left for breathing room from the tick numbers. Regenerated all
learning-curve figures.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 10:05:20 -04:00
Experiments DB Dev 2fe44978b5 feat(matlab): y-tick-5 + grid plots, batch 4
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:58:53 -04:00
Experiments DB Dev 4e3b95d2fc feat(matlab): y-tick-5 + grid plots, batch 3
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:58:52 -04:00
Experiments DB Dev 989cf346f9 feat(matlab): y-tick-5 + grid plots, batch 2
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:58:52 -04:00
Experiments DB Dev 8fac19e42f feat(matlab): y-tick-5 + grid plots, batch 1
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:58:51 -04:00
Experiments DB Dev 00bd72a5c3 feat(matlab): count plots y-tick every 5 units + grid on
variation_plot: for the count metric set YTick to every 5 units (spanning the
data); grid on for both metrics (rate keeps auto 0.2 ticks). Regenerated all
learning-curve figures.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:58:51 -04:00
Experiments DB Dev 2749a7d208 fix(matlab): compact plot layout, batch 4
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:53:26 -04:00
Experiments DB Dev 70b07acce2 fix(matlab): compact plot layout, batch 3
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:53:26 -04:00
Experiments DB Dev 04fffcd090 fix(matlab): compact plot layout, batch 2
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:53:25 -04:00
Experiments DB Dev b3ebdf6f02 fix(matlab): compact plot layout, batch 1
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:53:25 -04:00
Experiments DB Dev 5ba141a9be fix(matlab): adopt user's compact plot layout for all variations
Port the unmerge_d0_5 fix (b6dc69c) into variation_plot.m: tight centred plot
box (Position [0.2 0.30 0.60 0.60]), TickDir out, and xticklabels('auto') --
which keeps x labels horizontal when they fit (<=~10 days) and auto-rotates
them when crowded (e.g. 14-day windows). Replaces the manual rotated-text hack.
Regenerated all learning-curve figures; removed the stray plotcurve.asv and
gitignored *.asv.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:53:25 -04:00
samsam2610 b6dc69c315 fix unmerge_d0_5 plot curve 2026-07-24 09:46:32 -04:00
Experiments DB Dev 20a9f7d2ea fix(matlab): vertical x-axis (manual text), batch 4
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:23:17 -04:00
Experiments DB Dev f0ba4706f8 fix(matlab): vertical x-axis (manual text), batch 3
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:23:17 -04:00
Experiments DB Dev b8a27db8cd fix(matlab): vertical x-axis (manual text), batch 2
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:23:16 -04:00
Experiments DB Dev 0d57846b00 fix(matlab): vertical x-axis (manual text), batch 1
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:23:16 -04:00
Experiments DB Dev 8f8fc98d6a fix(matlab): actually make x-axis labels vertical (manual rotated text)
exportgraphics on headless invisible figures ignores XTickLabelRotation/
xtickangle, so the labels stayed horizontal. Draw the tick labels as rotated
text objects (Rotation 90) instead, add bottom margin, and drop the 'training
day' axis label below them. Regenerated all learning-curve figures.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:23:16 -04:00
Experiments DB Dev f61ebf97b9 fix(matlab): vertical x-axis plots, batch 4
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:07:32 -04:00
Experiments DB Dev e401455351 fix(matlab): vertical x-axis plots, batch 3
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:07:32 -04:00
Experiments DB Dev bcadc54409 fix(matlab): vertical x-axis plots, batch 2
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:07:31 -04:00
Experiments DB Dev a4527fead3 fix(matlab): vertical x-axis plots, batch 1
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:07:31 -04:00
Experiments DB Dev cd24de173d fix(matlab): make learning-curve x-axis labels vertical
xtickangle(90) did not apply in headless export; set XTickLabelRotation=90
directly and drawnow before exportgraphics. Regenerated all learning_curve
.png / learning_curve_rate.png.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 09:07:31 -04:00
Experiments DB Dev fd40b6fb54 analysis(matlab): rate + count outputs, variation batch 5
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 02:32:53 -04:00
Experiments DB Dev 1606eb698b analysis(matlab): rate + count outputs, variation batch 4
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 02:32:53 -04:00
Experiments DB Dev 0e16690c8f analysis(matlab): rate + count outputs, variation batch 3
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 02:32:52 -04:00
Experiments DB Dev 6ba21a1a35 analysis(matlab): rate + count outputs, variation batch 2
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 02:32:52 -04:00
Experiments DB Dev 0a438a4649 analysis(matlab): rate + count outputs, variation batch 1
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 02:32:51 -04:00
Experiments DB Dev 1009f263e8 analysis(matlab): rate-variant + vertical x-axis (templates, generators, summary)
Refactor variation_{analyze,power,logpower,plot}.m to run both count and rate
metrics; plot x-axis labels vertical (xtickangle 90). SUMMARY.csv gains
interaction_p_rate / interaction_p_rs_rate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 02:32:43 -04:00
Experiments DB Dev a2a812acc8 analysis(matlab): add paper-style learning-curve plot to every variation
Add variation_plot.m + make_variation_plot.m, dropping plotcurve.m +
learning_curve.png into all 28 variation folders. Each figure plots mean +/-
SEM successful reaches per training day for the anodal/treatment group (red)
vs control (blue), in the style of the paper ("Lines indicate mean (and SEM)
across animals in the anodal (red) and control (blue) groups"). Per-group N is
read from the data and shown in the legend; training day is 1-indexed (our day
0 = paper Day 1). Headless via exportgraphics. prev_f_full reproduces the
paper's own figure (anodal N=12 vs control N=12).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 01:28:44 -04:00
Experiments DB Dev 378ad6da05 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>
2026-07-23 14:37:50 -04:00
Experiments DB Dev bb5e2d88c0 analysis(matlab): add per-variation power simulation (powersim.m + power_result.txt)
Add variation_power.m (self-contained Monte-Carlo power for the paper's
stim x day interaction, using each folder's own data as ground truth; scores
per-animal cluster-honest power + LME power across N=[3..24] and effect
multipliers 1/0.5) and make_variation_power.m, which drops powersim.m into
every variations/<name>/ folder and runs it, writing power_result.txt beside
the existing data.csv/analyze.m/result.txt. Named powersim (not power) to
avoid shadowing the MATLAB builtin. All 28 folders processed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 13:57:25 -04:00
Experiments DB Dev e1af1af7f4 analysis(matlab): Box-A pooling variations (b2 vs a2+a, b2+a vs a2)
Add make_boxa_variations.m producing 6 variation folders (data.csv + analyze.m
+ result.txt) for the paper LME over windows 0-5, 6-10, 0-10:
  boxa_a2  B2         vs A2 + Box-A   (b2 vs a2+a)
  boxa_b2  B2 + Box-A vs A2           (b2+a vs a2)
plus variations/boxa_summary.csv (residual / Satterthwaite / random-slope
interaction p). Early window (0-5) is obs-level significant (res p~0.03-0.04)
but n.s. under the honest random-slope test (rs p~0.13); later windows n.s.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 13:39:01 -04:00
Experiments DB Dev 8a18c894dd feat(matlab): add Satterthwaite DF + honest random-slope test to LME reports
Every fitlme-based report (lme_*, paper_*, phase_*, and the variations'
analyze.m) now shows, per effect: residual-DF p, Satterthwaite-DF p, and --
for the interaction -- an HONEST test from a per-animal random-SLOPE model
(day|rat), whose Satterthwaite DF collapses toward the animal count.

New: tdcs_random_slope_interaction.m (shared helper). Wired into tdcs_lme,
tdcs_paper_lme, tdcs_phase_lme, variation_analyze; SUMMARY.csv gains
interaction_p_satt / interaction_p_rs. Regenerated all results/, variations/,
matched-effort outputs.

Key point this surfaces: Satterthwaite ~= residual on the random-INTERCEPT
model (the slope's error is at session level), so it does NOT fix
pseudoreplication; the random-slope model does. Effect: full-range mergeA2
interaction 0.009 -> 0.75 (collapses); unmerge_d0_5 0.015 -> 0.13 (n.s.);
the pooled-control early windows survive honestly (naive_a2_d0_5 0.001 ->
0.028; naive_boxa_d0_5 0.003 -> 0.036). Suite 42/42.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 15:45:19 -04:00
Experiments DB Dev 5fcd97f81a analysis(matlab): formalize cross-study (current vs _f) rate comparison
Add make_crossstudy_compare.m producing crossstudy/result.txt +
crossstudy_summary.csv: current control (A2, A2+Naive) and anodal (B2) arms
vs the previous study's a2_f/b2_f, on per-animal success RATE, at full range
(0-9 both) and attempt-matched (current 0-3 vs previous full).

Finding: current > previous for both arms at full range (B2 0.54 vs 0.41
p=0.024; A2+Naive 0.42 vs 0.33 p=0.014) but the gap vanishes/reverses at
matched effort (B2 0.33 vs 0.41 n.s.; A2 0.30 vs 0.33 n.s.) -- a practice/
attempts artifact (~2.7x more attempts/session), not a stronger cohort.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 15:21:33 -04:00
Experiments DB Dev 9af33e747e analysis(matlab): matched-effort comparison (prev _f full vs current 0-3)
Add make_matched_effort.m: pick the current-study day cutoff whose per-animal
cumulative attempts best match the previous (_f) study's full-span total
(~405 attempts/animal -> current days 0-3), then fit the paper LME on both.

Two variation folders (data.csv + analyze.m + result.txt):
  variations/prev_f_full/            b2_f vs a2_f, days 0-9  (24 rats)
  variations/matched_current_d0_3/   Box-B2 vs Box-A2, 0-3   (6 rats)

At matched cumulative effort both show a significant positive stim x day
interaction (prev p=0.008 +0.56/day; current-0-3 p=0.004 +10.2/day) -- the
tDCS acceleration replicates at equal practice, though the count slopes are
not directly comparable across datasets given differing attempts/session.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 14:39:15 -04:00
Experiments DB Dev d9b65a3279 analysis(matlab): convert previous (Forouzan) study to our long format
Add forouzan_load_data.m (joins raw/Data_Forouzan.csv + raw/Total_Success.csv)
and make_forouzan_data.m, producing analysis/forouzan_reach_data.csv in our
curated column format (subject, group, day, success, total). Group is mapped
Anodal -> b2_f (tDCS), Control -> a2_f (control); Hand ignored; day 0-indexed
(Session 1 = day 0 = paper 'Day 1'); early-stopped sessions (total=0) dropped.

Conversion validated by refitting the paper's own LME on the converted data:
interaction t(227)=2.66, F(1)=7.09, p=0.0083 -- reproduces the paper's
reported t(227)=2.68, F(1)=7.12, p=0.008, N=24 (12 Anodal / 12 Control).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 14:18:47 -04:00
samsam2610 a4dff31772 add prev data 2026-07-22 13:58:36 -04:00
samsam2610 38f5ee1119 add prev data 2026-07-22 13:51:40 -04:00
Experiments DB Dev 969c0205e8 analysis(matlab): per-variation subfolders (grouping x window) for the paper LME
Add make_variations.m + variation_analyze.m generating 20 self-contained
subfolders under analysis/matlab/variations/, one per grouping x day-window,
each with exactly three files: data.csv (curated subset), analyze.m (a simple
standalone script fitting behavior ~ stim + day + stim:day + (1|rat) on the
success COUNT), and result.txt (its output). Plus variations/SUMMARY.csv.

Groupings (stim=1 / stim=0, other groups dropped):
  unmerge     B2 vs A2
  right_only  B2+Right vs A2            (Box-A dropped)
  naive_a2    B2 vs A2+Naive           (Right, Box-A dropped)
  naive_boxa  B2 vs A2+Naive+Box-A     (Right dropped)
Windows: 0-10, 0-13, 0-5, 6-10, 6-13. All 20 have equal day coverage.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 20:49:54 -04:00
Experiments DB Dev 963fd889b2 feat(matlab): windowed paper-LME replication for mergeNaive (d0_10, d0_13)
Make tdcs_paper_lme window-aware (windowKey 'full'|'d0_10'|'d0_13',
default 'full' -> unchanged filename). Windowed runs give the two anchor
arms equal day coverage, so the stim:day interaction is not confounded by
the full-range coverage imbalance; the report now states whether coverage
is equal and adds an INTERPRETATION block. Add switch cases
paper_mergeNaive_d0_10 / _d0_13 and include them in run_all.

Finding: unlike mergeA2 (fair-window interaction n.s.), the pooled-naive
control keeps the interaction significant in the fair d0_13 window
(F(1)=7.07, p=0.0088, +1.80 [+0.46,+3.14]; equal on Day 1 p=0.20),
reproducing the paper without the coverage confound; d0_10 is borderline
(p=0.051).

Tests: tLme asserts equal coverage / no warning / one full summary for
both windows and a significant positive d0_13 interaction; bad windowKey
errors. Suite 41/41.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 17:49:09 -04:00
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