OSCR

Regional activity and interregional functional connectivity uniquely contribute to social cognitive judgments during movie-watching.

Code ↔ Paper

1 match between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 1 match
  1. [1] § ANALYTIC APPROACH › Individual-Level Analysis: Linear Model Construction ↔ level1/stepwise_ver/ets_sub_linreg_prewhiten_stepwise.py, lines 79–128 · score 0.75 · fit autoregressive models, statsmodels, residuals, squares, prewhitening, ij

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

Python · 293 lines · 7.6 KB · no license · 1 match

  1. import sys
  2. import time
  3. import numpy as np
  4. import scipy as sp
  5. import statsmodels.api as sm
  6. import statsmodels.formula.api as smf
  7. import pandas as pd
  8. from statsmodels.tsa.ar_model import AutoReg
  9. import pickle
  10. # %%
  11. # points to data-directory where subject data are- split by subject
  12. bdir = sys.argv[1]
  13. subj = sys.argv[2] # subject ID
  14. beh = sys.argv[3] # behavior label
  15. # subj = 'sub-1807'
  16. # beh = 'awk'
  17. indices = np.load('../data/indices_full.npy')
  18. # %%
  19. debug = True
  20. if debug:
  21. start_time = time.time()
  22. shop_ds_len = 249
  23. zoo_ds_len = 233
  24. # %% read in subject nodal timeseries
  25. zoo_nodal = np.load(f'{bdir}/{subj}/{subj}_pettingzoo_interpolated_ts_custom_parc.npy')
  26. shop_nodal = np.load(f'{bdir}/{subj}/{subj}_souvenirshop_interpolated_ts_custom_parc.npy')
  27. zoo_nodal = zoo_nodal[:zoo_ds_len, :]
  28. shop_nodal = shop_nodal[:shop_ds_len, :]
  29. combo_nodal = np.append(zoo_nodal, shop_nodal, axis=0)
  30. y = np.load(f'../../regs/hrf/{beh}_hrf.npy') # behavior (dependent variable)
  31. y = np.append(y[:zoo_ds_len], y[zoo_ds_len:zoo_ds_len + shop_ds_len])
  32. y = np.reshape(y, (len(y), 1))
  33. dm = np.array([1 for t in range(zoo_ds_len)] + [0 for t in range(shop_ds_len)]) # dummy coded run variable
  34. #%%
  35. combo_i = []
  36. combo_j = []
  37. combo_ij = []
  38. for edge in range(indices.shape[0]):
  39. # get indices for nodes
  40. r, c = indices[edge].split('-')
  41. i = combo_nodal[:, int(r)] # node i timeseries
  42. j = combo_nodal[:, int(c)] # node j timeseries
  43. # standardize timeseries
  44. i_std = (i - i.mean()) / i.std()
  45. j_std = (j - j.mean()) / j.std()
  46. # edge timeseries
  47. ij = i_std * j_std
  48. # append to larger matrix timeseries for later
  49. combo_i.append(i_std)
  50. combo_j.append(j_std)
  51. combo_ij.append(ij)
  52. combo_i = np.array(combo_i).T
  53. combo_j = np.array(combo_j).T
  54. combo_ij = np.array(combo_ij).T
  55. # %%
  56. def prewhiten(fullX, y, p=25, nsample=100):
  57. e = np.zeros(fullX[-1].shape)
  58. diag_idx = []
  59. for edge in range(combo_ij.shape[1]):
  60. r, c = indices[edge].split('-')
  61. if r!=c:
  62. X = np.array([i[:, edge] for i in fullX] + [dm, np.ones(fullX[-1].shape[0])]).T
  63. # beta weights
  64. B = np.linalg.inv(X.T @ X) @ X.T @ y
  65. # get residuals
  66. e[:, edge] = np.squeeze(y - (X @ B))
  67. else:
  68. diag_idx.append(edge)
  69. e[:, edge] = np.nan
  70. # fit autoregressive model
  71. # NOTE: AutoReg model in statsmodels here uses a conditional Max. Likelihood Estimator while MatLab AR model uses
  72. # Least-Squares Estimator
  73. P = []
  74. valid_e = list(set(i for i in range(e.shape[1])) - set(diag_idx))
  75. for edge in np.random.choice(valid_e, nsample, replace=False):
  76. res = AutoReg(e[:, edge], p).fit()
  77. P.append(res.params)
  78. P = np.array(P)
  79. mu = np.nanmean(P, 0)
  80. # construct V inverse to get whitening matrix
  81. Amat = np.zeros((e.shape[0], e.shape[0]))
  82. i = 1
  83. for m in mu:
  84. vec = np.ones(e.shape[0] - i)
  85. d = np.diag(-m * vec, -i)
  86. Amat += d
  87. i += 1
  88. Vinv = Amat @ Amat.T
  89. U, S, _ = np.linalg.svd(Vinv)
  90. # Compute whitening matrix
  91. W = U @ sp.linalg.sqrtm(np.diag(S)) @ U.T
  92. return W, mu
  93. def edge_reg_prewhitened(fullX, y, W, name, save_full=True):
  94. #
  95. fullWX = [W[p:-p, p:-p] @ i[p:-p, :] for i in fullX]
  96. Wy = W[p:-p, p:-p] @ y[p:-p]
  97. Wdm = W[p:-p, p:-p] @ dm[p:-p]
  98. # set up structures to hold results
  99. fullres = [] # full fit OLS model
  100. fval = [] # fvalue of model
  101. fprob = [] # p value of model
  102. beta = [] # beta weights for each variable (nodal activity + ets)
  103. sig = [] # p values for each variable (nodal activity + ets)
  104. r2 = [] # model r2 to assess fit
  105. r2_adj = []
  106. AIC = [] # assess fit
  107. BIC = [] # assess fit
  108. # rerun regression with prewhitened data
  109. for edge in range(fullWX[-1].shape[1]):
  110. r, c = indices[edge].split('-')
  111. if r != c:
  112. X = np.array([Wi[:, edge] for Wi in fullWX] + [Wdm]).T
  113. #smf formula style
  114. df = pd.DataFrame(X, columns=name+['run'])
  115. df[beh] = Wy
  116. res = smf.ols(f'{beh} ~ {" + ".join(name)} + run', data=df).fit()
  117. # X = sm.add_constant(X)
  118. # res = sm.OLS(Wy, X).fit()
  119. betas = {}
  120. sigs = {}
  121. fullres.append(res)
  122. fval.append(res.fvalue)
  123. fprob.append(res.f_pvalue)
  124. for i in range(len(name)):
  125. betas[name[i]] = res.params[name[i]]
  126. sigs[name[i]] = res.pvalues[name[i]]
  127. beta.append(betas)
  128. sig.append(sigs)
  129. r2_adj.append(res.rsquared_adj)
  130. r2.append(res.rsquared)
  131. AIC.append(res.aic)
  132. BIC.append(res.bic)
  133. else:
  134. betas = {}
  135. sigs = {}
  136. fullres.append("NULL")
  137. fval.append(np.nan)
  138. fprob.append(np.nan)
  139. for i in range(len(name)):
  140. betas[name[i]] = np.nan
  141. sigs[name[i]] = np.nan
  142. beta.append(betas)
  143. sig.append(sigs)
  144. r2_adj.append(np.nan)
  145. r2.append(np.nan)
  146. AIC.append(np.nan)
  147. BIC.append(np.nan)
  148. fit_d = {
  149. 'fstat': fval,
  150. 'fprob': fprob,
  151. 'betas': beta,
  152. 'pvalues': sig,
  153. 'adj_rsq': r2_adj,
  154. 'rsq': r2,
  155. 'aic': AIC,
  156. 'bic': BIC,
  157. 'autocorr_params': mu,
  158. }
  159. if save_full:
  160. with open(f'../data/sub_level_edge_model_stepwise_{beh}/{subj}_{"-".join(name)}_full_model.pkl', 'wb') as f:
  161. pickle.dump(fullres, f)
  162. return fit_d, fullres
  163. def model_fit_change(m1, m2):
  164. # compare model fit across edges
  165. params = ['fstat', 'fprob', 'adj_rsq', 'aic', 'bic']
  166. fit_change = {}
  167. for param in params:
  168. fit_change[param] = np.array(m1[param]) - np.array(m2[param])
  169. return fit_change
  170. # %% multiply whitening matrix by all variables
  171. p = 25 # order for ar models
  172. nsample = 100 # number of random edge samples to pull to fit models
  173. #%% step 1
  174. fullX = [combo_i]
  175. name = ['i']
  176. W, mu = prewhiten(fullX, y, p=p, nsample=nsample)
  177. fit_d_s1, res_s1 = edge_reg_prewhitened(fullX, y, W, name, save_full=False)
  178. #%% step 2
  179. fullX = [combo_i, combo_j]
  180. name = ['i', 'j']
  181. W, mu = prewhiten(fullX, y, p=p, nsample=nsample)
  182. fit_d_s2, res_s2 = edge_reg_prewhitened(fullX, y, W, name, save_full=False)
  183. fit_change_1_2 = model_fit_change(fit_d_s1, fit_d_s2)
  184. #%% step 3
  185. fullX = [combo_i, combo_j, combo_ij]
  186. name = ['i', 'j', 'ets']
  187. W, mu = prewhiten(fullX, y, p=p, nsample=nsample)
  188. fit_d_s3, res_s3 = edge_reg_prewhitened(fullX, y, W, name, save_full=True)
  189. fit_change_2_3 = model_fit_change(fit_d_s2, fit_d_s3)
  190. #%%
  191. deltas = {'i_min_i+j': fit_change_1_2, 'i+j_min_i+j+ij': fit_change_2_3}
  192. #%% anova lm
  193. edge_modfit_123 = []
  194. for mod1, mod2, mod3 in zip(res_s1, res_s2, res_s3):
  195. if mod1 == "NULL":
  196. edge_modfit_123.append("NULL")
  197. else:
  198. edge_modfit_123.append(sm.stats.anova_lm(mod1, mod2, mod3))
  199. deltas['sig_r2_anova'] = edge_modfit_123
  200. #%%
  201. # get final runtime for single subject
  202. if debug:
  203. end_time = time.time()
  204. runtime = end_time - start_time
  205. print(runtime)
  206. with open(f'../data/sub_level_edge_model_stepwise_{beh}/{subj}_node_only_fit.pkl', 'wb') as f:
  207. pickle.dump(fit_d_s1, f)
  208. with open(f'../data/sub_level_edge_model_stepwise_{beh}/{subj}_fit.pkl', 'wb') as f:
  209. pickle.dump(fit_d_s3, f)
  210. with open(f'../data/sub_level_edge_model_stepwise_{beh}/{subj}_delta.pkl', 'wb') as f:
  211. pickle.dump(deltas, f)

