Frontal brain injury alters human risky choices in self and other contexts.
2 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.
The 2 matches
- [1] § STAR★Methods › Quantification and statistical analysis › Computational modeling ↔ Analysis_Code/OSF_model_comparison.py, lines 186 to 228 · score 0.60 · log likelihood, optimization, bounds, BFGS, error, AIC · block
oscr:b:5V5BS99MTXQMJ-8· Report a mismatch - [2] § Results › Model selection and validation ↔ Analysis_Code/OSF_bootstrap_and_sensitivity.py, lines 225 to 252 · score 0.51 · CI widths, bootstrap CIs, Median · block
oscr:b:P6P83YZZCSCS0-G· Report a mismatch
Paper
Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Python · 334 lines · 10 KB · no license · 1 match
- #!/usr/bin/env python3
- """
- Nested Prospect Theory model comparison (AIC/BIC) using a single CSV trial file.
- Assumes the input data (All_Trials_Data_Final.csv) is already perfectly filtered
- to contain only the final 40 subjects (20 patients, 20 controls).
- Input CSV format (no header), 7 columns:
- 0: subject_id
- 1: is_patient (0=Control, 1=Patient)
- 2: is_other (0=Self, 1=Other)
- 3: gain
- 4: loss (negative)
- 5: p_gain
- 6: choice (1=accept, 0=reject)
- Models:
- - M1 (5 params): alpha, beta, lambda_param, gamma, theta
- - M2 (4 params): alpha, lambda_param, gamma, theta; beta = alpha
- - M3 (3 params): alpha, gamma, theta; beta = alpha, lambda_param = 1
- - M4 (2 params): alpha, theta; beta = alpha, lambda_param = 1, gamma = 1
- """
- import argparse
- from pathlib import Path
- import numpy as np
- import pandas as pd
- from scipy.optimize import minimize
- from scipy.special import expit
- from tqdm import tqdm
- EPS = 1e-10
- MODEL_ORDER = ["M1", "M2", "M3", "M4"]
- FULL_BOUNDS = {
- "alpha": (0.01, 2.0),
- "beta": (0.01, 2.0),
- "lambda_param": (0.01, 5.0),
- "gamma": (0.01, 2.0),
- "theta": (0.01, 20.0),
- }
- def _expand_m1(x):
- return np.array([x[0], x[1], x[2], x[3], x[4]], dtype=float)
- def _expand_m2(x):
- alpha, lambda_param, gamma, theta = x
- return np.array([alpha, alpha, lambda_param, gamma, theta], dtype=float)
- def _expand_m3(x):
- alpha, gamma, theta = x
- return np.array([alpha, alpha, 1.0, gamma, theta], dtype=float)
- def _expand_m4(x):
- alpha, theta = x
- return np.array([alpha, alpha, 1.0, 1.0, theta], dtype=float)
- MODEL_SPECS = {
- "M1": {"free_params": ["alpha", "beta", "lambda_param", "gamma", "theta"], "expand": _expand_m1},
- "M2": {"free_params": ["alpha", "lambda_param", "gamma", "theta"], "expand": _expand_m2},
- "M3": {"free_params": ["alpha", "gamma", "theta"], "expand": _expand_m3},
- "M4": {"free_params": ["alpha", "theta"], "expand": _expand_m4},
- }
- def parse_args():
- parser = argparse.ArgumentParser(description="Nested PT model comparison (AIC/BIC).")
- parser.add_argument(
- "--input-csv",
- type=str,
- default="All_Trials_Data_Final.csv",
- help="Path to all-trials CSV (default: All_Trials_Data_Final.csv).",
- )
- parser.add_argument(
- "--output-csv",
- type=str,
- default="model_comparison_results.csv",
- help="Output CSV filename.",
- )
- parser.add_argument(
- "--n-starts",
- type=int,
- default=15,
- help="Number of random starts per model fit (minimum enforced: 15).",
- )
- parser.add_argument(
- "--seed",
- type=int,
- default=42,
- help="Random seed for reproducibility.",
- )
- return parser.parse_args()
- def _format_subject_id(value):
- try:
- x = float(value)
- if np.isfinite(x) and np.isclose(x, np.round(x)):
- return str(int(np.round(x)))
- return f"{x:.6f}".rstrip("0").rstrip(".")
- except Exception:
- return str(value).strip()
- def load_datasets_from_csv(csv_path):
- df = pd.read_csv(csv_path, header=None)
- if df.shape[1] != 7:
- raise ValueError(f"{csv_path} must have exactly 7 columns; found {df.shape[1]}.")
- df.columns = [
- "subject_id",
- "is_patient",
- "is_other",
- "gain",
- "loss",
- "p_gain",
- "choice",
- ]
- for col in df.columns:
- df[col] = pd.to_numeric(df[col], errors="coerce")
- before = len(df)
- df = df.dropna().copy()
- dropped = before - len(df)
- df["group"] = df["is_patient"].map({0: "Control", 1: "Patient"})
- df["condition"] = df["is_other"].map({0: "Self", 1: "Other"})
- df["subject_id"] = df["subject_id"].apply(_format_subject_id)
- datasets = []
- grouped = df.groupby(["subject_id", "group", "condition"], sort=True)
- for (subject_id, group, condition), g in grouped:
- design_matrix = g[["gain", "loss", "p_gain"]].to_numpy(dtype=float)
- choices = g["choice"].to_numpy(dtype=int)
- if len(choices) == 0:
- continue
- datasets.append(
- {
- "subject_id": subject_id,
- "group": group,
- "condition": condition,
- "design_matrix": design_matrix,
- "choices": choices,
- }
- )
- datasets.sort(key=lambda d: (d["group"], d["condition"], d["subject_id"]))
- return datasets, len(df), dropped
- def prelec_weight(p, gamma):
- p = np.clip(p, EPS, 1.0 - EPS)
- return np.exp(-((-np.log(p)) ** gamma))
- def compute_p_accept(full_params, design_matrix):
- alpha, beta, lambda_param, gamma, theta = full_params
- gain = np.clip(design_matrix[:, 0], EPS, None)
- loss = design_matrix[:, 1]
- p_gain = design_matrix[:, 2]
- p_loss = 1.0 - p_gain
- u_gain = gain ** alpha
- u_loss = -lambda_param * (np.abs(loss) ** beta)
- v = prelec_weight(p_gain, gamma) * u_gain + prelec_weight(p_loss, gamma) * u_loss
- p_accept = expit(theta * v)
- return np.clip(p_accept, EPS, 1.0 - EPS)
- def neg_log_likelihood(free_params, model_name, design_matrix, choices):
- full_params = MODEL_SPECS[model_name]["expand"](free_params)
- p_accept = compute_p_accept(full_params, design_matrix)
- ll = np.sum(choices * np.log(p_accept) + (1.0 - choices) * np.log(1.0 - p_accept))
- return -float(ll)
- def fit_model_for_subject(choices, design_matrix, model_name, n_starts, rng):
- free_names = MODEL_SPECS[model_name]["free_params"]
- bounds = [FULL_BOUNDS[name] for name in free_names]
- best_fun = np.inf
- best_x = None
- for _ in range(max(15, n_starts)):
- x0 = np.array([rng.uniform(lo, hi) for lo, hi in bounds], dtype=float)
- res = minimize(
- neg_log_likelihood,
- x0=x0,
- args=(model_name, design_matrix, choices),
- method="L-BFGS-B",
- bounds=bounds,
- )
- # Keep the numerically best fit even if optimizer flags a warning.
- if np.isfinite(res.fun) and res.fun < best_fun:
- best_fun = float(res.fun)
- best_x = np.array(res.x, dtype=float)
- if best_x is None:
- raise RuntimeError(f"Optimization failed for model {model_name}.")
- full_params = MODEL_SPECS[model_name]["expand"](best_x)
- k = len(free_names)
- n_trials = int(len(choices))
- ll = -best_fun
- aic = 2 * k - 2 * ll
- bic = k * np.log(max(n_trials, 1)) - 2 * ll
- return {
- "k": k,
- "LL": ll,
- "AIC": aic,
- "BIC": bic,
- "alpha": full_params[0],
- "beta": full_params[1],
- "lambda_param": full_params[2],
- "gamma": full_params[3],
- "theta": full_params[4],
- }
- def print_summary(results_df):
- print("\nMean AIC/BIC by model")
- print("-" * 46)
- print(f"{'Model':<8}{'Mean AIC':>18}{'Mean BIC':>18}")
- print("-" * 46)
- summary = (
- results_df.groupby("model")[["AIC", "BIC"]]
- .mean()
- .reindex(MODEL_ORDER)
- )
- for model in MODEL_ORDER:
- row = summary.loc[model]
- print(f"{model:<8}{row['AIC']:>18.3f}{row['BIC']:>18.3f}")
- print("-" * 46)
- grouping = ["subject_id", "group", "condition"]
- best_aic_rows = results_df.loc[results_df.groupby(grouping)["AIC"].idxmin()]
- best_bic_rows = results_df.loc[results_df.groupby(grouping)["BIC"].idxmin()]
- best_aic_counts = best_aic_rows["model"].value_counts().reindex(MODEL_ORDER, fill_value=0)
- best_bic_counts = best_bic_rows["model"].value_counts().reindex(MODEL_ORDER, fill_value=0)
- print("\nBest-model counts (lowest AIC)")
- for model in MODEL_ORDER:
- print(f"{model}: {int(best_aic_counts[model])}")
- print("\nBest-model counts (lowest BIC)")
- for model in MODEL_ORDER:
- print(f"{model}: {int(best_bic_counts[model])}")
- def main():
- args = parse_args()
- rng = np.random.default_rng(args.seed)
- datasets, n_trials, dropped_rows = load_datasets_from_csv(args.input_csv)
- if not datasets:
- raise RuntimeError("No valid subject-condition datasets were loaded from CSV.")
- print(f"\nLoaded {len(datasets)} subject-condition datasets from {n_trials} valid trials.")
- if dropped_rows > 0:
- print(f"Dropped {dropped_rows} rows with missing/non-numeric values.")
- results = []
- total_fits = len(datasets) * len(MODEL_ORDER)
- with tqdm(total=total_fits, desc="Fitting models") as pbar:
- for ds in datasets:
- design_matrix = ds["design_matrix"]
- choices = ds["choices"]
- for model_name in MODEL_ORDER:
- fit = fit_model_for_subject(
- choices=choices,
- design_matrix=design_matrix,
- model_name=model_name,
- n_starts=args.n_starts,
- rng=rng,
- )
- results.append({
- "subject_id": ds["subject_id"],
- "group": ds["group"],
- "condition": ds["condition"],
- "model": model_name,
- "k": fit["k"],
- "LL": fit["LL"],
- "AIC": fit["AIC"],
- "BIC": fit["BIC"],
- "alpha": fit["alpha"],
- "beta": fit["beta"],
- "lambda_param": fit["lambda_param"],
- "gamma": fit["gamma"],
- "theta": fit["theta"],
- })
- pbar.update(1)
- results_df = pd.DataFrame(results)[
- [
- "subject_id",
- "group",
- "condition",
- "model",
- "k",
- "LL",
- "AIC",
- "BIC",
- "alpha",
- "beta",
- "lambda_param",
- "gamma",
- "theta",
- ]
- ]
- results_df.to_csv(args.output_csv, index=False)
- print(f"\nSaved results to: {Path(args.output_csv).resolve()}")
- print_summary(results_df)
- if __name__ == "__main__":
- main()
OSF_model_comparison.py, no license · at the source
Overview
13 affiliations
- Institut des Sciences Cognitives Marc Jeannerod –UMR5229, CNRS & Université Claude Bernard Lyon1, 67 Boulevard Pinel, Bron 69675, France
- School of Cognitive Sciences, Institute for Research in Fundamental Sciences (IPM), Tehran, Iran
- National Brain Centre, Iran University of Medical Sciences, Tehran, Iran
- Faculty of Advanced Technologies in Medicine, Iran University of Medical Sciences, Tehran, Iran
- Shirley Ryan Ability Lab, Departments of Physical Medicine and Rehabilitation, Neurology, Cognitive Neurology, and Alzheimer’s Center, Chicago, IL, USA
- Department of Psychiatry, Feinberg School of Medicine and Psychology, Weinberg College of Arts and Sciences, Northwestern University, Chicago, IL, USA
- Department of Applied Educational Science, Umeå University, Umeå, Sweden
- Department of Psychological and Brain Sciences, Dartmouth College, Hanover, NH, USA
- Department of Neurosurgery, Skull Base Research Center, Rasool-Akram Hospital, Iran University of Medical Sciences, Tehran, Iran
- Stem Cell and Regenerative Medicine Research Center, Iran University of Medical Sciences, Tehran, Iran
- Cognitive Systems Laboratory, Control and Intelligent Processing Center of Excellence (CIPCE), School of Electrical and Computer Engineering, College of Engineering, University of Tehran, Tehran, Iran
- Mental Health Research Center, Psychosocial Health Research Institute, Department of Psychiatry, School of Medicine, Iran University of Medical Sciences, Tehran, Iran
- Department of Psychology, Carl Von Ossietzky University, Oldenburg, Germany
Abstract
The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.
Repository
Its files are read in the Code ↔ Paper reader above, with 2 matches between paragraphs and lines of code.
OSF cx73n
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
4 files
- Analysis_Code/
OSF_analyze_switching_po , Python, 155 linesints.py - Analysis_Code/
OSF_bootstrap_and_sensit , Python, 333 lines, 1 matchivity.py - Analysis_Code/
OSF_m2_parameter_recover , Python, 318 linesy.py - Analysis_Code/
OSF_model_comparison.py , Python, 334 lines, 1 match
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 4 scripts, each with its path and the digest of its content;
- 2 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Code and data availability statement
The paper has a code and data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:
- it says that the data are available on request
- it says that the code is available on request
Read it in the paper: doi.org/10.1016/j.isci.2026.116427.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 10 authors, 3 keywords, 1 funder, 31 references.
Cite
This paper
Rostami, F., Soltani, S., Grafman, J., Heyrani, R., Yazdanpanah, A., Jahanbakhshi, A., Vahabie, A.-H., Shariat, S. V., Abdolalizadeh, A., & Mirfazeli, F. S. (2026). Frontal brain injury alters human risky choices in self and other contexts. iScience, 29(7), 116427. https://
BibTeX
@article{rostami2026fron
author = {Rostami, Farzad and Soltani, Sarvenaz and Grafman, Jordan and Heyrani, Raheleh and Yazdanpanah, Aryan and Jahanbakhshi, Amin and Vahabie, Abdol-Hossein and Shariat, Seyed Vahid and Abdolalizadeh, AmirHussein and Mirfazeli, Fatemeh Sadat},
title = {{Frontal brain injury alters human risky choices in self and other contexts}},
journal = {iScience},
year = {2026},
month = jun,
volume = {29},
number = {7},
pages = {116427},
publisher = {Elsevier},
issn = {2589-0042},
doi = {10.1016/
url = {https://
pmid = {42375538},
pmcid = {PMC13312174}
}
RIS
TY - JOUR
AU - Rostami, Farzad
AU - Soltani, Sarvenaz
AU - Grafman, Jordan
AU - Heyrani, Raheleh
AU - Yazdanpanah, Aryan
AU - Jahanbakhshi, Amin
AU - Vahabie, Abdol-Hossein
AU - Shariat, Seyed Vahid
AU - Abdolalizadeh, AmirHussein
AU - Mirfazeli, Fatemeh Sadat
TI - Frontal brain injury alters human risky choices in self and other contexts
T2 - iScience
J2 - iScience
PY - 2026
DA - 2026/
VL - 29
IS - 7
SP - 116427
SN - 2589-0042
PB - Elsevier
DO - 10.1016/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1016/
"type": "article-journal",
"title": "Frontal brain injury alters human risky choices in self and other contexts",
"container-title": "iScience",
"author": [
{
"family": "Rostami",
"given": "Farzad"
},
{
"family": "Soltani",
"given": "Sarvenaz"
},
{
"family": "Grafman",
"given": "Jordan"
},
{
"family": "Heyrani",
"given": "Raheleh"
},
{
"family": "Yazdanpanah",
"given": "Aryan"
},
{
"family": "Jahanbakhshi",
"given": "Amin"
},
{
"family": "Vahabie",
"given": "Abdol-Hossein"
},
{
"family": "Shariat",
"given": "Seyed Vahid"
},
{
"family": "Abdolalizadeh",
"given": "AmirHussein"
},
{
"family": "Mirfazeli",
"given": "Fatemeh Sadat"
}
],
"container-title-short":
"volume": "29",
"issue": "7",
"page": "116427",
"DOI": "10.1016/
"PMID": "42375538",
"PMCID": "PMC13312174",
"ISSN": "2589-0042",
"publisher": "Elsevier",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
18
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.7554/elife.105391 [code]
- Contributions of insula and superior temporal sulcus to interpersonal guilt and responsibility in social decisions.Journal: eLifeIn common: pandas, SciPy, Matplotlib, 1 other tool, 6 references
- [2] doi:10.1371/journal.pbio.3003079 [code]
- Dorsomedial and ventromedial prefrontal cortex lesions differentially impact social influence and temporal discounting.Journal: PLoS biologyIn common: 5 references
- [3] doi:10.1101/2025.10.07.25337510 [code]
- Neurocomputational evidence of sustained Self-Other mergence after psychedelicsJournal: medRxiv (preprint)In common: Pingouin, pandas, SciPy, 2 other tools, 2 references
- [4] doi:10.1038/s41467-025-68240-z [code]
- Map-like representations of emotion knowledge in hippocampal-prefrontal systems.Journal: Nature communicationsIn common: Pingouin, pandas, SciPy, 2 other tools, 1 reference
- [5] doi:10.1093/cercor/bhae483 [code]
- Context changes retrieval of prospective outcomes during decision deliberation.Journal: Cerebral cortex (New York, N.Y. : 1991)In common: Pingouin, pandas, SciPy, 2 other tools, 1 reference
- [6] doi:10.7554/elife.92938 [code]
- Neural interactions in the human frontal cortex dissociate reward and punishment learning.Journal: eLifeIn common: Pingouin, pandas, SciPy, 2 other tools, 1 reference
- [7] doi:10.3389/fnhum.2026.1813515 [code]
- Neural correlates of risky monetary decision-making impacting others.Journal: Frontiers in human neuroscienceIn common: 3 references
- [8] doi:10.7554/elife.92892 [code]
- The neural correlates of novelty and variability in human decision-making under an active inference framework.Journal: eLifeIn common: pandas, SciPy, Matplotlib, 1 other tool, 1 reference
- [9] doi:10.1016/j.nicl.2025.103817 [code]
- Structural connectome manifold changes related to body mass index and their associations with eating psychopathology.Journal: NeuroImage. ClinicalIn common: pandas, SciPy, Matplotlib, 1 other tool, 1 reference
- [10] doi:10.1371/journal.pcbi.1013291 [code]
- A Bayesian hierarchical model of trial-to-trial fluctuations in decision criterion.Journal: PLoS computational biologyIn common: pandas, SciPy, Matplotlib, 1 other tool, 1 reference
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 4 scripts, and 2 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:94af1f7b8768ae3f…
Add the badge to the code's README
If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.
Markdown
<!-- oscr-badge:start -->
[](https://openscicode.org/badge/doi/10.1016/j.isci.2026.116427)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1016/j.isci.2026.116427.svg
:target: https://openscicode.org/badge/doi/10.1016/j.isci.2026.116427
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1016/j.isci.2026.116427"><img src="https://openscicode.org/badge/doi/10.1016/j.isci.2026.116427.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.
Report a mismatch between the code and the paper · Report a code error (signed in)
Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.
Report a reproduction failure (signed in)
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
