comp_prob_prob {riskyr} | R Documentation |
Compute probabilities from (3 essential) probabilities.
Description
comp_prob_prob
computes current probability information
from a sufficient and valid set of 3 essential probabilities
(prev
, and
sens
or its complement mirt
, and
spec
or its complement fart
).
It returns a list of 13 key probabilities (prob
)
as its output.
Usage
comp_prob_prob(
prev = prob$prev,
sens = prob$sens,
mirt = NA,
spec = prob$spec,
fart = NA,
tol = 0.01
)
Arguments
prev |
The condition's prevalence value |
sens |
The decision's sensitivity value |
mirt |
The decision's miss rate value |
spec |
The decision's specificity value |
fart |
The decision's false alarm rate |
tol |
A numeric tolerance value for |
Details
comp_prob_prob
is a wrapper function for the more basic
function comp_prob
.
Extreme probabilities (sets containing 2 or more
probabilities of 0 or 1) may yield unexpected values
(e.g., predictive values PPV
or NPV
turning NaN
when is_extreme_prob_set
evaluates to TRUE
).
Key relationships between frequencies and probabilities
(see documentation of comp_freq
or comp_prob
for details):
Three perspectives on a population:
by condition / by decision / by accuracy.
Defining probabilities in terms of frequencies:
Probabilities can be computed as ratios between frequencies, but beware of rounding issues.
Functions translating between representational formats:
-
comp_prob_prob
(defined here) is a wrapper function forcomp_prob
and an analog to 3 other format conversion functions: -
comp_prob_freq
computes current probability information contained inprob
from 4 essential frequencies (hi
,mi
,fa
,cr
). -
comp_freq_prob
computes current frequency information contained infreq
from 3 essential probabilities (prev
,sens
,spec
). -
comp_freq_freq
computes current frequency information contained infreq
from 4 essential frequencies (hi
,mi
,fa
,cr
).
Value
A list prob
containing 13 key probability values.
See Also
comp_freq_prob
computes current frequency information from (3 essential) probabilities;
comp_freq_freq
computes current frequency information from (4 essential) frequencies;
comp_prob_freq
computes current probability information from (4 essential) frequencies;
num
contains basic numeric variables;
init_num
initializes basic numeric variables;
freq
contains current frequency information;
comp_freq
computes current frequency information;
prob
contains current probability information;
comp_prob
computes current probability information;
comp_complement
computes a probability's complement;
comp_comp_pair
computes pairs of complements;
comp_complete_prob_set
completes valid sets of probabilities;
comp_min_N
computes a suitable population size N
(if missing).
Other functions computing frequencies:
comp_freq_freq()
,
comp_freq_prob()
,
comp_freq()
,
comp_min_N()
Other format conversion functions:
comp_freq_freq()
,
comp_freq_prob()
,
comp_prob_freq()
Examples
# Basics:
comp_prob_prob(prev = .11, sens = .88, spec = .77) # ok: PPV = 0.3210614
comp_prob_prob(prev = .11, sens = NA, mirt = .12, spec = NA, fart = .23) # ok: PPV = 0.3210614
comp_prob_prob() # ok, using current defaults
length(comp_prob_prob()) # 13 key probability values
# Ways to work:
comp_prob_prob(.99, sens = .99, spec = .99) # ok: PPV = 0.999898
comp_prob_prob(.99, sens = .90, spec = NA, fart = .10) # ok: PPV = 0.9988789
# Watch out for extreme cases:
comp_prob_prob(1, sens = 0, spec = 1) # ok, but with warnings (as PPV & FDR are NaN)
comp_prob_prob(1, sens = 0, spec = 0) # ok, but with warnings (as PPV & FDR are NaN)
comp_prob_prob(1, sens = 0, spec = NA, fart = 0) # ok, but with warnings (as PPV & FDR are NaN)
comp_prob_prob(1, sens = 0, spec = NA, fart = 1) # ok, but with warnings (as PPV & FDR are NaN)
comp_prob_prob(1, sens = 1, spec = 0) # ok, but with warnings (as NPV & FOR are NaN)
comp_prob_prob(1, sens = 1, spec = 1) # ok, but with warnings (as NPV & FOR are NaN)
comp_prob_prob(1, sens = 1, spec = NA, fart = 0) # ok, but with warnings (as NPV & FOR are NaN)
comp_prob_prob(1, sens = 1, spec = NA, fart = 1) # ok, but with warnings (as NPV & FOR are NaN)
# Ways to fail:
comp_prob_prob(NA, 1, 1, NA) # only warning: invalid set (prev not numeric)
comp_prob_prob(8, 1, 1, NA) # only warning: prev no probability
comp_prob_prob(1, 8, 1, NA) # only warning: sens no probability
comp_prob_prob(1, 1, 1, 1) # only warning: is_complement not in tolerated range