Skip to contents

Rank of transition distances.

Usage

distance_rank(
  data,
  index_key,
  distances,
  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.

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 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(data, "item_index", d$distances)
head(ranks)
#>   subject      rank
#> 1       1 0.6355710
#> 2       2 0.5714568
#> 3       3 0.6272815
#> 4       4 0.6375957
#> 5       5 0.6461814
#> 6       6 0.6002912