psifr.fr.category_crp#
- psifr.fr.category_crp(df, category_key, item_query=None, test_key=None, test=None)#
Conditional response probability of within-category transitions.
- 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.
category_key (str) – Name of column with category labels.
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.
- 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:
Examples
>>> from psifr import fr >>> raw = fr.sample_data('Morton2013') >>> data = fr.merge_free_recall(raw, study_keys=['category']) >>> cat_crp = fr.category_crp(data, 'category') >>> cat_crp.head() subject prob actual possible 0 1 0.801147 419 523 1 2 0.733456 399 544 2 3 0.763158 377 494 3 4 0.814882 449 551 4 5 0.877273 579 660