ets_sub_linreg_prewhiten_stepwise.py at commit cbb342d, no license · at the source

Overview

Authors: Roberto C French1, Haily Merritt2, Colleen Hughes1, Richard Betzel3,4, Anne C Krendl1
  1. Department of Psychological and Brain Sciences, Indiana University, Bloomington, IN, USA
  2. Department of Informatics & Program in Cognitive Science, Indiana University, Bloomington, IN, USA
  3. Department of Neuroscience, University of Minnesota, Minneapolis, MN, USA
  4. Masonic Institute for the Developing Brain, University of Minnesota, Minneapolis, MN, USA
Institutions: Indiana University Bloomington (United States); Indiana University (United States); University of Minnesota (United States)
Journal: Network neuroscience (Cambridge, Mass.), volume 10, issue 3, pages 738-760
Dates: received 22 July 2025; accepted 12 March 2026; published online 27 July 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1162/netn.a.571 · PMID 42529782 · PMCID PMC13418520 · OpenAlex W7155178502
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: fMRI (modality)
Methods: Connectivity, fMRI & imaging, Statistics
Keywords: fMRI, Social cognition, Dynamic functional connectivity, Brain-behavior relationship, Movie watching
Topic: Neural and Behavioral Psychology Studies (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: NIA NIH HHS (R01 AG075044, R01 AG070931)
Citations: not cited yet (Europe PMC); 130 references in the paper
Research resources: RRID:SCR_001362, 2011 RRID:SCR_002502, 2019 RRID:SCR_016216

Abstract

Understanding how the brain gives rise to social cognition has been a key goal of neuroimaging research. Both changes in regional activation as well as functional connectivity have been implicated as potential mechanisms underlying social cognition, but the two have rarely been examined concurrently. Moreover, because the neural processes underlying social cognition are dynamic, developing approaches to capture dynamic changes in regional activity and functional connectivity are critical. Here, we describe a novel analysis approach that captures both regional activity and dynamic functional connectivity simultaneously during a naturalistic, socially focused movie-watching task. We found that both regional activation and functional connectivity were uniquely related to awkwardness, a judgment associated with social faux pas detection and theory of mind. Regional activation within sensorimotor networks was positively associated with awkwardness, whereas activation in the default network was negatively associated. Models including functional connectivity accounted for unique variance beyond models with activity alone. Specifically, dynamic functional connectivity between networks, primarily the frontoparietal control network, was positively associated with awkwardness. Together, these findings suggest that both dynamic regional brain activity and functional connectivity each uniquely contribute to complex and dynamic social judgments.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repositories

Its files are read in the Code ↔ Paper reader above, with 1 match between paragraphs and lines of code.

OSF 8bvu9

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Size: 2 files
Software Heritage: not checked
Found in: the text, “Group-Level Analysis: Network-Level Significance”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)
At the source: osf.io/8bvu9/

