is_valid_prob_set
is a function that verifies that
a set of (3 to 5) numeric inputs can be interpreted as a
valid set of (3 essential and 2 optional) probabilities.
Arguments
- prev
The condition's prevalence
prev
(i.e., the probability of condition beingTRUE
).- sens
The decision's sensitivity
sens
(i.e., the conditional probability of a positive decision provided that the condition isTRUE
).sens
is optional when its complementmirt
is provided.- mirt
The decision's miss rate
mirt
(i.e., the conditional probability of a negative decision provided that the condition isTRUE
).mirt
is optional when its complementsens
is provided.- spec
The decision's specificity value
spec
(i.e., the conditional probability of a negative decision provided that the condition isFALSE
).spec
is optional when its complementfart
is provided.- fart
The decision's false alarm rate
fart
(i.e., the conditional probability of a positive decision provided that the condition isFALSE
).fart
is optional when its complementspec
is provided.- tol
A numeric tolerance value used by
is_complement
.
Details
is_valid_prob_set
is a wrapper function that combines
is_prob
, is_suff_prob_set
,
and is_complement
in one function.
While no alternative input option for frequencies is provided,
specification of the essential probability prev
is always necessary. However, for 2 other essential
probabilities there is a choice:
The argument tol
is optional (with a default value of .01)
and used as the tolerance value of is_complement
.
is_valid_prob_set
verifies the validity of inputs,
but does not compute or return numeric variables.
Use is_extreme_prob_set
to verify sets of probabilities
that describe extreme cases and init_num
for initializing basic parameters.
See also
is_valid_prob_pair
verifies that probability pairs are complements;
is_prob
verifies probabilities;
prob
contains current probability information;
num
contains basic numeric variables;
init_num
initializes basic numeric variables;
comp_prob
computes current probability information;
freq
contains current frequency information;
comp_freq
computes current frequency information;
as_pc
displays a probability as a percentage;
as_pb
displays a percentage as probability.
Other verification functions:
is_complement()
,
is_extreme_prob_set()
,
is_freq()
,
is_integer()
,
is_matrix()
,
is_perc()
,
is_prob()
,
is_suff_prob_set()
,
is_valid_prob_pair()
,
is_valid_prob_triple()
Examples
# ways to succeed:
is_valid_prob_set(1, 1, 0, 1, 0) # => TRUE
#> [1] TRUE
is_valid_prob_set(.3, .9, .1, .8, .2) # => TRUE
#> [1] TRUE
is_valid_prob_set(.3, .9, .1, .8, NA) # => TRUE + warning (NA)
#> [1] TRUE
is_valid_prob_set(.3, .9, NA, .8, NA) # => TRUE + warning (NAs)
#> [1] TRUE
is_valid_prob_set(.3, .9, NA, NA, .8) # => TRUE + warning (NAs)
#> [1] TRUE
is_valid_prob_set(.3, .8, .1, .7, .2, tol = .1) # => TRUE (due to increased tol)
#> [1] TRUE
# watch out for:
is_valid_prob_set(1, 0, 1, 0, 1) # => TRUE, but NO warning about extreme case!
#> [1] TRUE
is_valid_prob_set(1, 1, 0, 1, 0) # => TRUE, but NO warning about extreme case!
#> [1] TRUE
is_valid_prob_set(1, 1, 0, 1, NA) # => TRUE, but NO warning about extreme case!
#> [1] TRUE
is_valid_prob_set(1, 1, 0, NA, 1) # => TRUE, but NO warning about extreme case!
#> [1] TRUE
is_valid_prob_set(1, 1, 0, NA, 0) # => TRUE, but NO warning about extreme case!
#> [1] TRUE
# ways to fail:
is_valid_prob_set(8, 1, 0, 1, 0) # => FALSE + warning (is_prob fails)
#> [1] FALSE
is_valid_prob_set(1, 1, 8, 1, 0) # => FALSE + warning (is_prob fails)
#> [1] FALSE
is_valid_prob_set(2, 1, 3, 1, 4) # => FALSE + warning (is_prob fails)
#> [1] FALSE
is_valid_prob_set(1, .8, .2, .7, .2) # => FALSE + warning (beyond complement range)
#> Warning: Probabilities (p1 and p2) are not complements (in tolerated range).
#> [1] FALSE
is_valid_prob_set(1, .8, .3, .7, .3) # => FALSE + warning (beyond complement range)
#> Warning: Probabilities (p1 and p2) are not complements (in tolerated range).
#> [1] FALSE
is_valid_prob_set(1, 1, 1, 1, 1) # => FALSE + warning (beyond complement range)
#> Warning: Probabilities (p1 and p2) are not complements (in tolerated range).
#> [1] FALSE
is_valid_prob_set(1, 1, 0, 1, 1) # => FALSE + warning (beyond complement range)
#> Warning: Probabilities (p1 and p2) are not complements (in tolerated range).
#> [1] FALSE