cueAccuracy: Calculate the accuracy of using a cue to predict a criterion.

View source: R/cue_validity.R

cueAccuracyR Documentation

Calculate the accuracy of using a cue to predict a criterion.

Description

cueValidity counts only correct and incorrect inferences, ignoring cases where a cue does not discriminate. Cue accuracy gives those cases a weight of 0.5, the expected accuracy of guessing. It is calculated as (correct + 0.5 * guesses) / (correct + incorrect + guesses).

Usage

cueAccuracy(criterion, cue, replaceNanWith = 0.5)

Arguments

criterion

A vector of values to be predicted.

cue

A vector of values to predict with. Should have the same length as the criterion.

replaceNanWith

The value to return as cue validity in case it cannot be calculated, e.g. no variance in the values.

Value

The cue accuracy, a value in the range [0,1].

See Also

cueValidity for an alternate measure used in Take The Best.

Examples

cueValidity(c(5,1), c(1,0))
cueAccuracy(c(5,1), c(1,0))
# Both return 1.
cueValidity(c(5,2,1), c(1,0,0))
cueAccuracy(c(5,2,1), c(1,0,0))
# Cue validity still returns 1 but cue accuracy returns (2+0.5)/3 = 0.833.

jeanimal/heuristica documentation built on Feb. 3, 2024, 9:56 p.m.