First, load some sample data and create a merged DataFrame:
In : from psifr import fr
In : df = fr.sample_data('Morton2013')
In : data = fr.merge_free_recall(df)
Raster plots can give you a quick overview of a whole dataset. We’ll look at
all of the first subject’s recalls. This will plot every individual recall,
colored by the serial position of the recalled item in the list. Items near
the end of the list are shown in yellow, and items near the beginning of the
list are shown in purple. Intrusions of items not on the list are shown in red.
In : subj = fr.filter_data(data, 1)
In : g = fr.plot_raster(subj).add_legend()
We can calculate average recall for each serial position
using spc() and plot using plot_spc().
In : recall = fr.spc(data)
In : g = fr.plot_spc(recall)
Using the same plotting function, we can plot the curve for each
In : g = fr.plot_spc(recall, col='subject', col_wrap=5)
We can also split up recalls, to test for example how likely participants
were to initiate recall with the last item on the list.
In : prob = fr.pnr(data)
In : prob
prob actual possible
subject output input
1 1 1 0.000000 0 48
2 0.020833 1 48
3 0.000000 0 48
4 0.000000 0 48
5 0.000000 0 48
... ... ... ...
47 24 20 NaN 0 0
21 NaN 0 0
22 NaN 0 0
23 NaN 0 0
24 NaN 0 0
[23040 rows x 3 columns]
This gives us the probability of recall by output position ('output')
and serial or input position ('input'). This is a lot to look at all
at once, so it may be useful to plot just the first three output positions.
We can plot the curves using plot_spc(), which takes an
optional hue input to specify a variable to use to split the data
into curves of different colors.
In : pfr = prob.query('output <= 3')
In : g = fr.plot_spc(pfr, hue='output').add_legend()
This plot shows what items tend to be recalled early in the recall sequence.