Skip to contents

Rank of transition distances, shifted by recall lag.

Usage

distance_rank_shifted(
  data,
  index_key,
  distances,
  max_shift,
  item_query = NULL,
  test_key = NULL,
  test = NULL
)

Arguments

data

Merged study and recall data.

index_key

Name of column containing the index of each item in the distances matrix.

distances

Items x items matrix of pairwise distances.

max_shift

Maximum number of items back for which to rank distances.

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, shift, and rank columns. A rank of 1 indicates that the smallest distance transition was always made, while 0.5 indicates chance clustering, and 0 indicates that the largest distance transition was always made.

Examples

# Load data and item-item distances
raw <- sample_data("Morton2013")
data <- merge_free_recall(raw)
d <- sample_distances("Morton2013")

# Calculate distance rank
data$item_index <- pool_index(data$item, d$items)
ranks <- distance_rank_shifted(data, "item_index", d$distances, max_shift = 3)
head(ranks)
#>   subject shift      rank
#> 1       1    -3 0.5234261
#> 2       1    -2 0.5591991
#> 3       1    -1 0.6343924
#> 4       2    -3 0.4759309
#> 5       2    -2 0.5075738
#> 6       2    -1 0.5687566