psifr.fr.merge_lists#

psifr.fr.merge_lists(study, recall, merge_keys=None, list_keys=None, study_keys=None, recall_keys=None, position_key='position')#

Merge study and recall events together for each list.

Parameters:
  • study (pandas.DataFrame) – Information about all study events. Should have one row for each study event.

  • recall (pandas.DataFrame) – Information about all recall events. Should have one row for each recall attempt.

  • merge_keys (list, optional) – Columns to use to designate events to merge. Default is [‘subject’, ‘list’, ‘item’], which will merge events related to the same item, but only within list.

  • list_keys (list, optional) – Columns that apply to both study and recall events.

  • study_keys (list, optional) – Columns that only apply to study events.

  • recall_keys (list, optional) – Columns that only apply to recall events.

  • position_key (str, optional) – Column indicating the position of each item in either the study list or the recall sequence.

Returns:

merged – Merged information about study and recall events. Each row corresponds to one unique input/output pair.

The following columns will be added:

inputint

Position of each item in the input list (i.e., serial position).

outputint

Position of each item in the recall sequence.

studybool

True for rows corresponding to a unique study event.

recallbool

True for rows corresponding to a unique recall event.

repeatint

Number of times this recall event has been repeated (0 for the first recall of an item).

intrusionbool

True for recalls that do not correspond to any study event.

Return type:

pandas.DataFrame

See also

merge_free_recall

Score standard free recall data.

Examples

>>> import pandas as pd
>>> from psifr import fr
>>> study = pd.DataFrame(
...    {'subject': [1, 1], 'list': [1, 1], 'position': [1, 2], 'item': ['a', 'b']}
... )
>>> recall = pd.DataFrame(
...    {'subject': [1], 'list': [1], 'position': [1], 'item': ['b']}
... )
>>> fr.merge_lists(study, recall)
   subject  list item  input  output  study  recall  repeat  intrusion
0        1     1    a      1     NaN   True   False       0      False
1        1     1    b      2     1.0   True    True       0      False