psifr.fr.lag_crp_compound#

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

Conditional response probability by lag of current and prior transitions.

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.

previousint

Lag of the previous transition.

currentint

Lag of the current transition.

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_crp

Conditional response probability by lag.

Examples

>>> from psifr import fr
>>> subjects = [1]
>>> study = [['absence', 'hollow', 'pupil', 'fountain']]
>>> recall = [['fountain', 'hollow', 'absence']]
>>> raw = fr.table_from_lists(subjects, study, recall)
>>> data = fr.merge_free_recall(raw)
>>> crp = fr.lag_crp_compound(data)
>>> crp.head(14)
    subject  previous  current  prob  actual  possible
0         1        -3       -3   NaN       0         0
1         1        -3       -2   NaN       0         0
2         1        -3       -1   NaN       0         0
3         1        -3        0   NaN       0         0
4         1        -3        1   NaN       0         0
5         1        -3        2   NaN       0         0
6         1        -3        3   NaN       0         0
7         1        -2       -3   NaN       0         0
8         1        -2       -2   NaN       0         0
9         1        -2       -1   1.0       1         1
10        1        -2        0   NaN       0         0
11        1        -2        1   0.0       0         1
12        1        -2        2   NaN       0         0
13        1        -2        3   NaN       0         0