rcf004/edge-timeseries-linear-interaction

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: cbb342dd19c1b76b63f294a3823a30a65ec06234, 21 July 2025
Languages: Python (16), Shell (6)
Size: 37 files, 22 scripts
Software Heritage: not archived
Found in: the text, “Group-Level Analysis: Network-Level Significance”
Holds: README, environment (conda_env.yml)
Not found: license file, CITATION.cff, tests, continuous integration, documentation
Tools: NumPy (16 files), Matplotlib (12 files), SciPy (8 files), pandas (5 files), Nilearn (4 files), seaborn (4 files), statsmodels (4 files)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
23 files

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:

  • 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 22 scripts, each with its path and the digest of its content;
  • 1 match 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.

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, 5 authors, 5 keywords, 1 funder, 128 references, 3 RRIDs.

Cite

This paper

French, R. C., Merritt, H., Hughes, C., Betzel, R., & Krendl, A. C. (2026). Regional activity and interregional functional connectivity uniquely contribute to social cognitive judgments during movie-watching. Network neuroscience (Cambridge, Mass.), 10(3), 738-760. https://doi.org/10.1162/netn.a.571

BibTeX

@article{french2026regional,
author = {French, Roberto C and Merritt, Haily and Hughes, Colleen and Betzel, Richard and Krendl, Anne C},
title = {{Regional activity and interregional functional connectivity uniquely contribute to social cognitive judgments during movie-watching}},
journal = {Network neuroscience (Cambridge, Mass.)},
year = {2026},
month = jul,
volume = {10},
number = {3},
pages = {738--760},
publisher = {MIT Press},
issn = {2472-1751},
doi = {10.1162/netn.a.571},
url = {https://doi.org/10.1162/netn.a.571},
pmid = {42529782},
pmcid = {PMC13418520}
}

RIS

TY - JOUR
AU - French, Roberto C
AU - Merritt, Haily
AU - Hughes, Colleen
AU - Betzel, Richard
AU - Krendl, Anne C
TI - Regional activity and interregional functional connectivity uniquely contribute to social cognitive judgments during movie-watching
T2 - Network neuroscience (Cambridge, Mass.)
J2 - Netw Neurosci
PY - 2026
DA - 2026/07/27
VL - 10
IS - 3
SP - 738
EP - 760
SN - 2472-1751
PB - MIT Press
DO - 10.1162/netn.a.571
UR - https://doi.org/10.1162/netn.a.571
LA - en
ER -

CSL-JSON

{
"id": "10.1162/netn.a.571",
"type": "article-journal",
"title": "Regional activity and interregional functional connectivity uniquely contribute to social cognitive judgments during movie-watching",
"container-title": "Network neuroscience (Cambridge, Mass.)",
"author": [
{
"family": "French",
"given": "Roberto C"
},
{
"family": "Merritt",
"given": "Haily"
},
{
"family": "Hughes",
"given": "Colleen"
},
{
"family": "Betzel",
"given": "Richard"
},
{
"family": "Krendl",
"given": "Anne C"
}
],
"container-title-short": "Netw Neurosci",
"volume": "10",
"issue": "3",
"page": "738-760",
"DOI": "10.1162/netn.a.571",
"PMID": "42529782",
"PMCID": "PMC13418520",
"ISSN": "2472-1751",
"publisher": "MIT Press",
"URL": "https://doi.org/10.1162/netn.a.571",
"language": "en",
"issued": {
"date-parts": [
[
2026,
7,
27
]
]
}
}

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.1162/imag.a.1285 [code]
Individualized mapping of functional brain networks in older adulthood.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: fMRI, 10 references, 3 authors
[2] doi:10.1016/j.isci.2026.115949 [code]
The dual interpretation of edge time series: Time-varying connectivity versus statistical interaction.
Journal: iScience
In common: 12 references, author Richard Betzel
[3] doi:10.1038/s41467-026-71151-2 [code]
Common and distinct neural correlates of social interaction processing and theory of mind in narratives.
Journal: Nature communications
In common: Nilearn, statsmodels, seaborn, 4 other tools, 11 references
[4] doi:10.1038/s41467-026-76011-7 [code]
Human cortex organizes dynamic co-fluctuations along the sensorimotor-association axis.
Journal: Nature communications
In common: SciPy, Matplotlib, NumPy, 10 references
[5] doi:10.1371/journal.pbio.3003684 [code]
The retrieval of previously learned motor memories is facilitated by the reinstatement of default mode network manifold structures.
Journal: PLoS biology
In common: Nilearn, seaborn, pandas, 3 other tools, fMRI, 7 references
[6] doi:10.1016/j.neuroimage.2026.122171 [code]
A conserved node degree-based backbone and flexible hub organization of brain connectome during naturalistic movie watching.
Journal: NeuroImage
In common: Nilearn, SciPy, Matplotlib, 1 other tool, fMRI, 6 references
[7] doi:10.1038/s41467-026-75745-8 [code]
A language network in the individualized functional connectomes of 1199 human brains doing arbitrary tasks.
Journal: Nature communications
In common: Nilearn, seaborn, pandas, 3 other tools, 6 references
[8] doi:10.1073/pnas.2512071123 [code]
Narrative "twist" shifts within-individual neural representations of dissociable story features.
Journal: Proceedings of the National Academy of Sciences of the United States of America
In common: Nilearn, statsmodels, seaborn, 4 other tools, fMRI, 4 references
[9] doi:10.1162/netn.a.544 [code]
Brain network reconfiguration during reward prediction error processing.
Journal: Network neuroscience (Cambridge, Mass.)
In common: Nilearn, statsmodels, seaborn, 4 other tools, fMRI, 4 references
[10] doi:10.1038/s41467-026-75959-w [code]
Charting higher-order models of brain function beyond pairwise interactions.
Journal: Nature communications
In common: Nilearn, statsmodels, seaborn, 4 other tools, 5 references

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.

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: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.