get_perf: Calculate Luce choice (proportion correct) for each item in a...

View source: R/evaluation.R

get_perfR Documentation

Calculate Luce choice (proportion correct) for each item in a model knowledge matrix

Description

This function computes the Luce choice, or the proportion of correct selections, for each item in a given model knowledge matrix. It assesses the probability of correctly identifying each referent based on the knowledge matrix, providing a measure of model performance per item.

Usage

get_perf(m, d = NULL)

Arguments

m

A square matrix representing the model's knowledge, where rows correspond to words and columns correspond to referents. The diagonal elements represent correct associations, and off-diagonal elements represent incorrect associations.

d

Exponent for exponentiated choice rule

Details

Negative associations (possible in error-driven models such as rescorla_wagner() and kalman_filter()) are treated as 0 before the choice rule is applied – Luce choice is undefined for negative values, and would otherwise yield "probabilities" outside [0, 1] – matching predict_referent(). A word whose associations are then all 0 is answered at chance (1 / ncol(m)).

Value

A named numeric vector where each element corresponds to an item in the matrix. The value of each element represents the proportion of correct selections (Luce choice) for that item, calculated as the ratio of the correct association (diagonal element) to the total associations for that item.

Examples

x <- xsl_run(baseline(), get_example_ambiguous_condition())
mat <- x$fits[[1]]$matrix
get_perf(mat)

XSLmodels documentation built on Oct. 18, 2026, 5:08 p.m.