HarvestForTwo / docs /methods /make_night_options.py
princessamygdala's picture
Claude Opus 5
Night-condition design simulations and the options document
92ae8e8
Raw History Blame Contribute Delete
17.7 kB
"""Generate the night-conditions options document.
What each candidate night block asks, what each parameter would buy, and how
well each one recovers. Kept as a generator so the numbers in the document
stay traceable to the scripts that produced them. The .docx is gitignored:
it is output, and HuggingFace rejects binary documents in the deployed Space.
python docs/methods/make_night_options.py
Sources for every number below:
analysis/trials_needed.json night 1, night 2 and day task, 24 to 150
analysis/night2_sweep.json payoff structures A, B, C
analysis/why_harm_models.json the eight-model family on structure C
analysis/night_three_option.py the three-option block (re-run 30 Sep)
analysis/recovery.ipynb model recovery for the shipped blocks
"""
import os
from docx import Document
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.shared import Inches, Pt, RGBColor
HERE = os.path.dirname(os.path.abspath(__file__))
REPO = os.path.dirname(os.path.dirname(HERE))
BLACK = RGBColor(0, 0, 0)
GREY = RGBColor(0x55, 0x55, 0x55)
doc = Document()
for name in ("Normal", "List Bullet", "List Bullet 2"):
try:
st = doc.styles[name]
except KeyError:
continue
st.font.name, st.font.size, st.font.color.rgb = "Arial", Pt(11), BLACK
for s in doc.sections:
s.top_margin = s.bottom_margin = Inches(0.9)
s.left_margin = s.right_margin = Inches(0.9)
def _run(p, text, *, bold=False, italic=False, size=11, color=BLACK, mono=False):
r = p.add_run(text)
r.font.name = "Consolas" if mono else "Arial"
r.font.size, r.font.bold, r.font.italic = Pt(size), bold, italic
r.font.color.rgb = color
return r
def title(text):
p = doc.add_paragraph(); p.space_after = Pt(4)
_run(p, text, bold=True, size=15)
def subtitle(text):
p = doc.add_paragraph(); p.space_after = Pt(12)
_run(p, text, size=10, color=GREY)
def h(text):
p = doc.add_paragraph(); p.space_before, p.space_after = Pt(13), Pt(4)
_run(p, text, bold=True, size=12)
def h2(text):
p = doc.add_paragraph(); p.space_before, p.space_after = Pt(9), Pt(3)
_run(p, text, bold=True, italic=True)
def para(text):
p = doc.add_paragraph(); p.space_after = Pt(6)
_run(p, text)
def bullet(parts, level=0):
p = doc.add_paragraph(style="List Bullet" if level == 0 else "List Bullet 2")
p.space_after = Pt(2)
for text, style in ([(parts, "")] if isinstance(parts, str) else parts):
_run(p, text, bold="b" in style, italic="i" in style, mono="m" in style)
def eq(text):
p = doc.add_paragraph(); p.space_before, p.space_after = Pt(4), Pt(4)
p.paragraph_format.left_indent = Inches(0.35)
_run(p, text, mono=True, size=10.5)
def note(text):
p = doc.add_paragraph(); p.space_after = Pt(6)
_run(p, text, size=9.5, color=GREY, italic=True)
def table(headers, rows):
t = doc.add_table(rows=1, cols=len(headers))
t.style = "Table Grid"
for i, cell in enumerate(t.rows[0].cells):
cell.text = ""
_run(cell.paragraphs[0], headers[i], bold=True, size=10)
for row in rows:
cells = t.add_row().cells
for i, val in enumerate(row):
cells[i].text = ""
mono = isinstance(val, str) and val.startswith("`")
_run(cells[i].paragraphs[0], val.strip("`"), size=10, mono=mono)
doc.add_paragraph().space_after = Pt(6)
return t
# ============================================================ title
title("Night conditions: the options and what each one would give us")
subtitle("Every candidate night block, the question it answers, the parameters "
"it yields, and how well each recovers. 30 September 2026. All "
"recovery figures are correlations between true and fitted values "
"over 100 simulated participants.")
# ============================================================ 1
h("1. Where this stands today")
bullet([("Two night blocks are built and shipping: ", ""),
("Night 1 (raid or stay asleep)", "b"), (" and ", ""),
("Night 2 (whose pocket)", "b"),
(", 24 trials each. Neither has ever been run with participants.", "")])
bullet("Which nights a participant sees is fixed by their arm, drawn from five: "
"no night, Night 1 only, Night 2 only, both in the order 1 then 2, and "
"both in the order 2 then 1.")
bullet("The SONA pilot arm runs the day task only. No night decision blocks the "
"SONA pilot.")
bullet("Three further designs were simulated and never built: a three-option "
"night block, an alternative Night 2 payoff structure, and an "
"eight-model family for why someone harms.")
note("This document supersedes the night sections of "
"NightConditions_SimulationReport_08-26-2026.docx, which predates the "
"payoff and effort-level changes of September.")
# ============================================================ 2
h("2. What each block asks, and what its parameters would give us")
h2("Night 1: raid or stay asleep (built, 24 trials)")
para("Sleeping pays 2 credits and costs the partner nothing. Raiding pays you g "
"and takes l off the partner. Gain and loss are crossed orthogonally over "
"six pairs, so what a credit gained is worth is estimated separately from "
"what taking one costs.")
eq("V_raid = g - h*l - k*E^2 V_sleep = 2")
table(
["parameter", "what it is", "what it would give us"],
[["`h`", "harm aversion, in credits: how far a credit taken off the partner "
"cancels a credit gained",
"a per-person number on the reward scale, so it can be compared between "
"the CU and control groups and correlated with TriPM meanness"],
["`k`", "effort discounting when the reward comes from taking",
"whether the cost of work changes when the work is antisocial, read "
"against k_self from the day task"],
["`beta`", "choice consistency",
"a nuisance parameter, and a check that anyone was attending"]])
para("h = 0 is pure self-interest and sits in the family as the null. The block "
"has no prosocial option, so it says nothing about willingness to help.")
h2("Night 2: whose pocket (built, 24 trials)")
para("The harvest happens either way and the work is identical on both options. "
"Pocketing pays you a, leaving it pays the partner b. Because the effort "
"is matched, the two effort terms cancel and only their difference "
"survives.")
eq("V_self - V_partner = a - w*b + dk*E^2 dk = k_other - k_self")
table(
["parameter", "what it is", "what it would give us"],
[["`w`", "social weight: what a credit in the partner's pocket is worth "
"relative to one in your own",
"the standard social-discounting weight, per person, from a single "
"24-trial block"],
["`dk`", "how much more the same physical work weighs when it buys the "
"partner something",
"in principle, the day task's self/other effort difference asked inside "
"one choice. It does not recover, see section 4"],
["`beta`", "choice consistency", "as above"]])
note("Night 2 can never estimate k_self and k_other separately. The effort "
"terms cancel by construction.")
h2("Three-option night: do nothing, raid, or help (simulated, not built)")
para("One block with a real baseline. Doing nothing pays a flat rest credit, "
"raiding pays you g and costs the partner l, helping pays the partner b "
"and pays you nothing. Effort is not matched across the options. The cost "
"of work sits on the raid option and again on the help option, so the two "
"discount rates are separately identified and their difference falls out "
"of two well-measured numbers.")
eq("V_nothing = c\n"
"V_raid = g - h*l - k_self *E^2\n"
"V_help = w*b - k_other*E^2\n"
"P(i) = softmax over the three")
table(
["parameter", "what it is", "what it would give us"],
[["`h`", "harm aversion", "as in Night 1"],
["`w`", "social weight", "as in Night 2"],
["`k_self`", "effort discounting for your own gain", ""],
["`k_other`", "effort discounting when the partner is paid", ""],
["`k_other - k_self`", "the self/other effort difference",
"a difference of two separately fitted numbers, which is why it recovers "
"here. In Night 2 it is the only estimable quantity, and it does not"],
["`beta`", "choice consistency", ""]])
para("Harm aversion and social weight come out of the same block on the same "
"credit scale, so avoiding harm and willingness to help become two numbers "
"per participant. A forced choice between taking and giving has no way to "
"express indifference; this one does.")
# ============================================================ 3
h("3. Recovery, side by side")
para("Correlation between true and fitted values, 100 simulated participants. "
"The day task is included as the reference.")
table(
["block", "trials", "w", "h", "k_self", "k_other", "gap / dk", "beta"],
[["day task (SELF/OTHER)", "48", "", "", "0.93", "0.90", "0.60", "0.66"],
["day task (SELF/OTHER)", "96", "", "", "0.95", "0.96", "0.70", "0.81"],
["Night 1, raid", "24", "", "0.80", "0.75", "", "", "0.44"],
["Night 1, raid", "48", "", "0.87", "0.75", "", "", "0.56"],
["Night 1, raid", "96", "", "0.92", "0.88", "", "", "0.81"],
["Night 2, whose pocket", "24", "0.82", "", "", "", "0.50", "0.54"],
["Night 2, whose pocket", "48", "0.89", "", "", "", "0.54", "0.54"],
["Night 2, whose pocket", "150", "0.94", "", "", "", "0.68", "0.78"],
["three-option, rest pays 0", "24", "0.77", "0.80", "0.81", "0.58",
"0.70", "0.61"],
["three-option, rest pays 0", "48", "0.85", "0.91", "0.90", "0.69",
"0.81", "0.72"],
["three-option, rest pays 0", "96", "0.89", "0.92", "0.93", "0.69",
"0.79", "0.85"],
["three-option, rest pays 2", "24", "0.80", "0.79", "0.62", "0.38",
"0.50", "0.63"],
["three-option, rest pays 2", "48", "0.86", "0.85", "0.82", "0.49",
"0.72", "0.70"],
["three-option, rest pays 2", "96", "0.90", "0.90", "0.82", "0.44",
"0.59", "0.85"]])
para("Trial counts at which each parameter first reaches r = 0.7, with 100 "
"participants:")
table(
["block", "parameter", "trials needed"],
[["day task", "`k_self`, `k_other`", "24"],
["day task", "`beta`", "56"],
["day task", "gap", "96"],
["Night 1", "`h`, `k`", "24"],
["Night 1", "`beta`", "60"],
["Night 2", "`w`", "24"],
["Night 2", "`beta`", "131"],
["Night 2", "`dk`", "never, up to 150"],
["three-option", "`w`, `h`, `k_self`, gap", "24"],
["three-option", "`beta`", "48"],
["three-option", "`k_other`",
"never: 0.69 at 48, 0.71 at 72, 0.69 at 96"]])
para("Rest pays 2 in the three-option simulation drives about 75 percent of "
"choices to doing nothing at every trial count, and help choices fall to "
"one in ten. k_other then runs 0.38, 0.49, 0.58, 0.44 across 24, 48, 72 "
"and 96 trials, and the self/other difference runs 0.50, 0.72, 0.70, "
"0.59. Neither climbs with trials, which is what too few help "
"choices looks like. With a rest credit of 0 the shares are 53 / 26 / 21 "
"and the difference climbs to 0.70, 0.81, 0.84, 0.79. If this block is "
"ever built, the rest option pays nothing.")
para("k_other is the weak parameter of the three-option design. It sits at "
"0.69 at 48 trials, 0.71 at 72 and 0.69 at 96, so adding trials does not "
"move it. Only a fifth of choices are help choices, which is what limits "
"it. Their difference still recovers at 0.79 to 0.84, because k_self is "
"measured well and the difference is not the only estimable quantity.")
# ============================================================ 4
h("4. Why dk does not recover, and everything tried on it")
para("In Night 2 as shipped, effort enters the choice only through dk*E^2. "
"Across the effort range 0.35 to 0.80 that term is worth about 1.5 "
"credits, against a reward term spanning 6. The signal is a sixth the "
"size of the noise it competes with. In the day task the same quantity is "
"a difference between two rates that correlate about 0.92 across people, "
"so most of the variance in the difference is measurement error.")
h2("Payoff structures tested for Night 2")
para("Effort is matched across options in all three, so all three are Night 2. "
"What differs is the partner's side of the ledger.")
table(
["structure", "keep", "leave", "24 trials", "48 trials"],
[["A allocation (shipped)", "+a to you", "+b to them",
"w 0.81, dk 0.34", "w 0.87, dk 0.54"],
["B symmetric transfer", "+a to you, -a from them",
"-b from you, +b to them", "w 0.15, h 0.27, dk 0.18",
"w 0.28, h 0.32, dk 0.21"],
["C asymmetric, coupled", "+a to you, -l from them", "+b to them",
"w 0.82, h 0.74, dk 0.58", "w 0.85, h 0.86, dk 0.62"],
["C asymmetric, decoupled", "+a to you, -l from them", "+b to them",
"w 0.83, h 0.79, dk 0.58", "w 0.85, h 0.88, dk 0.65"]])
para("Structure B collapses. Making the transfer symmetric means the partner's "
"gain and the partner's loss move together on every trial, and nothing is "
"identifiable. It should not be built.")
para("Structure C is the result worth acting on. It yields w and h from one "
"24-trial block at values close to what Night 1 and Night 2 currently "
"produce across 48 trials between them, and it raises dk from 0.34 to "
"0.58. Decoupling the three payoffs buys a little over coupling them and "
"costs nothing.")
h2("Other attempts")
bullet("Nine Night 2 reward and effort designs: narrowing the reward spread, "
"widening the effort range, and moving from four effort levels to six. "
"Narrowing the rewards helps dk and hurts w by about as much.")
bullet("Concave utility of credits, u(x) = x^alpha, which compresses the reward "
"term and leaves the effort term alone. It moves dk, and it adds a "
"parameter that the design cannot separately identify.")
bullet("The three-option block, which sidesteps the problem. k_self and "
"k_other are separately identified there, so their difference is a "
"difference of two measured numbers.")
# ============================================================ 5
h("5. Which accounts could be told apart")
para("Model recovery: simulate from each model in turn, fit all of them back, "
"and count how often integrated BIC picks the generating model.")
table(
["family", "trials", "correct"],
[["day task, 8 models", "48", "6 of 8"],
["Night 1, 4 models", "24", "4 of 4"],
["Night 1, 4 models", "48", "4 of 4"],
["Night 2, 4 models", "24", "3 of 4"],
["Night 2, 4 models", "48", "4 of 4"],
["why-harm family on structure C, 8 models", "24", "4 of 8"],
["why-harm family on structure C, 8 models", "48", "4 of 8"],
["why-harm family on structure C, 8 models", "96", "5 of 8"]])
para("The eight why-harm models are hypotheses about why someone takes or fails "
"to give: nobody's outcome but your own, you value helping, you avoid "
"taking, one care parameter for both, helping and harming weighted "
"differently, no social value but effort differs by target, social value "
"and an effort difference, and the same with harm allowed to be "
"rewarding.")
para("The failures are specific. A pure effort-difference account is read as "
"the null, because dk carries so little signal. The three accounts that "
"differ only in how h is constrained trade places with each other. So "
"structure C can answer whether the partner's outcome enters at all and "
"whether gains and losses weigh the same; it cannot tell a person who is "
"indifferent to harm from one who enjoys it.")
# ============================================================ 6
h("6. Decided, open, and what I would do")
h2("Decided")
bullet("Night 1 and Night 2 as currently built, 24 trials each, five arms, "
"night rest credit 2. This is what ships and what the preregistration "
"describes.")
bullet("The SONA pilot runs the day task only.")
bullet("Neither night block has been piloted, so none of these numbers has been "
"checked against a real choice distribution.")
h2("Open")
bullet("Whether to build the three-option block at all.")
bullet("Whether to replace Night 2's payoff structure with C.")
bullet("Whether dk stays a target of the night blocks.")
h2("What I would do")
bullet("Stop treating dk as something the night blocks deliver. Night 2's job "
"is w, and it does that from 24 trials at 0.82.")
bullet("If Night 2 is revised without adding a block, use structure C "
"decoupled. It returns w and h from one 24-trial block, which frees "
"Night 1's 24 trials for something else.")
bullet("If a block is added, the three-option version is the one to build, with "
"the rest option paying nothing. It is the only design simulated here "
"that returns harm aversion, social weight and the self/other effort "
"difference together. At 48 trials it beats Night 1 on every shared "
"parameter, and its w of 0.85 is within noise of Night 2's 0.89.")
bullet("Pilot whichever night ships before trusting any of it. Every number "
"here depends on assumed parameter ranges, and the night conditions "
"have no data to anchor them to.")
out = os.path.join(REPO, "NightConditions_Options_09-30-2026.docx")
doc.save(out)
print("wrote", out)