Learn R Programming

FFTrees (version 1.7.0)

add_stats: Add decision statistics to data (containing counts of a 2x2 contingency table)

Description

add_stats assumes the input of essential 2x2 frequency counts (as a data frame data with variable names "hi", "fa", "mi", and "cr") and uses them to compute various decision accuracy measures.

Usage

add_stats(
  data,
  sens.w = 0.5,
  cost.each = NULL,
  cost.outcomes = list(hi = 0, fa = 1, mi = 1, cr = 0)
)

Value

A data frame with variables of computed accuracy and cost measures (but dropping inputs).

Arguments

data

A data frame with (integer) values named "hi", "fa", "mi", and "cr".

sens.w

numeric. Sensitivity weight (for computing weighted accuracy, wacc).

cost.each

numeric. An optional fixed cost added to all outputs (e.g.; the cost of the cue).

cost.outcomes

list. A list of length 4 named "hi", "fa", "mi", "cr", and specifying the costs of a hit, false alarm, miss, and correct rejection, respectively. E.g.; cost.outcomes = listc("hi" = 0, "fa" = 10, "mi" = 20, "cr" = 0) means that a false alarm and miss cost 10 and 20 units, respectively, while correct decisions incur no costs.

Details

Providing numeric values for cost.each (as a vector) and cost.outcomes (as a named list) allows computing cost information for the counts of corresponding classification decisions.