Code
import os
import matplotlib.pyplot as plt
import warnings
from jaxcmr.analyses.crp import plot_crp
from jaxcmr.helpers import find_project_root, generate_trial_mask, load_data, save_figure
warnings.filterwarnings("ignore")Quantify the tendency to recall items studied in nearby positions.
The lag-conditional response probability (Lag-CRP) measures how the probability of recalling an item depends on its serial lag from the previously recalled item. Serial lag is the difference in study positions: if the previous recall was studied at position \(X\) and the current recall at position \(Y\), then lag \(\ell = Y - X\). Negative lags indicate backward transitions; positive lags indicate forward transitions.
\[\text{CRP}(\ell) = \frac{\text{actual transitions at lag } \ell}{\text{available transitions at lag } \ell}\]
At each recall step after the first, the set of available lags is determined by which study positions have not yet been recalled. The measure aggregates actual and available transition counts across trials before computing the ratio.
The x-axis shows serial lag and the y-axis shows the conditional probability of making a transition at that lag. Key patterns to look for:
data_path — path to an HDF5 file containing a RecallDataset.figure_dir — directory for saving figures.figure_str — base filename for the saved figure. Leave empty to display without saving.ylim — y-axis limits as a tuple, or None for automatic scaling.trial_query — a Python expression evaluated against the dataset to select trials.max_lag — maximum lag to display on the x-axis.size — maximum number of study positions a single item can occupy. Use 1 for lists with no repeated items.confidence_level — confidence level for subject-wise error bars.To compare conditions, pass multiple datasets and masks directly to plot_crp:
For lists with no repeated items, simple_crp provides a lighter-weight alternative that operates on serial-position-coded recall arrays.