Code and data from: Representational geometry explains puzzling error distributions in behavioral tasks
Data files
Jan 28, 2025 version files 1.96 MB
-
Dryad_code_for_Wei_and_Woodford_PNAS_2025_Jan_26.zip
1.64 MB
-
error_tensor.mat.zip
314.84 KB
-
README.md
5.19 KB
Abstract
Measuring and interpreting errors in behavioral tasks is critical for understanding cognition. Conventional wisdom assumes that encoding/decoding errors for continuous variables in behavioral tasks should naturally have Gaussian distributions, so that deviations from normality in the empirical data indicate the presence of more complex sources of noise. This line of reasoning has been central for prior research on working memory. Here we re-assess this assumption, and find that even in ideal observer models with Gaussian encoding noise, the error distribution is generally non-Gaussian, contrary to the commonly held belief. Critically, we find that the shape of the error distribution is determined by the geometrical structure of the encoding manifold via a simple rule. In the case of a high-dimensional geometry, the error distributions naturally exhibit flat tails. Using this novel insight, we apply our theory to visual short-term memory tasks, and find that it can account for a large array of experimental data with only two free parameters.
Our results challenge the dominant view in the mechanisms and capacity constraints of working memory systems, and instead suggest that the Bayesian framework, which explains various aspects of perceptual behavior, also provides an excellent account of working memory.
Overall, our results establish a new and direct connection between neural manifold geometry and behavior, and call attention to the geometry of the representation as a critically important, yet underappreciated factor in determining the character of errors in human behavior.
README: Code and data from: Representational geometry explains puzzling error distributions in behavioral tasks
https://doi.org/10.5061/dryad.hx3ffbgq9
Description of the data and file structure
This file contains information for using the MATLAB code associated with the paper entitled “Representational geometry explains puzzling error distributions in behavioral tasks” by Wei & Woodford, PNAS, 2025.
Section 1: Explanations of the Datasets used in this paper
No new experimental data were collected in this study. The analyses in the present study were based on several previously published datasets (from Refs 1,2,3,4,5; see the reference list below) collected in other labs.
The data in Ref 1 can be downloaded from https://osf.io/j2h65/?view_only=fdd51dd775a945508c7cbbf25b662692
The data in Refs 2,3,4,5 can also be downloaded from https://github.com/WeiJiMaLab/delayed_estimation_benchmark/tree/master/data
Please refer to the original publications for detailed experiment procedures for the data collection.
References:
1. MW Schurgin, JT Wixted, TF Brady, Psychophysical scaling reveals a unified theory of visual memory strength. Nature Human Behaviour 4, 1156–1172 (2020).
2. W Zhang, SJ Luck, Discrete fixed-resolution representations in visual working memory. Nature 453, 233–235 (2008).
3. Van den Berg, H Shin, WC Chou, R George, WJ Ma, Variability in encoding precision accounts for visual short-term memory limitations. Proceedings National Academy Sciences 109, 8780–8785 (2012).
4. PM Bays, RF Catalao, M Husain, The precision of visual working memory is set by allocation of a shared resource. Journal of Vision 9, 7–7 (2009).
5. RL Rademaker, CH Tredway, F Tong, Introspective judgments predict the precision and likelihood of successful maintenance of visual working memory. Journal of Vision 12, 21–21 (2012)
Section 2: Code/Software/simulated data
The analysis code was written in software MATLAB.
(A) The model generated predicted error distributions for different combinations of parameters. The predictions are stored in the following data file: error_tensor.mat.zip
Unzip the file would result in the following data file:
“error_tensor.mat”, which stored the simulated data in an 21 *41 *360 tensor.
(B) The code is organized according the list of figures reported in the paper. Each sub-folder contains the code/scripts for reproducing the analysis of that particular figure. The scripts are stored in the zip file "Dryad_code_for_Wei_and_Woodford_PNAS_2025_Jan_26.zip".
These files are summarized below:
~/binning_function.m: a function that bins an error vector into an error histogram
~/noise_distribution2.m: a function that simulate the error distributions for an arbitrary noise parameter (kappa) and an arbitray noise level.
~/Figure 1/Fig1_geometry.m: a file that simulates figure panels in Figure 1.
~/Figure 2/Fig2_panels_e_to_h.m: a file that simulates Figure 2 panels e to h.
~/Figure 2/Fig2_panles_a_to_d.m: a file that simulates Figure 2 panels a to d.
~/Figure 3/Fig3_panel_a.m: a file that generates panel a of Figure 3.
~/Figure 3/Fig3_panel_b.m: a file that generates panel b of Figure 3.
~/Figure 3/simulate_error_density.m: a function that simulates error distribution for different combinations of parameters.
~/Figure 3/Generation_error_data_for_fitting.m: a file that generate the simtulated data by using function “simulate_error_density.m”.
~/Figure 4/Fig4_color: a file that generates panels in Figure 4.
~/Figure 5/Fig5_orientation: a file that generates panels in Figure 5.
~/Figure 6/twoAFC_predicting_NAFC.m: a file that generates Figure 6.
~/SI_fig 1_simulation_geometry and tuning/FigS1_different_tuning_same_geometry.m: a file that generates SI Figure 1.
~/SI_fig 2_convolution/FigS2_kappa_and_geometry.m: a file that generates SI Figure 2.
~/SI_fig 3_mixture of tuning widths/FigS3_RD_mixed_kappa.m: a file that generates SI Figure 3.
~/SI_fig 4_dimensionality/FigS4_dimensionality.m: a file that generates SI Figure 4.
~/SI_fig 5_noise and decaying constant/FigS5_sigma_and_slope.m: a file that generates SI Figure 5.
~/SI_Fig 6_power law/FigS6_powerLaw.m: a file that generates SI Figure 6.
~/SI_Fig 7_Fit to older color data/FigS7.m: a file that generates SI Figure 7.
~/SI_Fig 7_Fit to older color data/MaximumLikelihoodFitToDataFixedKappa: a function that fits our model to the data by assuming a given geometry paramter.
~/SI_Fig 8_noise and dprime/FigS8.m: a file that generates SI Figure 8.
(C) There are a few functions that are useful to multiple figures. These functions are contained in files binning_function.m, noise_distribution2.m.
If the code file for a certain figure cannot run properly, please check if these functions are included in the path.
Some figures involve data analysis. Please make sure the code has access to the relevant data files described above when running the code.
Methods
No new data were collected in this study. The analyses in this study were based on several previously published datasets collected from other labs. For convenience, we have included these published datasets here. Please refer to the original publications for detailed experiment procedures for the data collection.