Computational parametric mapping of functional neuroimaging data.
The 11 matches · 5 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
- [1] § Real Data › Results ↔ SIMULATIONS/realdata_niv2012.m, lines 234–340 · score 0.82 · rMSE, NAcc, exceedance probabilities, risk sensitive TD, classical TD model, learning rate asymmetries
- [2] § Real Data › Results ↔ SIMULATIONS/realdata_niv2012.m, lines 234–340 · score 0.79 · NAcc, exceedance probabilities, risk sensitive TD, classic TD model, learning rate asymmetry, model comparison
- [3] § Computational Parametric Mapping › Hemodynamic response function ↔ toolbox/spm_prf_fx.m, the whole file · a weak match · score 0.64 · signal decay, balloon model, ratio, hemodynamic, transit, MRI
- [4] § Computational Parametric Mapping › Hemodynamic response function ↔ toolbox/spm_prf_gx.m, the whole file · a weak match · score 0.63 · field strength, hemodynamic model, intravascular, ratio, signal, pRF
- [5] § Simulation Results › Bayesian model selection ↔ SIMULATIONS/simulations_td.m, lines 229–247 · score 0.63 · exceedance probabilities, risk sensitive TD, classical TD model, model recovery, Bar, SNR
- [6] § Simulation Study ↔ SIMULATIONS/simulations_td/code/cpm_events_to_trials.m, the whole file · a weak match · score 0.61 · response cue, wealth update, stimulus onset, TD, Simulation
- [7] § Real Data › Results ↔ SIMULATIONS/simulations_td.m, lines 229–247 · score 0.58 · exceedance probabilities, risk sensitive TD, classic TD model, CPM
- [8] § Computational Parametric Mapping › Inputs ↔ toolbox/response_functions/spm_cpm_fcn_gaussian.m, lines 1–131 · score 0.57 · field model, fMRI, parameter space, cognitive, location, CPM
- [9] § Simulation Study ↔ SIMULATIONS/auxiliary_td.m, the whole file · a weak match · score 0.54 · stimulus onset, TD learning, CC, wealth, RPE, reward
- [10] § Real Data › Methods ↔ SIMULATIONS/auxiliary_td.m, the whole file · a weak match · score 0.54 · TD learning models, TD errors, event, onsets, CPM
- [11] § Real Data › Methods ↔ SIMULATIONS/realdata_niv2012.m, lines 399–426 · score 0.54 · motion parameters, quadratic, preprocessed, linear, regressing
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
MATLAB · 454 lines · 19 KB · GPL-3.0 · 3 matches
- function [] = realdata_niv()
- % Script to perform analysis of Niv et al. 2012.
- % ---------------------------------------------------------------------
- % Copyright (C) 2024 Simon R. Steinkamp
- % This program is free software: you can redistribute it and/or modify
- % it under the terms of the GNU General Public License as published by
- % the Free Software Foundation, either version 3 of the License, or
- % (at your option) any later version.
- %
- % This program is distributed in the hope that it will be useful,
- % but WITHOUT ANY WARRANTY; without even the implied warranty of
- % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- % GNU General Public License for more details.
- %
- % You should have received a copy of the GNU General Public License
- % along with this program. If not, see <http://www.gnu.org/licenses/>.
- % ---------------------------------------------------------------------
- %% Adding necessary paths:
- rng(23, 'twister'); % Set random seed
- configs = simulation_configs();
- addpath(genpath('../toolbox'));
- addpath(configs.spm_path);
- addpath(genpath(configs.vba_path));
- addpath('simulations_td/code');
- spm fmri;
- close all;
- mkdir('realdata_niv2012');
- mkdir('realdata_niv2012/models');
- % data url for Wilson & Niv 2015
- if ~isfolder('realdata_niv2012/ROI_data')
- data_url = 'https://doi.org/10.1371/journal.pcbi.1004237.s003';
- save_dir = 'realdata_niv2012/data.zip';
- websave(save_dir, data_url);
- unzip(save_dir, 'realdata_niv2012');
- end
- % ==========================================================================
- % PREPARATION
- %% ==========================================================================
- logit_inv = @(x) 1 ./ (1 + exp(-x));
- % Loading some example data:
- naccLeft = load('realdata_niv2012/ROI_data/lNAC_AllEventsData.mat');
- naccRight = load('realdata_niv2012/ROI_data/rNAC_AllEventsData.mat');
- dt = naccLeft.dt;
- TE = 30 ./ 1000; % From paper
- TR = 2.0; %
- SPM = {};
- SPM.xY.RT = TR;
- % This is where the PRF will be saved, we just set it to be here.
- SPM.swd = 'realdata_niv2012/models';
- fixedparams = struct('gamma', 0.99, 'lambda', 1.0);
- % Setting options for inversion
- invert_options = struct('use_parfor', false, ...
- 'init', 'None', ...
- 'nograph', true, 'random_state', true);
- %%
- resolution = 41;
- subjects = [];
- % Select the participants that have data
- for ii = 1:length(naccLeft.Data)
- if ~isempty(naccLeft.Data{ii})
- subjects = [subjects, ii];
- end
- end
- model_names = {'td', 'rs'};
- run_estimation = {[1, 2, 3]};
- F = zeros(length(run_estimation), 2, length(subjects), length(model_names));
- fit_r = zeros(length(run_estimation), 2, length(subjects), length(model_names));
- fit_p = zeros(length(run_estimation), 2, length(subjects), length(model_names));
- fit_orig_r = zeros(size(fit_p));
- fit_orig_td = zeros(size(fit_p));
- fit_orig_rstd = zeros(size(fit_p));
- msez_rstd = zeros(size(fit_p));
- msez_td = zeros(size(fit_p));
- msez_fit = zeros(size(fit_p));
- learning_rates = zeros(length(run_estimation), 2, length(subjects), 3);
- PRFs = {};
- for data_idx = 1:2
- if data_idx == 1
- dataset = naccLeft;
- elseif data_idx == 2
- dataset = naccRight;
- end
- for sub_idx = 1:length(subjects)
- for re = 1:length(run_estimation)
- sub_data = dataset.Data{subjects(sub_idx)}; % Extract the data struct
- % There appear to be three runs of data, let's just use one first:
- % we have basically 1 voxel.
- [cleanData, stimOns, rewardOns, rewards, ...
- chosen, rstdsig, tdsig, n_trials] = prep_data(sub_data, ...
- run_estimation{re}, ...
- dt, TR);
- % For simplicity, we can re-use the CSC representation scripts I implemented for
- % the simulation study, but for this we need a "trial" structure first.
- trials = {};
- cc = 1;
- for nt = 1:n_trials
- if ~isnan(chosen(nt)) % We remove trials without a response
- trials(cc).onsets = [stimOns(nt), rewardOns(nt)];
- trials(cc).stimuli = {num2str(chosen(nt)), 'reward'};
- trials(cc).wealth = [0, rewards(nt)];
- cc = cc + 1;
- end
- end
- %%
- % Create a CSC representation from the trials struct. We use a very simple one
- % containing only the onset of the stimulus and the reward.
- csc_trials = cpm_trials_to_csc(trials, 4, [2, 3], [1], 3);
- % ==========================================================================
- %% The reinforcement learning algorithm
- % ==========================================================================
- % The BayesPRF requires an SPM struct, but only a few fields from there, which
- % we generate here:
- % Create a dummy VOI
- VOI = {};
- VOI.Y = cleanData;
- VOI.xY.y = cleanData;
- VOI.xY.XYZmm = zeros(3, 1);
- % Creating a data struct
- data = {};
- data.ons = cat(2, csc_trials.onsets);
- data.dur = zeros(size(data.ons)) + 2 .* dt;
- data.dt = zeros(size(data.ons)) + dt;
- data.trials = csc_trials;
- %% PRF
- for mi = 1:length(model_names)
- if strcmp(model_names{mi}, 'rs')
- name = ['sub-' num2str(sub_idx), '_data-', ...
- num2str(data_idx), '_run-', num2str(re), '_rs'];
- grid = struct('taupos', [-8.1259, 8.1259, resolution], ...
- 'tauneg', [-8.1259, 8.1259, resolution]);
- params = {{'taupos', 'tauneg'}};
- U_prf = cpm_precompute(@cpm_td_learning, ...
- grid, fixedparams, data, 'U_prf', true);
- U_prf = cpm_set_constraints(U_prf, 'taupos', [-4.0, 4.0]);
- U_prf = cpm_set_constraints(U_prf, 'tauneg', [-4.0, 4.0]);
- elseif strcmp(model_names{mi}, 'td')
- name = ['sub-' num2str(sub_idx), '_data-', ...
- num2str(data_idx) '_run-' num2str(re) '_td'];
- grid = struct('tau', [-8.1259, 8.1259, resolution]);
- params = {{'tau'}};
- U_prf = cpm_precompute(@cpm_td_learning, ...
- grid, fixedparams, data, 'U_prf', true);
- U_prf = cpm_set_constraints(U_prf, ...
- 'tau', ...
- [-4.0, 4.0]);
- end
- options = struct('model', 'spm_cpm_fcn_gaussian', ...
- 'name', name, ...
- 'params', params, ...
- 'TE', TE, ...
- 'B0', 3, ...
- 'voxel_wise', true, ...
- 'avg_sess', false);
- PRF = spm_prf_analyse('specify', SPM, VOI, U_prf, options);
- PRF.M.noprint = 1;
- PRFn = spm_prf_analyse('estimate', PRF, invert_options);
- save_wrapper(PRFn, fullfile(SPM.swd, ['PRF_' name '.mat']));
- F(re, data_idx, sub_idx, mi) = PRFn.F;
- PRFs{re, data_idx, sub_idx, mi} = PRFn;
- ypred = cpm_predict(PRFn, 1);
- [rtmp, ptmp] = corr(PRFn.Y.y, ypred);
- fit_r(re, data_idx, sub_idx, mi) = rtmp;
- fit_p(re, data_idx, sub_idx, mi) = ptmp;
- fit_orig_td(re, data_idx, sub_idx, mi) = corr(PRFn.Y.y, tdsig');
- fit_orig_rstd(re, data_idx, sub_idx, mi) = corr(PRFn.Y.y, rstdsig');
- fit_orig_r(re, data_idx, sub_idx, mi) = corr(rstdsig', ypred);
- msez_rstd(re, data_idx, sub_idx, mi) = mean((zscore(PRFn.Y.y) - ...
- zscore(rstdsig')).^2);
- msez_td(re, data_idx, sub_idx, mi) = mean((zscore(PRFn.Y.y) - ...
- zscore(tdsig')).^2);
- msez_fit(re, data_idx, sub_idx, mi) = mean((zscore(PRFn.Y.y) - ...
- zscore(ypred)).^2);
- if strcmp(model_names{mi}, 'td')
- true_params = cpm_get_true_parameters(PRFn, 1);
- learning_rates(re, data_idx, sub_idx, 1) = logit_inv(true_params.mu_tau);
- elseif strcmp(model_names{mi}, 'rs')
- true_params = cpm_get_true_parameters(PRFn, 1);
- learning_rates(re, data_idx, sub_idx, 2) = logit_inv(true_params.mu_tauneg);
- learning_rates(re, data_idx, sub_idx, 3) = logit_inv(true_params.mu_taupos);
- end
- end
- end
- end
- end
- %% Model comparisons
- ex_probs = zeros(4, 2, 2);
- for ridx = 1:length(run_estimation)
- for didx = 1:2
- [~, o] = VBA_groupBMC(squeeze(F(ridx, didx, :, :))', struct('DisplayWin', 0));
- ex_probs(ridx, didx, :) = o.ep;
- end
- end
- %%
- taus = zeros(length(run_estimation), 2, length(subjects));
- for ridx = 1:length(run_estimation)
- for didx = 1:2
- for sidx = 1:length(subjects)
- taus(ridx, didx, sidx) = (squeeze(learning_rates(ridx, didx, sidx, 2)) ./ ...
- sum(squeeze(learning_rates(ridx, didx, sidx, 2:3))));
- end
- end
- end
- %%
- fig1 = figure('Position', [0, 0, 2000, 800]);
- subplot(2, 3, 1);
- bar([squeeze(ex_probs(1, :, :))]'); % , squeeze(ex_probs_sig(1,: ,:))]);
- legend({'left NAcc', 'right NAcc'}); % , 'left NAcc (only sig.)', 'right NAcc (only sig.)'})
- xticklabels({'classic TD', 'risk-sensitive TD'});
- ylabel('exceedance probability');
- title('Model comparison');
- subplot(2, 3, 2);
- scatter(squeeze(fit_r(1, 1, :, 1)), squeeze(fit_orig_td(1, 1, :, 1)), [], 'blue');
- xlabel('r CPM');
- ylabel('r regressors');
- hold on;
- scatter(squeeze(fit_r(1, 2, :, 1)), squeeze(fit_orig_td(1, 2, :, 1)), [], 'red');
- title('Classic TD model');
- h1 = lsline();
- h1(1).Color = 'blue';
- h1(2).Color = 'red';
- legend({'left NAcc', 'right NAcc'});
- subplot(2, 3, 3);
- scatter(squeeze(fit_r(1, 2, :, 1)), squeeze(fit_orig_rstd(1, 2, :, 1)), [], 'blue');
- xlabel('r CPM');
- ylabel('r regressors');
- hold on;
- scatter(squeeze(fit_r(1, 2, :, 2)), squeeze(fit_orig_rstd(1, 2, :, 2)), [], 'red');
- title('risk-sensitive TD model');
- h1 = lsline();
- h1(1).Color = 'blue';
- h1(2).Color = 'red';
- legend({'left NAcc', 'right NAcc'});
- subplot(2, 3, 4);
- scatter(ones(length(subjects), 1)', squeeze(taus(1, 1, :)));
- hold on;
- scatter(ones(length(subjects), 1)' + 1, squeeze(taus(1, 2, :)));
- for ii = 1:length(subjects)
- plot([1, 2], [taus(1, 1, ii), taus(1, 2, ii)], ...
- 'Color', [0.2, 0.2, 0.2, 0.2], 'LineWidth', 0.1);
- end
- xlim([0.5, 2.5]);
- xticks([1, 2]);
- xticklabels({'left NAcc', 'right NAcc'});
- ylabel('\tau = (\alpha^+) / (\alpha^+ + \alpha^-)');
- title('Learning rate asymmetries (risk-sensitive TD)');
- subplot(2, 3, 5);
- mse_diff = sqrt(msez_rstd) - sqrt(msez_td);
- scatter(ones(length(subjects), 1)', squeeze(mse_diff(1, 1, :, 1)));
- hold on;
- scatter(ones(length(subjects), 1)' + 1, squeeze(mse_diff(1, 2, :, 1)));
- boxplot([squeeze(mse_diff(1, 1, :, 1)), squeeze(mse_diff(1, 2, :, 1))]);
- yline(0);
- xticklabels({'left NAcc', 'right NAcc'});
- ylabel('rMSE_{RSTD} - rMSE_{TD}');
- title('MSE original models');
- subplot(2, 3, 6);
- mse_diff = sqrt(msez_fit(:, :, :, 2)) - sqrt(msez_fit(:, :, :, 1));
- scatter(ones(length(subjects), 1)', squeeze(mse_diff(1, 1, :, 1)));
- hold on;
- scatter(ones(length(subjects), 1)' + 1, squeeze(mse_diff(1, 2, :, 1)));
- boxplot([squeeze(mse_diff(1, 1, :, 1)), squeeze(mse_diff(1, 2, :, 1))]);
- xticklabels({'left NAcc', 'right NAcc'});
- ylabel('rMSE_{RSTD} - rMSE_{TD}');
- title('MSE CPM');
- yline(0);
- sgtitle('Application to Niv et al. (2012)');
- % Writing out results:
- % row 1, col 2:
- fileID = fopen(fullfile('realdata_niv2012', 'results.txt'), 'w');
- [c12_1, p12_1] = corr(squeeze(fit_r(1, 1, :, 1)), squeeze(fit_orig_td(1, 1, :, 1)));
- fprintf(fileID, 'Correlation classic TD (left): c12_1 = %.4f, p12_1 = %.10f\n', c12_1, p12_1);
- [c12_2, p12_2] = corr(squeeze(fit_r(1, 2, :, 1)), squeeze(fit_orig_td(1, 2, :, 1)));
- fprintf(fileID, 'Correlation classic TD (right): c12_2 = %.4f, p12_2 = %.10f\n', c12_2, p12_2);
- [c13_1, p13_1] = corr(squeeze(fit_r(1, 1, :, 2)), squeeze(fit_orig_rstd(1, 1, :, 1)));
- fprintf(fileID, 'Correlation RSTD (left): c13_1 = %.4f, p13_1 = %.10f\n', c13_1, p13_1);
- [c13_2, p13_2] = corr(squeeze(fit_r(1, 2, :, 2)), squeeze(fit_orig_rstd(1, 2, :, 1)));
- fprintf(fileID, 'Correlation RSTD (right): c13_2 = %.4f, p13_2 = %.10f\n', c13_2, p13_2);
- [~, p21, ~, stats_21] = ttest(squeeze(taus(1, 1, :)), squeeze(taus(1, 2, :)));
- fprintf(fileID, 'Ttest - tau: p21 = %.10f, tstat = %.4f, df = %.4f\n', p21, stats_21.tstat, stats_21.df);
- bf_right_clrstd = ex_probs(1, 2,2) / ex_probs(1, 2, 1);
- bf_left_clrstd = ex_probs(1, 1,2) / ex_probs(1, 1, 1);
- fprintf(fileID, 'BF_cl_rstd left = %.10f, BF_cl_rstd right = %.10f\n', bf_left_clrstd, bf_right_clrstd);
- fprintf(fileID, 'Prob NAcc-left-CL = %.10f, Prob NAcc-left-RSTD = %.10f\n', ex_probs(1, 1, 1), ex_probs(1, 1, 2));
- fprintf(fileID, 'Prob NAcc-right-CL = %.10f, Prob NAcc-right-RSTD = %.10f\n', ex_probs(1, 2, 1), ex_probs(1, 2, 2));
- fclose(fileID);
- cpm_savefig(fig1, fullfile('realdata_niv2012', 'fig1_niv.png'));
- %%
- % Example PRFs
- fig2 = figure('Position', [0, 0, 2000, 400]);
- ax(1) = subplot(1, 3, 1);
- plot_single_voxel(PRFs{1, 1, 13, 2}, 1, {'taupos', 'tauneg'}, {[], []}, {'taupos', 'tauneg'}, 1000, 'prior', true);
- real_params = cpm_get_true_parameters(PRFs{1, 1, 13, 2}.M.pE{1}, PRFs{1, 1, 13, 2}.M, PRFs{1, 1, 13, 2}.U);
- scatter(real_params.mu_tauneg, real_params.mu_taupos, ...
- 'filled', 'MarkerEdgeColor', [0.5 0.5 0.5], ...
- 'MarkerFaceColor', [1 1 1], 'LineWidth', 1.0);
- tp = -pi:0.01:pi;
- y_post =real_params.mu_taupos + 2 * real_params.width_taupos .* cos(tp);
- x_post = real_params.mu_tauneg + 2 * real_params.width_tauneg .* sin(tp);
- plot(x_post, y_post);
- xlabel('\tau^-');
- ylabel('\tau^+');
- xlim(PRFs{1, 1, 13, 2}.U(1).grid.taupos(1:2));
- ylim(PRFs{1, 1, 13, 2}.U(1).grid.tauneg(1:2));
- title("prior density")
- ax(2) = subplot(1, 3, 2);
- plot_single_voxel(PRFs{1, 1, 13, 2}, 1, {'taupos', 'tauneg'}, {[], []}, {'taupos', 'tauneg'}, 400, 'posterior', true);
- real_params = cpm_get_true_parameters(PRFs{1, 1, 13, 2}, 1);
- scatter(real_params.mu_tauneg, real_params.mu_taupos, ...
- 'filled', 'MarkerEdgeColor', [0.5 0.5 0.5], ...
- 'MarkerFaceColor', [1 1 1], 'LineWidth', 1.0);
- tp = -pi:0.01:pi;
- y_post =real_params.mu_taupos + 2 * real_params.width_taupos .* cos(tp);
- x_post = real_params.mu_tauneg + 2 * real_params.width_tauneg .* sin(tp);
- plot(x_post, y_post);
- xlabel('\tau^-');
- ylabel('\tau^+');
- xlim(PRFs{1, 1, 13, 2}.U(1).grid.taupos(1:2));
- ylim(PRFs{1, 1, 13, 2}.U(1).grid.tauneg(1:2));
- title("posterior predictive density")
- ax(3) = subplot(1, 3, 3);
- plot_single_voxel(PRFs{1, 1, 13, 2}, 1, {'taupos', 'tauneg'}, {[], []}, {'taupos', 'tauneg'}, 1000, 'response', true);
- real_params = cpm_get_true_parameters(PRFs{1, 1, 13, 2}, 1);
- scatter(real_params.mu_tauneg, real_params.mu_taupos, ...
- 'filled', 'MarkerEdgeColor', [0.5 0.5 0.5], ...
- 'MarkerFaceColor', [1 1 1], 'LineWidth', 1.0);
- tp = -pi:0.01:pi;
- y_post =real_params.mu_taupos + 2 * real_params.width_taupos .* cos(tp);
- x_post = real_params.mu_tauneg + 2 * real_params.width_tauneg .* sin(tp);
- plot(x_post, y_post);
- xlabel('\tau^-');
- ylabel('\tau^+');
- xlim(PRFs{1, 1, 13, 2}.U(1).grid.taupos(1:2));
- ylim(PRFs{1, 1, 13, 2}.U(1).grid.tauneg(1:2));
- title('population field')
- sgtitle("Estimated PRFs of best fitting participant (13), left NAcc")
- cpm_savefig(fig2, fullfile('realdata_niv2012', 'fig2_niv.png'));
- %%
- end
- function [cleanData, stimOns, rewardOns, rewards, ...
- chosen, rstdsig, tdsig, n_trials] = prep_data(sub_data, runs, dt, TR)
- cleanData = [];
- stimOns = [];
- rewardOns = [];
- rewards = [];
- chosen = [];
- rstdsig = [];
- tdsig = [];
- n_trials = 0;
- for run_idx = runs
- [n_times, n_voxels] = size(sub_data.TimeCourse{run_idx});
- nt = length(cleanData);
- % Very simple preprocessing: regressing out the motion parameter and a linear,
- % quadratic and an intercept term.
- regs = sub_data.Motion{run_idx};
- diff_motion = [zeros(1, size(regs, 2)); diff(regs)];
- intercept = ones(n_times, n_voxels);
- regs = [regs, [1:n_times]', [1:n_times]'.^2, diff_motion]; % , cs_onset', us_onset'];
- regs = [regs, intercept];
- [~, ~, cleanMRI, ~] = regress(sub_data.TimeCourse{run_idx}, regs);
- cleanData = [cleanData; cleanMRI];
- %% Create trial structrue
- % Onsets are already provided in micro time, we want them in seconds:
- stimOns = [stimOns, sub_data.CSonset{run_idx} .* dt + nt * TR]; % Converting to seconds
- rewardOns = [rewardOns, sub_data.USonset{run_idx} .* dt + nt * TR];
- rewards = [rewards, sub_data.Rewards{run_idx}];
- chosen = [chosen, sub_data.Chosen{run_idx}];
- n_trials = n_trials + length(sub_data.Trials{run_idx});
- stick = zeros(1, n_times);
- stick(ceil((sub_data.TDtimes{run_idx} * dt) ./ TR)) = sub_data.RSTDerr{run_idx};
- canonical_hrf = spm_hrf(TR);
- orig_td_signal = conv(stick, canonical_hrf);
- orig_td_signal = orig_td_signal(1:n_times);
- rstdsig = [rstdsig, orig_td_signal];
- stick = zeros(1, n_times);
- stick(ceil((sub_data.TDtimes{run_idx} * dt) ./ TR)) = sub_data.TDerr{run_idx};
- canonical_hrf = spm_hrf(TR);
- orig_td_signal = conv(stick, canonical_hrf);
- orig_td_signal = orig_td_signal(1:n_times);
- tdsig = [tdsig, orig_td_signal];
- end
- end
- function save_wrapper(PRF, out)
- save(out, 'PRF');
- end
realdata_niv2012.m at commit 3b06373, under GPL-3.0 · at the source
Overview
- Danish Research Centre for Magnetic Resonance, Department of Radiology and Nuclear Medicine, Copenhagen University Hospital Amager and Hvidovre, Copenhagen, Denmark
- Department of Physics, University of Trento, Trento, Italy
- Department of Basic Neuroscience, University of Geneva, Geneva, Switzerland
- London Mathematical Laboratory, London, United Kingdom
- Department of Psychology, University of Copenhagen, Copenhagen, Denmark
Abstract
Elucidating the neural basis of cognition requires theoretical models of cognition to constrain the modeling of neural data. A prevalent strategy in functional neuroimaging is to regress the latent variables of cognitive models onto neural data. Though widely used, this approach restricts the mapping of computational variables to single parameter values. We introduce computational parametric mapping (CPM), which builds on and generalizes the Bayesian population receptive field framework. CPM offers three main advances for cognitive computational modeling. First, it allows the fitting of cognitive models directly to neuroimaging data. Second, it allows for voxelwise or regionwise mapping of parameters of cognitive computational models onto the brain, thus making the topographic mapping methods prevalent in the sensory sciences available to the cognitive computational neuroscientist. Finally, it is efficient enough to make voxelwise mapping over large regions of interest feasible. Here, we illustrate how CPM can be used to fit reinforcement-learning algorithms to synthetic and real data.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 11 matches between paragraphs and lines of code.
ergEx/BayespRF_CPM
3b063739ab8422cb39ae70dcb93f91d956782ecc, 18 December 2024Availability: 1 check, the latest on 30 September 2026: the link answers
- 30 September 2026: the link answers
60 files
- SIMULATIONS/
auxiliary_td.m , MATLAB, 127 lines, 2 matches - SIMULATIONS/
realdata_niv2012.m , MATLAB, 454 lines, 3 matches - SIMULATIONS/
run_all.m , MATLAB, 34 lines - SIMULATIONS/
simulation_configs.m , MATLAB, 23 lines - SIMULATIONS/
simulations_samsrf.m , MATLAB, 348 lines - SIMULATIONS/
simulations_samsrf/ , MATLAB, 31 linescpm_grid_samsrf.m - SIMULATIONS/
simulations_td.m , MATLAB, 818 lines, 2 matches - SIMULATIONS/
simulations_td/ , MATLAB, 65 lines, 1 matchcode/ cpm_events_to_trials.m - SIMULATIONS/
simulations_td/ , MATLAB, 147 linescode/ cpm_td_learning.m - SIMULATIONS/
simulations_td/ , MATLAB, 109 linescode/ cpm_trials_to_csc.m - SIMULATIONS/
simulations_td/ , MATLAB, 23 linescode/ estimate_sd_for_snr.m - SIMULATIONS/
spm_int_speedup.m , MATLAB, 124 lines - cpm_tutorial.m, MATLAB, 223 lines
- example_3T/
scripts/ , MATLAB, 184 linesRun_first_level.m - example_3T/
scripts/ , MATLAB, 116 linesRun_pRF_analysis.m - example_3T/
scripts/ , MATLAB, 89 linesprepare_inputs_polar_sam srf.m - toolbox/
cpm/ , MATLAB, 61 linescpm_dummy_prf.m - toolbox/
cpm/ , MATLAB, 44 linescpm_get_true_parameters. m - toolbox/
cpm/ , MATLAB, 182 linescpm_precompute.m - toolbox/
cpm/ , MATLAB, 41 linescpm_predict.m - toolbox/
cpm/ , MATLAB, 48 linescpm_prepare_input_direct _model.m - toolbox/
cpm/ , MATLAB, 756 linescpm_prf_review.m - toolbox/
cpm/ , MATLAB, 42 linescpm_savefig.m - toolbox/
cpm/ , MATLAB, 71 linescpm_set_constraints.m - toolbox/
cpm/ , MATLAB, 68 linescpm_simulate.m - toolbox/
cpm/ , MATLAB, 63 linescpm_write_to_nifti.m - toolbox/
cpm/ , MATLAB, 172 linesplot_single_voxel.m - toolbox/
cpm/ , MATLAB, 108 linesspm_cpm_get_ppd.m - toolbox/
cpm/ , MATLAB, 194 linesspm_int_sparse.m - toolbox/
freesurfer/ , MATLAB, 32 linesRead_FreeSurfer.m - toolbox/
freesurfer/ , MATLAB, 12 linesfs_fread3.m - toolbox/
freesurfer/ , MATLAB, 124 linesfs_read_surf.m - toolbox/
freesurfer/ , MATLAB, 24 linesfscol.m - toolbox/
response_functions/ , MATLAB, 359 linesspm_cpm_fcn_direct.m - toolbox/
response_functions/ , MATLAB, 309 linesspm_cpm_fcn_fullparametr ic.m - toolbox/
response_functions/ , MATLAB, 396 lines, 1 matchspm_cpm_fcn_gaussian.m - toolbox/
response_functions/ , MATLAB, 355 linesspm_prf_fcn_DoG_polar.m - toolbox/
response_functions/ , MATLAB, 367 linesspm_prf_fcn_DoG_polar_an gled.m - toolbox/
response_functions/ , MATLAB, 359 linesspm_prf_fcn_DoG_polar_el lipse.m - toolbox/
response_functions/ , MATLAB, 322 linesspm_prf_fcn_gaussian_pol ar.m - toolbox/
response_functions/ , MATLAB, 334 linesspm_prf_fcn_gaussian_pol ar_angled.m - toolbox/
response_functions/ , MATLAB, 339 linesspm_prf_fcn_gaussian_pol ar_ellipse.m - toolbox/
response_functions/ , MATLAB, 144 linesspm_prf_fcn_template.m - toolbox/
spm_plot_quartiles.m , MATLAB, 63 lines - toolbox/
spm_prf_analyse.m , MATLAB, 894 lines - toolbox/
spm_prf_bpa_within_subje , MATLAB, 84 linesct.m - toolbox/
spm_prf_editor.m , MATLAB, 478 lines - toolbox/
spm_prf_export_samsrf.m , MATLAB, 134 lines - toolbox/
spm_prf_find_voxel.m , MATLAB, 37 lines - toolbox/
spm_prf_fx.m , MATLAB, 76 lines, 1 match - toolbox/
spm_prf_get_ppd.m , MATLAB, 102 lines - toolbox/
spm_prf_gx.m , MATLAB, 85 lines, 1 match - toolbox/
spm_prf_import_label.m , MATLAB, 76 lines - toolbox/
spm_prf_import_surface.m , MATLAB, 161 lines - toolbox/
spm_prf_plot_entropy.m , MATLAB, 139 lines - toolbox/
spm_prf_review.m , MATLAB, 706 lines - toolbox/
spm_prf_review_surface.m , MATLAB, 310 lines - toolbox/
spm_prf_summarise.m , MATLAB, 93 lines - LICENSE.txt, License, 674 lines
- README.md, Text, 179 lines
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;
- 58 scripts, each with its path and the digest of its content;
- 11 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
Datasets cited
- zenodo:163582, at Zenodo; found in “Data and Code Availability”
Data and Code Availability
All code for this study is available on Github https://
Reproduced under the paper's license (CC BY), from the paper cited above.
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, 30 September 2026: the first record
Recorded: type, language, journal, volume, pages, dates, 5 authors, 6 keywords, 3 funders, 25 references.
Cite
This paper
Steinkamp, S. R., Chaker, I., Hubert, F., Meder, D., & Hulme, O. J. (2026). Computational parametric mapping of functional neuroimaging data. Imaging neuroscience (Cambridge, Mass.), 4, IMAG.a.1130. https://
BibTeX
@article{steinkamp2026co
author = {Steinkamp, Simon R and Chaker, Iyadh and Hubert, Felix and Meder, David and Hulme, Oliver J},
title = {{Computational parametric mapping of functional neuroimaging data}},
journal = {Imaging neuroscience (Cambridge, Mass.)},
year = {2026},
month = mar,
volume = {4},
pages = {IMAG.a.1130},
publisher = {MIT Press},
issn = {2837-6056},
doi = {10.1162/
url = {https://
pmid = {41799677},
pmcid = {PMC12961307}
}
RIS
TY - JOUR
AU - Steinkamp, Simon R
AU - Chaker, Iyadh
AU - Hubert, Felix
AU - Meder, David
AU - Hulme, Oliver J
TI - Computational parametric mapping of functional neuroimaging data
T2 - Imaging neuroscience (Cambridge, Mass.)
J2 - Imaging Neurosci (Camb)
PY - 2026
DA - 2026/
VL - 4
SP - IMAG.a.1130
SN - 2837-6056
PB - MIT Press
DO - 10.1162/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1162/
"type": "article-journal",
"title": "Computational parametric mapping of functional neuroimaging data",
"container-title": "Imaging neuroscience (Cambridge, Mass.)",
"author": [
{
"family": "Steinkamp",
"given": "Simon R"
},
{
"family": "Chaker",
"given": "Iyadh"
},
{
"family": "Hubert",
"given": "Felix"
},
{
"family": "Meder",
"given": "David"
},
{
"family": "Hulme",
"given": "Oliver J"
}
],
"container-title-short":
"volume": "4",
"page": "IMAG.a.1130",
"DOI": "10.1162/
"PMID": "41799677",
"PMCID": "PMC12961307",
"ISSN": "2837-6056",
"publisher": "MIT Press",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
3,
4
]
]
}
}
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.1142 [code]
- Encoding neural representations of time-continuous stimulus-response transformations in the human brain with advanced deep neural networks.Journal: Imaging neuroscience (Cambridge, Mass.)In common: SPM, Statistics and Machine Learning Toolbox, fMRI, 3 references
- [2] doi:10.1007/s12021-025-09759-w [code]
- Limitations of Variational Laplace-Based Dynamic Causal Modelling for Multistable Cortical Circuits.Journal: NeuroinformaticsIn common: SPM, Statistics and Machine Learning Toolbox, 3 references
- [3] doi:10.1162/imag.a.1210 [code]
- Modeling 2D spatio-tactile population receptive fields of the fingertip in human primary somatosensory cortex.Journal: Imaging neuroscience (Cambridge, Mass.)In common: SPM, Image Processing Toolbox, Statistics and Machine Learning Toolbox, fMRI, 1 reference
- [4] doi:10.1038/s41593-026-02219-x [code]
- A neural signature of adaptive mentalization.Journal: Nature neuroscienceIn common: SPM, Image Processing Toolbox, Statistics and Machine Learning Toolbox, fMRI, 1 reference
- [5] doi:10.1371/journal.pbio.3003922 [code]
- Competing value signals impair reward-learning via dopaminergic mechanisms and increase exploration.Journal: PLoS biologyIn common: 4 references
- [6] doi:10.1038/s41586-026-10910-z [code]
- Psychedelics align brain activity with context.Journal: NatureIn common: SPM, Image Processing Toolbox, Statistics and Machine Learning Toolbox, fMRI, 1 reference
- [7] doi:10.1162/imag.a.1234 [code]
- Multiscale parcellation of dynamic causal models of the brain.Journal: Imaging neuroscience (Cambridge, Mass.)In common: SPM, Statistics and Machine Learning Toolbox, 2 references
- [8] doi:10.1162/imag.a.1250 [code]
- Dynamics-informed priors (DIP) for neural mass modelling.Journal: Imaging neuroscience (Cambridge, Mass.)In common: SPM, Statistics and Machine Learning Toolbox, 2 references
- [9] doi:10.1016/j.celrep.2026.117454 [code]
- Model-based and model-free valuation signals in the human brain vary markedly in relation to individual differences in behavioral control.Journal: Cell reportsIn common: SPM, Statistics and Machine Learning Toolbox, 2 references
- [10] doi:10.1162/netn.a.544 [code]
- Brain network reconfiguration during reward prediction error processing.Journal: Network neuroscience (Cambridge, Mass.)In common: fMRI, 3 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: 1 repository of the authors' code, each at its verified commit and with its license, 58 scripts, and 11 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:305ea6988df67ed5…
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.
