Skip to contents

Probability of recalling an item as a function of its lag from the previous recall, conditional on it being available for recall.

Usage

lag_crp(
  data,
  lag_key = "input",
  count_unique = FALSE,
  item_query = NULL,
  test_key = NULL,
  test = NULL
)

Arguments

data

Merged study and recall data.

lag_key

Name of column to use when calculating lag between recalled items.

count_unique

If TRUE, possible transitions of the same lag will only be incremented once per transition.

item_query

Query string to select items to include in the pool of possible recalls to be examined.

test_key

Name of column with labels to use when testing transitions for inclusion.

test

Function that takes in previous and current item values and returns TRUE for transitions that should be included.

Value

Results with subject, lag, prob, actual, and possible

columns. The prob column indicates conditional response probability. The actual column indicates the count of transitions actually made at a given lag. The possible column indicates the number of transitions that could have been made, given item availability (previously recalled items are excluded).

Examples

# All transitions included
raw <- sample_data("Morton2013")
data <- merge_free_recall(raw, study_keys = list("category"))
head(lag_crp(data))
#>   subject lag       prob actual possible
#> 1       1 -23 0.02083333      1       48
#> 2       1 -22 0.03571429      3       84
#> 3       1 -21 0.02631579      3      114
#> 4       1 -20 0.02400000      3      125
#> 5       1 -19 0.01438849      2      139
#> 6       1 -18 0.01219512      2      164

# Excluding the first three output positions (need to include non-recalled
# items specifically so they aren't excluded as possible items to recall)
head(lag_crp(data, item_query = "output > 3 or not recall"))
#>   subject lag       prob actual possible
#> 1       1 -23 0.00000000      0        1
#> 2       1 -22 0.20000000      1        5
#> 3       1 -21 0.00000000      0       21
#> 4       1 -20 0.03571429      1       28
#> 5       1 -19 0.02777778      1       36
#> 6       1 -18 0.01694915      1       59

# Including within-category transitions only
head(lag_crp(data, test_key = "category", test = function(x, y) x == y))
#>   subject lag       prob actual possible
#> 1       1 -23 0.04347826      1       23
#> 2       1 -22 0.05128205      2       39
#> 3       1 -21 0.05454545      3       55
#> 4       1 -20 0.05357143      3       56
#> 5       1 -19 0.01315789      1       76
#> 6       1 -18 0.02061856      2       97