comp_PPV computes the positive predictive value PPV from 3 essential probabilities prev, sens, and spec.

comp_PPV(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

The positive predictive value PPV as a probability. A warning is provided for NaN values.

Details

comp_PPV uses probabilities (not frequencies) and does not round results.

See also

comp_sens and comp_NPV 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_accu_freq(), comp_accu_prob(), comp_acc(), comp_comp_pair(), comp_complement(), comp_complete_prob_set(), comp_err(), comp_fart(), comp_mirt(), comp_ppod(), comp_prob_freq(), comp_prob(), comp_sens(), comp_spec()

Examples

# (1) Ways to work:
comp_PPV(.50, .500, .500)  # => PPV = 0.5
#> [1] 0.5
comp_PPV(.50, .333, .666)  # => PPV = 0.499
#> [1] 0.4992504

# (2) Watch out for vectors:
prev <- seq(0, 1, .1)
comp_PPV(prev, .5, .5)  # => without NaN values
#>  [1] 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
comp_PPV(prev,  0,  1)  # => with NaN values
#> Warning: PPV is NaN.
#>  [1] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

# (3) Watch out for extreme values:
comp_PPV(prev = 1, sens = 0, spec = .5)  # => NaN, only mi: hi = 0 and fa = 0: PPV = 0/0 = NaN
#> Warning: PPV is NaN.
#> [1] NaN
is_extreme_prob_set(prev = 1, sens = 0, spec = .5)  # => verifies extreme cases
#> Warning: Extreme case (prev = 1 & sens = 0):
#>   N mi (FN) cases; 0 cond_false or dec_true cases; PPV = NaN.
#> [1] TRUE

comp_PPV(prev = 0, sens = .5, spec = 1)  # => NaN, only cr: hi = 0 and fa = 0: PPV = 0/0 = NaN
#> Warning: PPV is NaN.
#> [1] NaN
is_extreme_prob_set(prev = 0, sens = .5, spec = 1)  # => verifies extreme cases
#> Warning: Extreme case (prev = 0 & spec = 1):
#>   N cr (TN) cases; 0 cond_true or dec_false cases; NPV = NaN.
#> [1] TRUE

comp_PPV(prev = .5, sens = 0, spec = 1)  # => NaN, only cr: hi = 0 and fa = 0: PPV = 0/0 = NaN
#> Warning: PPV is NaN.
#> [1] NaN
is_extreme_prob_set(prev = .5, sens = 0, spec = 1)  # => verifies extreme cases
#> Warning: Extreme case (sens = 0 & spec = 1):
#>   0 hi (TP) and 0 fa (FP) cases; 0 dec_pos cases; PPV = NaN.
#> [1] TRUE