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>
This commit is contained in:
Experiments DB Dev
2026-07-23 13:57:25 -04:00
parent e1af1af7f4
commit bb5e2d88c0
58 changed files with 4234 additions and 0 deletions
@@ -0,0 +1,29 @@
==============================================================================
POWER SIMULATION -- unmerge_d0_5
==============================================================================
model: behavior ~ stim + day + stim:day + (1|rat) (success COUNT; day within-window)
observed groups: stim n=3, control n=3 nrep=120, alpha=0.05
ground truth: stim:day=+5.36/day, rat SD=4.85, residual SD=10.70, days=6
true stim:day interaction = +5.36 (100% of observed)
N/group | per-animal power | LME power
------------------------------------------
3 | 0.35 | 0.73 <- observed
5 | 0.78 | 0.90
8 | 0.97 | 0.97
12 | 1.00 | 1.00
16 | 1.00 | 1.00
24 | 1.00 | 1.00
true stim:day interaction = +2.68 (50% of observed)
N/group | per-animal power | LME power
------------------------------------------
3 | 0.11 | 0.24 <- observed
5 | 0.25 | 0.37
8 | 0.44 | 0.46
12 | 0.68 | 0.72
16 | 0.79 | 0.81
24 | 0.95 | 0.94
Read the per-animal column as the honest power. At the observed N this study
is typically underpowered; per-animal power reaches ~0.8 only at larger N.