Spaces:
Running
Running
Commit History
-
Correct the simulated beta, which was suppressing the self/other gap
Beta was drawn from 0.3 to 1.0, picked without checking it against anything. Jo Cutler's simulation code bounds beta at 0 to 5 and tests recovery at 1, 3 and 5. The value scales differ, so the comparison has to be on beta times the value difference, which is what the softmax sees: hers comes to about 4.3, mine to 2.0. Simulated participants were roughly half as decisive as hers. That suppressed the one result the analysis kept reporting as a hard limit. With beta at 0.7 to 2.2 the day-task self/other gap recovers at +0.60 on the shipped 48 trials rather than +0.30, and reaches 0.7 at 96 trials where it previously did not reach it by 150 at all. Overall P(work) is unchanged, so this was never saturation. Night 1's h and k both drop from 35 and 31 trials to 24, so the shipped night block is already sufficient for them. Ranges now live as shared constants that night_models imports from a single place, since the two notebooks had drifted onto different assumptions and would have contradi…6cf57d6 -
Anchor the simulated k range to the pilot instead of guessing it
The recovery numbers are a statement about the assumed parameter range as much as about the design, and the range was guessed: k in 1..5, which implies people work on about 80% of trials. The nine complete pilot sessions actually chose work on 66% of SELF and 58% of OTHER trials, so real k is higher than that. The difference is not cosmetic. Under the guessed range, k*E^2 cannot come near the 8-credit gap between the top reward and rest, so two thirds of the design sits at ceiling, k_self recovers at +0.25 over 24 trials and the self/other gap at +0.09 -- which would read as "the design cannot measure the thing it exists to measure". Under k_self 6 / k_other 9 / beta 0.6, which reproduces the pilot choice rates (0.68 / 0.59 against 0.66 / 0.58), the R=6 trials become informative and only R=10 stays near ceiling. K_MAX moves 10 -> 20 to leave the squash room above k_other, with gradients checked at the new values. The notebook now prints information per design cell so where the R=10 t…be24b6b -
Fix two pyEM integration bugs that would have silenced model recovery
calc_BICint calls the objfunc with output="all" and subscripts the result for its "nll" key, so returning a bare float raised "'float' object is not subscriptable" from inside a joblib worker -- a long way from the cause. The objfunc now has both output modes. pyEM's FitResult exposes posterior_mu / posterior_sigma, not mu / sigma. The wrong names were caught inside a try/except that turned every BIC into nan, so all 64 fits per trial count would have run to completion and produced an empty confusion matrix rather than an error.da6cba2 -
Add the effort-discounting recovery analysis (pyEM)
Parameter and model recovery for the design, using Rhoads' pyEM. Both questions are asked of simulated data where the truth is known, so the answers are about the design rather than about any participant. Headline is 24 trials, with 48/72/96 to show what more trials would buy. The eight-model family crosses one-vs-two k, one-vs-two beta, and a parabolic vs linear exponent. The 1k models are in it as the null: the self/other gap in k is what the task exists to measure, so if a 1k model wins, the design did not detect prosocial discounting at all. Two guards sit before any fitting, because both failure modes produce garbage that reads as a modelling result rather than a bug: * check_gradients() -- pyEM fits on an unbounded scale and squashes into range with norm2beta(x, max_val). A max_val far above the plausible values saturates the sigmoid, the optimiser sees no slope, and recovery collapses. That has already happened once on this project. * choice_balance() -- infor…56b39b6