Regional activity and interregional functional connectivity uniquely contribute to social cognitive judgments during movie-watching.
The 1 match
- [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
- import sys
- import time
- import numpy as np
- import scipy as sp
- import statsmodels.api as sm
- import statsmodels.formula.api as smf
- import pandas as pd
- from statsmodels.tsa.ar_model import AutoReg
- import pickle
- # %%
- # points to data-directory where subject data are- split by subject
- bdir = sys.argv[1]
- subj = sys.argv[2] # subject ID
- beh = sys.argv[3] # behavior label
- # subj = 'sub-1807'
- # beh = 'awk'
- indices = np.load('../data/indices_full.npy')
- # %%
- debug = True
- if debug:
- start_time = time.time()
- shop_ds_len = 249
- zoo_ds_len = 233
- # %% read in subject nodal timeseries
- zoo_nodal = np.load(f'{bdir}/{subj}/{subj}_pettingzoo_interpolated_ts_custom_parc.npy')
- shop_nodal = np.load(f'{bdir}/{subj}/{subj}_souvenirshop_interpolated_ts_custom_parc.npy')
- zoo_nodal = zoo_nodal[:zoo_ds_len, :]
- shop_nodal = shop_nodal[:shop_ds_len, :]
- combo_nodal = np.append(zoo_nodal, shop_nodal, axis=0)
- y = np.load(f'../../regs/hrf/{beh}_hrf.npy') # behavior (dependent variable)
- y = np.append(y[:zoo_ds_len], y[zoo_ds_len:zoo_ds_len + shop_ds_len])
- y = np.reshape(y, (len(y), 1))
- dm = np.array([1 for t in range(zoo_ds_len)] + [0 for t in range(shop_ds_len)]) # dummy coded run variable
- #%%
- combo_i = []
- combo_j = []
- combo_ij = []
- for edge in range(indices.shape[0]):
- # get indices for nodes
- r, c = indices[edge].split('-')
- i = combo_nodal[:, int(r)] # node i timeseries
- j = combo_nodal[:, int(c)] # node j timeseries
- # standardize timeseries
- i_std = (i - i.mean()) / i.std()
- j_std = (j - j.mean()) / j.std()
- # edge timeseries
- ij = i_std * j_std
- # append to larger matrix timeseries for later
- combo_i.append(i_std)
- combo_j.append(j_std)
- combo_ij.append(ij)
- combo_i = np.array(combo_i).T
- combo_j = np.array(combo_j).T
- combo_ij = np.array(combo_ij).T
- # %%
- def prewhiten(fullX, y, p=25, nsample=100):
- e = np.zeros(fullX[-1].shape)
- diag_idx = []
- for edge in range(combo_ij.shape[1]):
- r, c = indices[edge].split('-')
- if r!=c:
- X = np.array([i[:, edge] for i in fullX] + [dm, np.ones(fullX[-1].shape[0])]).T
- # beta weights
- B = np.linalg.inv(X.T @ X) @ X.T @ y
- # get residuals
- e[:, edge] = np.squeeze(y - (X @ B))
- else:
- diag_idx.append(edge)
- e[:, edge] = np.nan
- # fit autoregressive model
- # NOTE: AutoReg model in statsmodels here uses a conditional Max. Likelihood Estimator while MatLab AR model uses
- # Least-Squares Estimator
- P = []
- valid_e = list(set(i for i in range(e.shape[1])) - set(diag_idx))
- for edge in np.random.choice(valid_e, nsample, replace=False):
- res = AutoReg(e[:, edge], p).fit()
- P.append(res.params)
- P = np.array(P)
- mu = np.nanmean(P, 0)
- # construct V inverse to get whitening matrix
- Amat = np.zeros((e.shape[0], e.shape[0]))
- i = 1
- for m in mu:
- vec = np.ones(e.shape[0] - i)
- d = np.diag(-m * vec, -i)
- Amat += d
- i += 1
- Vinv = Amat @ Amat.T
- U, S, _ = np.linalg.svd(Vinv)
- # Compute whitening matrix
- W = U @ sp.linalg.sqrtm(np.diag(S)) @ U.T
- return W, mu
- def edge_reg_prewhitened(fullX, y, W, name, save_full=True):
- #
- fullWX = [W[p:-p, p:-p] @ i[p:-p, :] for i in fullX]
- Wy = W[p:-p, p:-p] @ y[p:-p]
- Wdm = W[p:-p, p:-p] @ dm[p:-p]
- # set up structures to hold results
- fullres = [] # full fit OLS model
- fval = [] # fvalue of model
- fprob = [] # p value of model
- beta = [] # beta weights for each variable (nodal activity + ets)
- sig = [] # p values for each variable (nodal activity + ets)
- r2 = [] # model r2 to assess fit
- r2_adj = []
- AIC = [] # assess fit
- BIC = [] # assess fit
- # rerun regression with prewhitened data
- for edge in range(fullWX[-1].shape[1]):
- r, c = indices[edge].split('-')
- if r != c:
- X = np.array([Wi[:, edge] for Wi in fullWX] + [Wdm]).T
- #smf formula style
- df = pd.DataFrame(X, columns=name+['run'])
- df[beh] = Wy
- res = smf.ols(f'{beh} ~ {" + ".join(name)} + run', data=df).fit()
- # X = sm.add_constant(X)
- # res = sm.OLS(Wy, X).fit()
- betas = {}
- sigs = {}
- fullres.append(res)
- fval.append(res.fvalue)
- fprob.append(res.f_pvalue)
- for i in range(len(name)):
- betas[name[i]] = res.params[name[i]]
- sigs[name[i]] = res.pvalues[name[i]]
- beta.append(betas)
- sig.append(sigs)
- r2_adj.append(res.rsquared_adj)
- r2.append(res.rsquared)
- AIC.append(res.aic)
- BIC.append(res.bic)
- else:
- betas = {}
- sigs = {}
- fullres.append("NULL")
- fval.append(np.nan)
- fprob.append(np.nan)
- for i in range(len(name)):
- betas[name[i]] = np.nan
- sigs[name[i]] = np.nan
- beta.append(betas)
- sig.append(sigs)
- r2_adj.append(np.nan)
- r2.append(np.nan)
- AIC.append(np.nan)
- BIC.append(np.nan)
- fit_d = {
- 'fstat': fval,
- 'fprob': fprob,
- 'betas': beta,
- 'pvalues': sig,
- 'adj_rsq': r2_adj,
- 'rsq': r2,
- 'aic': AIC,
- 'bic': BIC,
- 'autocorr_params': mu,
- }
- if save_full:
- with open(f'../data/sub_level_edge_model_stepwise_{beh}/{subj}_{"-".join(name)}_full_model.pkl', 'wb') as f:
- pickle.dump(fullres, f)
- return fit_d, fullres
- def model_fit_change(m1, m2):
- # compare model fit across edges
- params = ['fstat', 'fprob', 'adj_rsq', 'aic', 'bic']
- fit_change = {}
- for param in params:
- fit_change[param] = np.array(m1[param]) - np.array(m2[param])
- return fit_change
- # %% multiply whitening matrix by all variables
- p = 25 # order for ar models
- nsample = 100 # number of random edge samples to pull to fit models
- #%% step 1
- fullX = [combo_i]
- name = ['i']
- W, mu = prewhiten(fullX, y, p=p, nsample=nsample)
- fit_d_s1, res_s1 = edge_reg_prewhitened(fullX, y, W, name, save_full=False)
- #%% step 2
- fullX = [combo_i, combo_j]
- name = ['i', 'j']
- W, mu = prewhiten(fullX, y, p=p, nsample=nsample)
- fit_d_s2, res_s2 = edge_reg_prewhitened(fullX, y, W, name, save_full=False)
- fit_change_1_2 = model_fit_change(fit_d_s1, fit_d_s2)
- #%% step 3
- fullX = [combo_i, combo_j, combo_ij]
- name = ['i', 'j', 'ets']
- W, mu = prewhiten(fullX, y, p=p, nsample=nsample)
- fit_d_s3, res_s3 = edge_reg_prewhitened(fullX, y, W, name, save_full=True)
- fit_change_2_3 = model_fit_change(fit_d_s2, fit_d_s3)
- #%%
- deltas = {'i_min_i+j': fit_change_1_2, 'i+j_min_i+j+ij': fit_change_2_3}
- #%% anova lm
- edge_modfit_123 = []
- for mod1, mod2, mod3 in zip(res_s1, res_s2, res_s3):
- if mod1 == "NULL":
- edge_modfit_123.append("NULL")
- else:
- edge_modfit_123.append(sm.stats.anova_lm(mod1, mod2, mod3))
- deltas['sig_r2_anova'] = edge_modfit_123
- #%%
- # get final runtime for single subject
- if debug:
- end_time = time.time()
- runtime = end_time - start_time
- print(runtime)
- with open(f'../data/sub_level_edge_model_stepwise_{beh}/{subj}_node_only_fit.pkl', 'wb') as f:
- pickle.dump(fit_d_s1, f)
- with open(f'../data/sub_level_edge_model_stepwise_{beh}/{subj}_fit.pkl', 'wb') as f:
- pickle.dump(fit_d_s3, f)
- with open(f'../data/sub_level_edge_model_stepwise_{beh}/{subj}_delta.pkl', 'wb') as f:
- pickle.dump(deltas, f)
ets_sub_linreg_prewhiten_stepwise.py at commit cbb342d, no license · at the source
Overview
- Department of Psychological and Brain Sciences, Indiana University, Bloomington, IN, USA
- Department of Informatics & Program in Cognitive Science, Indiana University, Bloomington, IN, USA
- Department of Neuroscience, University of Minnesota, Minneapolis, MN, USA
- Masonic Institute for the Developing Brain, University of Minnesota, Minneapolis, MN, USA
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
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
rcf004/edge-timeseries-linear-interaction
cbb342dd19c1b76b63f294a3823a30a65ec06234, 21 July 2025Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
23 files
- level1/
non_prewhitened_ver/ , Python, 124 linesets_sub_linreg_noprewhit en.py - level1/
non_prewhitened_ver/ , Shell, 13 linessublevel_linreg.sh - level1/
non_prewhitened_ver/ , Shell, 35 linessubmit_sub_linreg.sh - level1/
prewhitened_ver/ , Python, 213 linesets_sub_linreg_prewhiten .py - level1/
prewhitened_ver/ , Shell, 14 linessublevel_linreg.sh - level1/
prewhitened_ver/ , Shell, 37 linessubmit_sub_linreg.sh - level1/
regprep.py , Python, 129 lines - level1/
stepwise_ver/ , Python, 293 lines, 1 matchets_sub_linreg_prewhiten _stepwise.py - level1/
stepwise_ver/ , Shell, 14 linessublevel_linreg.sh - level1/
stepwise_ver/ , Shell, 35 linessubmit_sub_linreg.sh - level2/
non_prewhitened_ver/ , Python, 402 linesmat_manip.py - level2/
non_prewhitened_ver/ , Python, 74 linesoutput_driver_no-prewhit en.py - level2/
non_prewhitened_ver/ , Python, 178 linesplotting_funcs.py - level2/
non_prewhitened_ver/ , Python, 377 linestermpull_no-prewhiten.py - level2/
prewhitened_ver/ , Python, 402 linesmat_manip.py - level2/
prewhitened_ver/ , Python, 171 linesoutput_driver.py - level2/
prewhitened_ver/ , Python, 178 linesplotting_funcs.py - level2/
prewhitened_ver/ , Python, 381 linestermpull.py - level2/
stepwise_ver/ , Python, 402 linesmat_manip.py - level2/
stepwise_ver/ , Python, 106 linesoutput_driver_stepwise.p y - level2/
stepwise_ver/ , Python, 178 linesplotting_funcs.py - level2/
stepwise_ver/ , Python, 439 linestermpull_stepwise.py - README.md, Text, 17 lines
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://
BibTeX
@article{french2026regio
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/
url = {https://
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/
VL - 10
IS - 3
SP - 738
EP - 760
SN - 2472-1751
PB - MIT Press
DO - 10.1162/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1162/
"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":
"volume": "10",
"issue": "3",
"page": "738-760",
"DOI": "10.1162/
"PMID": "42529782",
"PMCID": "PMC13418520",
"ISSN": "2472-1751",
"publisher": "MIT Press",
"URL": "https://
"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: iScienceIn 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 communicationsIn 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 communicationsIn 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 biologyIn 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: NeuroImageIn 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 communicationsIn 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 AmericaIn 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 communicationsIn 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.
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: 2 repositories of the authors' code, each at its verified commit and with its license, 22 scripts, and 1 match 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:ddc58a44c1427504…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
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.
