psifr.fr.lag_rank#

psifr.fr.lag_rank(df, lag_key='input', item_query=None, test_key=None, test=None)#

Calculate rank of the absolute lags in free recall lists.

Parameters:
  • df (pandas.DataFrame) – Merged study and recall data. See merge_lists. List length is assumed to be the same for all lists within each subject. Must have fields: subject, list, input, output, recalled. Input position must be defined such that the first serial position is 1, not 0.

  • lag_key (str, optional) – Name of column to use when calculating lag between recalled items. Default is to calculate lag based on input position.

  • item_query (str, optional) – Query string to select items to include in the pool of possible recalls to be examined. See pandas.DataFrame.query for allowed format.

  • test_key (str, optional) – Name of column with labels to use when testing transitions for inclusion.

  • test (callable, optional) – Callable that takes in previous and current item values and returns True for transitions that should be included.

Returns:

stat – Has fields ‘subject’ and ‘rank’.

Return type:

pandas.DataFrame

See also

lag_crp

Conditional response probability by input lag.

Examples

>>> from psifr import fr
>>> raw = fr.sample_data('Morton2013')
>>> data = fr.merge_free_recall(raw)
>>> lag_rank = fr.lag_rank(data)
>>> lag_rank.head()
   subject      rank
0        1  0.610953
1        2  0.635676
2        3  0.612607
3        4  0.667090
4        5  0.643923