comp_err computes overall error rate err from 3 essential probabilities prev, sens, and spec.

comp_err(prev, sens, spec)

Arguments

prev

The condition's prevalence prev (i.e., the probability of condition being TRUE).

sens

The decision's sensitivity sens (i.e., the conditional probability of a positive decision provided that the condition is TRUE).

spec

The decision's specificity value spec (i.e., the conditional probability of a negative decision provided that the condition is FALSE).

Value

Overall error rate err as a probability (proportion). A warning is provided for NaN values.

Details

comp_err uses comp_acc to compute err as the complement of acc:

err = 1 - acc

See comp_acc and acc for further details and accu for other accuracy metrics and several possible interpretations of accuracy.

See also

comp_acc computes overall accuracy acc from probabilities; accu lists all accuracy metrics; comp_accu_prob computes exact accuracy metrics from probabilities; comp_accu_freq computes accuracy metrics from frequencies; comp_sens and comp_PPV compute related probabilities; is_extreme_prob_set verifies extreme cases; comp_complement computes a probability's complement; is_complement verifies probability complements; comp_prob computes current probability information; prob contains current probability information; is_prob verifies probabilities.

Other functions computing probabilities: comp_FDR(), comp_FOR(), comp_NPV(), comp_PPV(), comp_accu_freq(), comp_accu_prob(), comp_acc(), comp_comp_pair(), comp_complement(), comp_complete_prob_set(), comp_fart(), comp_mirt(), comp_ppod(), comp_prob_freq(), comp_prob(), comp_sens(), comp_spec()

Other metrics: accu, acc, comp_accu_freq(), comp_accu_prob(), comp_acc(), err

Examples

# ways to work:
comp_err(.10, .200, .300)  # => err = 0.71
#> [1] 0.71
comp_err(.50, .333, .666)  # => err = 0.5005
#> [1] 0.5005

# watch out for vectors:
prev.range <- seq(0, 1, by = .1)
comp_err(prev.range, .5, .5)  # => 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5
#>  [1] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5

# watch out for extreme values:
comp_err(1, 1, 1)  #  => 0
#> [1] 0
comp_err(1, 1, 0)  #  => 0
#> [1] 0

comp_err(1, 0, 1)  #  => 1
#> [1] 1
comp_err(1, 0, 0)  #  => 1
#> [1] 1

comp_err(0, 1, 1)  #  => 0
#> [1] 0
comp_err(0, 1, 0)  #  => 1
#> [1] 1

comp_err(0, 0, 1)  #  => 0
#> [1] 0
comp_err(0, 0, 0)  #  => 1
#> [1] 1