# comp_acc: Compute overall accuracy (acc) from probabilities. In riskyr: Rendering Risk Literacy more Transparent

## Description

`comp_acc` computes overall accuracy `acc` from 3 essential probabilities `prev`, `sens`, and `spec`.

## Usage

 `1` ```comp_acc(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`).

## Details

`comp_acc` uses probabilities (not frequencies) as inputs and returns a proportion (probability) without rounding.

Definition: `acc` is the overall accuracy as the proportion (or probability) of correctly classifying cases or of `dec.cor` cases:

`acc = dec.cor/N = (hi + cr)/(hi + mi + fa + cr)`

Values range from 0 (no correct prediction) to 1 (perfect prediction).

Importantly, correct decisions `dec.cor` are not necessarily positive decisions `dec.pos`.

## Value

Overall accuracy `acc` as a proportion (probability). A warning is provided for NaN values.

See `comp_accu` and `accu` for accuracy metrics based on 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`, `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`, `comp_accu`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20``` ```# ways to work: comp_acc(.10, .200, .300) # => acc = 0.29 comp_acc(.50, .333, .666) # => acc = 0.4995 # watch out for vectors: prev.range <- seq(0, 1, by = .1) comp_acc(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 # watch out for extreme values: comp_acc(1, 1, 1) # => 1 comp_acc(1, 1, 0) # => 1 comp_acc(1, 0, 1) # => 0 comp_acc(1, 0, 0) # => 0 comp_acc(0, 1, 1) # => 1 comp_acc(0, 1, 0) # => 0 comp_acc(0, 0, 1) # => 1 comp_acc(0, 0, 0) # => 0 ```

riskyr documentation built on Feb. 19, 2018, 5 p.m.