Commit Graph

116 Commits

Author SHA1 Message Date
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
Experiments DB Dev d59ff2b659 docs(writeup): add design-rationale section for the sham/pooled control grouping
Document Box-A2 as an a-priori sham/sensory control and the two-tier
analysis it implies: B2-vs-A2 as the primary sensation-controlled contrast,
and the pooled-control mergeNaive grouping as a confirmatory power-boost
licensed by A2/Naive exchangeability (with the TOST caveat that the
exchangeability is supported but not proven at n=3-4).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 14:07:49 -04:00
Experiments DB Dev 77b631bcac feat(matlab): mergeNaive grouping (control=A2+Naive, tDCS=B2+Right) + GLM/power
Adds cfg.mergeNaive and scenario/paper/phase/power support. This pooled grouping
is the closest replication of the paper's full pattern: paper LME interaction
F(1)=7.30, p=0.008 (paper 7.12/0.008), stim main n.s. (p=0.21 = equal on Day 1),
strong day effect; the overall tDCS advantage is significant at the cluster-honest
per-animal level (rate p=0.003) and well powered. Adds a grouping test. Suite 38/38.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 12:50:35 -04:00
Experiments DB Dev 7b5c27df8c feat(matlab): verbatim paper LME (behavior ~ stim+day+stim:day+(1|rat)) + power sim on it
Adds tdcs_paper_lme replicating the paper's exact formula/variable names (paper_*
switch cases): mergeA2 reproduces the interaction F(1)=7.09 vs 7.12, p=0.009 vs
0.008, with a coverage-confound warning. Rewrites tdcs_power_sim to fit that same
formula (interaction term canonicalized to day:stim). Adds a replication test.
Suite 37/37.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 12:40:26 -04:00
Experiments DB Dev 800189371b feat(matlab): learning figure + methods write-up + organized CSV data export
Adds make_figure (2-panel learning curves + per-phase slopes, colorblind-safe
Box-B2/Box-A2 palette) -> results/figure_learning.png; analysis/writeup.md
(figure + methods + results summary); and tdcs_export_all/run_export exporting
every data variation into an organized export/ tree (curated_all, scenarios/9,
anchors/3 with tDCS factor, phases/9 + MANIFEST). Adds tExport tests. Suite 36/36.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 12:11:37 -04:00
Experiments DB Dev e730aa0020 feat(matlab): phased days x tDCS LME + Monte-Carlo power analysis
Adds tdcs_phase_lme (same LME refit within learning phases 0-5/6-10/6-13, with
per-phase slopes + interaction 95% CI) as phase_* switch cases, and
tdcs_power_sim (Monte-Carlo power for the early-phase interaction, scored by the
cluster-honest per-animal test and the LME test) + run_power. Findings: the
Box-B2 faster-acquisition signal is in the early phase; at n=3-5/group honest
power is 0.3-0.7 even at the observed effect (need ~8/group if effect is as
observed, ~20/group if half). Adds tPhasePower tests. Suite 35/35.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 11:06:51 -04:00
Experiments DB Dev 89bb95088f feat(matlab): add 0-13 day window (lme_*_d0_13) + coverage warning
Box-A2 has no data past ~day 13, so the full-range days x tDCS interaction
extrapolates A2's slope and is confounded (spuriously significant, wrong sign).
Add the _d0_13 window (equal anchor coverage) and a report warning when the two
groups' day coverage is unequal. In the fair 0-13 window the interaction is n.s.
with a POSITIVE slope diff and the Day-1 tDCS effect is n.s. -- matching the
paper's 'equal on Day 1' direction (underpowered at n=8). Suite 32/32.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 09:58:19 -04:00
Experiments DB Dev f0ce978bd4 docs(matlab): label tDCS main effect as Day 1 (= our day 0), matching the paper
The model already evaluates the tDCS main effect at day 0, which is the paper's
'Day 1'; relabel the report/docstring to state the equivalence explicitly so the
'equal on Day 1' comparison is unambiguous. No model change (re-indexing day
would move the main-effect evaluation point off Day 1). Suite 31/31.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 09:46:52 -04:00
Experiments DB Dev 08c14c476c feat(matlab): add linear days x tDCS mixed-model scenarios (lme_*)
Adds 6 switch cases replicating the paper's linear mixed model
success ~ day * tDCS + (1|subject) on the Box-B2(tDCS=1) vs Box-A2(tDCS=0)
arm, reporting the days x tDCS interaction, days, and tDCS effects as t/F/p.
mergeA2_full reproduces the paper's interaction (F=7.09 vs 7.12, p=0.009 vs
0.008); interpretation is sign-aware and honestly notes our data diverges from
the paper (Box-B2 ahead on day 1, gap narrows -- not 'equal on day 1,
accumulates'). Adds tLme tests. Suite 31/31.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 09:43:08 -04:00
Experiments DB Dev b1057f6105 fix(matlab): report learning rate via per-animal slope test, not anticonservative GLMM F-test
fitglme coefTest only offers observation-level DF (df2~=178), which overstates
the group x day interaction significance for this few-subject design (p~=0 in
every scenario). Replace the reported learning-rate result with a cluster-honest
per-animal slope test (per-subject OLS slope of success vs day, Welch + MWU,
B2 vs A2) -- now correctly parallel in all 6 scenarios, matching the Python GEE.
The GLMM F-test is kept as a flagged reference only. Adds a regression test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 08:40:47 -04:00
Experiments DB Dev 13414d31fc matlab(tdcs): assert reference group present; README scope note
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 08:08:27 -04:00
Experiments DB Dev 01f59a5265 matlab(tdcs): report, switch/case entry, runners, README 2026-07-20 08:00:40 -04:00
Experiments DB Dev 27d388530a matlab(tdcs): GLMM + per-animal + classification models 2026-07-20 07:51:30 -04:00
Experiments DB Dev 75ea8a031e test(matlab): fix uint64 vs double class mismatch in group-count assertion
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 07:43:05 -04:00
Experiments DB Dev e398237c76 matlab(tdcs): scenario derivation + derived data export 2026-07-20 07:39:12 -04:00
Experiments DB Dev 33121e3a8f matlab(tdcs): data loading + curated group map 2026-07-20 07:29:31 -04:00
Experiments DB Dev 808040a522 docs(plan): MATLAB tDCS analysis port implementation plan
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 07:23:57 -04:00
Experiments DB Dev 2e6464cd14 docs(spec): MATLAB port of the tDCS GLM analysis
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 07:14:59 -04:00
Experiments DB Dev 5314071c6b analysis(tdcs): GLM hypothesis tests + methods for the reaching study
Poisson GEE / binomial rate / learning-rate models, subject random-intercept
sensitivity, unknown-group classification and merge scenarios, plus METHODS.md
and learning-curve plots. Data reconstructed from the experiment DB and
verified against the exported matrix.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 22:07:17 -04:00
Experiments DB Dev 86feec2e77 fix(export): label synthetic ordinal '# Days Reach (ordinal)' to avoid collision with same-named daily field
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 19:35:22 -04:00
Experiments DB Dev 4f3fe64cad test(export): stale-group + same-date ordinal coverage; comment/guard polish 2026-07-19 15:18:56 -04:00
Experiments DB Dev 33ee191966 refactor(export): remove dead assignable-axes helpers and their tests
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 15:12:15 -04:00
Experiments DB Dev 6f23f83bc8 feat(export): modal becomes X / Data / Group by pickers, subjects as columns 2026-07-19 15:05:38 -04:00
Experiments DB Dev 39a5a4ec0c feat(export): buildSubjectSeriesMatrix — subjects as columns over an X field 2026-07-19 14:59:42 -04:00
Experiments DB Dev 8510903771 feat(export): X-coordinate helpers (date, # days reach, daily field) 2026-07-19 14:54:25 -04:00
Experiments DB Dev 3e52117c1a docs(plan): subject-series export implementation plan
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 14:36:10 -04:00
Experiments DB Dev 8153777951 docs(spec): subject-series export — choose X field + data value, subjects as columns
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 14:29:20 -04:00
Experiments DB Dev 9b3d52d89b fix(export): default group-by to None when unset/stale; polish
Final code review of the configurable-data-export feature: ExperimentDetail
was forwarding its on-page groupField state (defaults to '__name__') into
ExportDataModal, leaking a clustering default into the default (untouched)
export. Now passes the raw saved localStorage value, defaulting to
'__none__'. The modal also now validates the incoming groupField against
'__none__'/'__name__'/'__id__'/active subjectTemplate fields and coerces to
'__none__' otherwise, guarding against stale/deleted subject_info fields.
Plus a stale module comment fix and optional-chaining consistency fix in
listSubjectMembers.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 13:59:48 -04:00
Experiments DB Dev e65de8892a feat(export): pass subjectTemplate + saved group field to export modal 2026-07-19 13:41:15 -04:00
Experiments DB Dev 8ab270a9c9 feat(export): modal gains assignable axes + group-by control 2026-07-19 13:33:12 -04:00
Experiments DB Dev 958666580f feat(export): toCSV emits context line + subject group cell 2026-07-19 13:28:32 -04:00
Experiments DB Dev 600323f40a feat(export): generalized buildMatrix over assignable dimensions 2026-07-19 13:22:53 -04:00
Experiments DB Dev 7d112de0d7 feat(export): subject/parameter members + dimension dispatcher 2026-07-19 13:19:15 -04:00
Experiments DB Dev a411d59305 feat(export): dimension primitives, date members, status index 2026-07-19 13:16:33 -04:00
Experiments DB Dev cd4e213d6f docs(plan): configurable data export implementation plan
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 13:14:41 -04:00
Experiments DB Dev 900759074d docs(spec): configurable data export — assignable axes + subject group cell
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 13:09:07 -04:00
Experiments DB Dev 57446d5b64 Merge branch 'feat/experiment-data-export'
Client-side CSV export on the experiment page: pick a daily parameter
(session metrics or any daily-record field) and download a date×subject matrix.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-06 16:21:07 -04:00
Experiments DB Dev ea1a7f39f2 feat(frontend): Export data button + modal on experiment page 2026-07-06 15:48:02 -04:00
Experiments DB Dev 0bf3fc479b refactor(frontend): polish ExportDataModal (derived selection, safe URL revoke, error escape) 2026-07-06 15:46:52 -04:00
Experiments DB Dev ea76cf9cd2 feat(frontend): ExportDataModal — pick a parameter and download CSV 2026-07-06 15:42:30 -04:00
Experiments DB Dev dfe3938afc feat(frontend): toCSV + csvFilename for data export 2026-07-06 15:40:24 -04:00
Experiments DB Dev b5578f6e24 feat(frontend): buildMatrix pivots statuses into date×subject grid 2026-07-06 15:37:33 -04:00
Experiments DB Dev 3f8febfda3 feat(frontend): listExportableParams enumerates export options 2026-07-06 15:35:19 -04:00
Experiments DB Dev 523cf1614e feat(frontend): extractValue helper for data export 2026-07-06 15:33:30 -04:00
Experiments DB Dev 9b55b578f2 docs: implementation plan for experiment data export (CSV)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-06 15:30:41 -04:00
Experiments DB Dev 2d3b7c4607 docs: design for experiment data export (CSV)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-06 15:25:25 -04:00