This repository contains the analysis workspace for the congenital prosopagnosia (CP) face-discrimination study described in the manuscript Altered use of stimulus history in face processing in congenital prosopagnosia.
The pipeline examines how face discrimination is shaped by:
- diagnostic group (
TDvsCP) - face race (
Own-RacevsOther-Race) - regression-to-the-mean condition (
biaspvsbiasm) - age
- recent and accumulated stimulus history
The repository includes:
- Weibull psychometric fitting
- d-prime / signal-detection analysis
- trial-level GLMM analysis
- bootstrap follow-up for peak-age estimates
- SPSS repeated-measures ANOVA follow-up
- histogram and range-based descriptive plots
- RTM correlation analyses
- updating-model analysis
The manuscript contains the full theoretical and methodological interpretation. The README is intended only as a compact guide to the repository structure and execution workflow.
Manuscript Contact: Bat-sheva Hadad - bhadad@edu.haifa.ac.il
Repository / Analysis Contact: Eitan Gelfand - eitan.gelfand@gmail.com
This project uses renv for R package version control.
renv::restore()The d-prime workflow is implemented in Python.
pip install -r requirements.txtShared plotting helpers are located in R/. Most figure scripts use:
source("R/setup_fonts.R")
setup_fonts()The helper selects a Times-like serif font when available and otherwise falls back to a system serif font.
Some analyses are independent, but the main derived-metric workflow is:
- Run the Weibull fitting script.
- Run the d-prime calculation script.
- Run downstream model-based and descriptive analyses that use those derived outputs.
weibull_analysis/- subject-level psychometric fitting and Weibull-derived metricsd-prime/- workflow for d-prime, criterion, and related summary outputsglmm_analysis/- trial-level GLMM analysis and bootstrap follow-upSPSS/- SPSS repeated-measures ANOVA syntax and short documentationrtm_corr/- correlation analyses linking RTM-related measureshisotgrams/- grouped summary plots for d-prime and PSErange_analysis/- accuracy-by-range descriptive plotstrail_updating_analysis/- updating-model analysis of recent vs accumulated historyR/- shared helpers for paths, fonts, and plotting themedata/- input and derived CSV files used by the analysis scriptsoutput/- generated figures and summary outputs
R/paths.R- centralized project pathsR/theme_pub.R- shared publication plotting themeR/setup_fonts.R- font setup for figures
-
weibull_analysis/Weibull_CP_experiment.Rmd- Fits Weibull functions by subject and condition.
- Generates psychometric parameters and prediction outputs used in downstream summaries.
- Main outputs:
data/weibull_trial_predictions.csvdata/weibull_metric_results.csvoutput/plots/Weibull_groups_by_race.pngoutput/plots/Weibull_groups_by_bias.png
-
d-prime/dprime_calculation.py- Computes d-prime, criterion, and related signal-detection outputs.
- Writes derived CSV files used by downstream scripts.
- Main outputs:
data/dprime_results_with_range.csvdata/dprime_results.csvoutput/plots/Dprime_summary.pngoutput/plots/CR_summary.pngoutput/plots/Bprime_summary.png
-
glmm_analysis/GLMM_CP.R- Main trial-level GLMM of accuracy.
- Tests effects of Group, Race, Regression condition, and age.
- Main visualization output:
output/plots/glmm_cp_.png
-
glmm_analysis/GLMM_CP_bootstrap.R- Bootstrap follow-up to the main GLMM.
- Evaluates stability of peak-age estimates from the modeled trajectories.
- Main outputs:
- bootstrap summary CSV/RDS files written to
output/
- bootstrap summary CSV/RDS files written to
-
trail_updating_analysis/last_trail_updating_analysis.R- Compares updating models based on the long-term average (
t-inf) and previous trial (t-1). - Main outputs:
output/updating_beta_results.csvoutput/last_trail_updating_analysis.png
- Compares updating models based on the long-term average (
-
SPSS/IBM SPSS Statistics - Code.sps- SPSS repeated-measures ANOVA syntax.
- Use after generating the d-prime and Weibull/PSE-derived metrics.
- See
SPSS/SPSS_repeated_measures_ANOVA.mdfor a short explanation of the model and factors.
-
hisotgrams/dprime_histograms.R- Subject-level d-prime grouped summaries by Group, Race, and Regression condition.
- Main visualization output:
output/plots/dprime_histogram.png
-
hisotgrams/dprime_young_sub_hist.R- Younger-subgroup version of the d-prime grouped summary.
- Main visualization output:
output/plots/dprime_histogram_young.png
-
hisotgrams/pse_histograms.R- Grouped PSE summaries based on the Weibull outputs.
- Main visualization output:
output/plots/pse_histogram.png
-
hisotgrams/dprime_cfmt_group.R- d-prime grouped summary split by CFMT subgroup.
- Main visualization output:
output/plots/dprime_cfmt_group.png
-
range_analysis/accXrange_CP_bias.R- Accuracy as a function of morph range, grouped by Race within Bias condition.
- Main visualization output:
output/plots/acc_range_CP_bias.png
-
range_analysis/accXrange_CP_race.R- Accuracy as a function of morph range, grouped by Bias condition within Race.
- Main visualization output:
output/plots/acc_range_CP_race.png
-
rtm_corr/rtm_correlation_cp.R- Correlates RTM magnitude with Bias- accuracy.
- Main visualization output:
output/plots/Correlation_biasM_vs_magnitude_CP.png
-
rtm_corr/dprime_rtm_corr.R- Correlates RTM magnitude with d-prime.
- Main visualization output:
output/plots/Correlation_dprime_biasM_vs_magnitude_CP.png
Run:
weibull_analysis/Weibull_CP_experiment.Rmdd-prime/dprime_calculation.py
These scripts generate the derived psychometric and signal-detection measures used later in the pipeline.
Run:
glmm_analysis/GLMM_CP.Rglmm_analysis/GLMM_CP_bootstrap.Rtrail_updating_analysis/last_trail_updating_analysis.R
Dependency note:
glmm_analysis/GLMM_CP_bootstrap.Ris a follow-up to the main GLMM and should be run afterglmm_analysis/GLMM_CP.R
Run as needed:
- files in
SPSS/repeated-measures ANOVA - scripts in
hisotgrams/ - scripts in
range_analysis/ - scripts in
rtm_corr/
Dependency note:
- The SPSS analysis should be run only after Stage 1, because it uses the derived d-prime and Weibull/PSE metrics.
SPSS/IBM SPSS Statistics - Code.spscontains the syntax, andSPSS/SPSS_repeated_measures_ANOVA.mdgives the short explanation.
These scripts are mostly parallel and can be run according to the figure or metric of interest.
The scripts expect CSV inputs in data/. The main files used across the repository are:
data/full_data_cp.csv- main trial-level accuracy datasetdata/updating_data_cp.csv- updating-analysis datasetdata/dprime_results.csv- d-prime summaries generated by the Python workflowdata/dprime_results_with_range.csv- d-prime values retaining the Range dimensiondata/weibull_metric_results.csv- subject-level Weibull outputs
Additional intermediate files are generated by the scripts themselves.
- In the Weibull analysis, one CP subject: (829) was excluded because below-chance performance did not allow a stable Weibull fit within a reasonable range; accordingly, two matched control (1704, 1700) subjects were also excluded.
| Parameter | Typical values | Role in the analysis |
|---|---|---|
Subject |
participant ID | Repeated-measures unit; random intercept / grouping unit across analyses |
Age |
continuous years | Main age-related predictor in the GLMM and age-based follow-up analyses |
Group |
TD, CP |
Between-subject diagnostic grouping |
ExperimentName |
Caucasian, Asian |
Face-race condition; interpreted as Own-Race vs Other-Race |
Regression |
biasp, biasm, sometimes Null |
RTM-related condition; biasp and biasm are the main discrimination conditions, while Null is used in the d-prime workflow for false-alarm estimation |
Range |
morph-distance levels | Stimulus-difficulty / perceptual-distance variable |
ACC |
0, 1 |
Trial-level accuracy outcome |
CFMTgroup |
typically L, H |
TD ability subgrouping used in selected follow-up summaries |
New_tinf |
numeric | Updating-model term reflecting accumulated / long-term stimulus history |
New_t1 |
numeric | Updating-model term reflecting recent-history contribution from the previous trial |
The repository generates publication-oriented figures in output/plots/ and output/. Main examples include:
- GLMM age-trajectory figure:
output/plots/glmm_cp_.png - Weibull summary figures:
output/plots/Weibull_groups_by_race.png,output/plots/Weibull_groups_by_bias.png - Histogram summaries:
output/plots/dprime_histogram.png,output/plots/dprime_histogram_young.png,output/plots/pse_histogram.png,output/plots/dprime_cfmt_group.png - Range-based descriptive figures:
output/plots/acc_range_CP_bias.png,output/plots/acc_range_CP_race.png - Correlation figures:
output/plots/Correlation_biasM_vs_magnitude_CP.png,output/plots/Correlation_dprime_biasM_vs_magnitude_CP.png - Updating-model figure:
output/last_trail_updating_analysis.png
renv::snapshot() # Capture current state
renv::restore() # Restore to locked stateRepository R version stored in renv.lock:
R 4.5.2
pip install -r requirements.txtLocal Python version in this environment:
Python 3.14.3
Key Python packages are pinned in requirements.txt.
The repository uses local path helpers in R/paths.R, so scripts can be run either from the project root or from their own subdirectories.
The analytical methods, theoretical background, hypotheses, and full discussion of results are presented in the associated manuscript. This repository is intended to support reproducibility and transparency of the quantitative analyses.
To understand the research questions and scientific context, please consult the authors.
This repository is licensed under the MIT License.
Last Updated: April 2026