psifr.fr.lag_crp#

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

Lag-CRP for multiple subjects.

Parameters:
  • df (pandas.DataFrame) – Merged study and recall data. See merge_lists. List length is assumed to be the same for all lists. 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.

  • count_unique (bool, optional) – If true, possible transitions of the same lag will only be incremented once per transition.

  • 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:

results – Has fields:

subjecthashable

Results are separated by each subject.

lagint

Lag of input position between two adjacent recalls.

probfloat

Probability of each lag transition.

actualint

Total of actual made transitions at each lag.

possibleint

Total of times each lag was possible, given the prior input position and the remaining items to be recalled.

Return type:

pandas.DataFrame

See also

lag_rank

Rank of the absolute lags in recall sequences.

Examples

>>> from psifr import fr
>>> raw = fr.sample_data('Morton2013')
>>> data = fr.merge_free_recall(raw)
>>> fr.lag_crp(data)
      subject   lag      prob  actual  possible
0           1 -23.0  0.020833       1        48
1           1 -22.0  0.035714       3        84
2           1 -21.0  0.026316       3       114
3           1 -20.0  0.024000       3       125
4           1 -19.0  0.014388       2       139
...       ...   ...       ...     ...       ...
1875       47  19.0  0.061224       3        49
1876       47  20.0  0.055556       2        36
1877       47  21.0  0.045455       1        22
1878       47  22.0  0.071429       1        14
1879       47  23.0  0.000000       0         6

[1880 rows x 5 columns]