Skip to contents

Response probability as a function of the lag of current and prior transitions, conditional on item availability.

Usage

lag_crp_compound(
  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, previous, current, 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 combination of previous and current lags. The possible column indicates the number of transitions that could have been made, given item availability (previously recalled items are excluded).

Examples

# Create short example list with three recalls
subjects <- list(1)
study <- list(list("absence", "hollow", "pupil", "fountain"))
recall <- list(list("fountain", "hollow", "absence"))
raw <- table_from_lists(subjects, study, recall)
data <- merge_free_recall(raw)

# Display compound CRP for previous lags of -3 and -2
head(lag_crp_compound(data), 14)
#>    subject previous current prob actual possible
#> 1        1       -3      -3  NaN      0        0
#> 2        1       -3      -2  NaN      0        0
#> 3        1       -3      -1  NaN      0        0
#> 4        1       -3       0  NaN      0        0
#> 5        1       -3       1  NaN      0        0
#> 6        1       -3       2  NaN      0        0
#> 7        1       -3       3  NaN      0        0
#> 8        1       -2      -3  NaN      0        0
#> 9        1       -2      -2  NaN      0        0
#> 10       1       -2      -1    1      1        1
#> 11       1       -2       0  NaN      0        0
#> 12       1       -2       1    0      0        1
#> 13       1       -2       2  NaN      0        0
#> 14       1       -2       3  NaN      0        0