psifr.fr.pnr#

psifr.fr.pnr(df, item_query=None, test_key=None, test=None)#

Probability of recall by serial position and output position.

Calculate probability of Nth recall, where N is each output position. Invalid recalls (repeats and intrusions) are ignored and not counted toward output position.

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, study, recall. Input position must be defined such that the first serial position is 1, not 0.

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

prob – Analysis results. Has fields: subject, output, input, prob, actual, possible. The prob column for output x and input y indicates the probability of recalling input position y at output position x. The actual and possible columns give the raw tallies for how many times an event actually occurred and how many times it was possible given the recall sequence.

Return type:

pandas.DataFrame

See also

plot_spc

Plot recall probability as a function of serial position.

spc

Overall recall probability by serial position.

Examples

>>> from psifr import fr
>>> raw = fr.sample_data('Morton2013')
>>> data = fr.merge_free_recall(raw)
>>> fr.pnr(data)
       subject  output  input      prob  actual  possible
0            1       1      1  0.000000       0        48
1            1       1      2  0.020833       1        48
2            1       1      3  0.000000       0        48
3            1       1      4  0.000000       0        48
4            1       1      5  0.000000       0        48
...        ...     ...    ...       ...     ...       ...
23035       47      24     20       NaN       0         0
23036       47      24     21       NaN       0         0
23037       47      24     22       NaN       0         0
23038       47      24     23       NaN       0         0
23039       47      24     24       NaN       0         0

[23040 rows x 6 columns]