is_valid_prob_set

0th

Percentile

Verify that a set of probability inputs is valid.

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.

Usage
is_valid_prob_set(prev, sens = NA, mirt = NA, spec = NA, fart = NA,
  tol = 0.01)
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). sens is optional when its complement mirt is provided.

mirt

The decision's miss rate mirt (i.e., the conditional probability of a negative decision provided that the condition is TRUE). mirt is optional when its complement sens is provided.

spec

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

fart

The decision's false alarm rate fart (i.e., the conditional probability of a positive decision provided that the condition is FALSE). fart is optional when its complement spec 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:

  1. Either sens or mirt is necessary (as both are complements).

  2. Either spec or fart is necessary (as both are complements).

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.

Value

A Boolean value: TRUE if the probabilities provided are valid; otherwise FALSE.

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_perc, is_prob, is_suff_prob_set, is_valid_prob_pair, is_valid_prob_triple

Aliases
  • is_valid_prob_set
Examples
# NOT RUN {
# ways to succeed:
is_valid_prob_set(1, 1, 0, 1, 0)                 # => TRUE
is_valid_prob_set(.3, .9, .1, .8, .2)            # => TRUE
is_valid_prob_set(.3, .9, .1, .8, NA)            # => TRUE + warning (NA)
is_valid_prob_set(.3, .9, NA, .8, NA)            # => TRUE + warning (NAs)
is_valid_prob_set(.3, .9, NA, NA, .8)            # => TRUE + warning (NAs)
is_valid_prob_set(.3, .8, .1, .7, .2, tol = .1)  # => TRUE (due to increased tol)

# watch out for:
is_valid_prob_set(1, 0, 1, 0, 1)    # => TRUE, but NO warning about extreme case!
is_valid_prob_set(1, 1, 0, 1, 0)    # => TRUE, but NO warning about extreme case!
is_valid_prob_set(1, 1, 0, 1, NA)   # => TRUE, but NO warning about extreme case!
is_valid_prob_set(1, 1, 0, NA, 1)   # => TRUE, but NO warning about extreme case!
is_valid_prob_set(1, 1, 0, NA, 0)   # => TRUE, but NO warning about extreme case!

# ways to fail:
is_valid_prob_set(8, 1, 0, 1, 0)      # => FALSE + warning (is_prob fails)
is_valid_prob_set(1, 1, 8, 1, 0)      # => FALSE + warning (is_prob fails)
is_valid_prob_set(2, 1, 3, 1, 4)      # => FALSE + warning (is_prob fails)
is_valid_prob_set(1, .8, .2, .7, .2)  # => FALSE + warning (beyond complement range)
is_valid_prob_set(1, .8, .3, .7, .3)  # => FALSE + warning (beyond complement range)
is_valid_prob_set(1, 1, 1, 1, 1)      # => FALSE + warning (beyond complement range)
is_valid_prob_set(1, 1, 0, 1, 1)      # => FALSE + warning (beyond complement range)

# }
Documentation reproduced from package riskyr, version 0.2.0, License: GPL-2 | GPL-3

Community examples

Looks like there are no examples yet.