init_num

0th

Percentile

Initialize basic numeric variables.

init_num initializes basic numeric variables to define num as a list of named elements containing four basic probabilities (prev, sens, spec, and fart) and one frequency parameter (the population size N).

Usage
init_num(prev = num.def$prev, sens = num.def$sens,
  spec = num.def$spec, fart = num.def$fart, N = num.def$N)
Arguments
prev

The condition's prevalence value prev (i.e., the probability of condition being TRUE).

sens

The decision's sensitivity value 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). spec is optional when is 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.

N

The population size N.

Details

If spec is provided, its complement fart is optional. If fart is provided, its complement spec is optional. If no N is provided, a suitable minimum value is computed by comp_min_N.

Value

A list containing a valid quadruple of probabilities (prev, sens, spec, and fart) and one frequency (population size N).

See Also

num contains basic numeric parameters; pal contains current color settings; txt contains current text settings; freq contains current frequency information; comp_freq computes frequencies from probabilities; prob contains current probability information; comp_prob computes current probability information; is_valid_prob_set verifies sets of probability inputs; is_extreme_prob_set verifies sets of extreme probabilities; comp_min_N computes a suitable minimum population size N.

Other functions initializing scenario information: init_pal, init_txt, riskyr

Aliases
  • init_num
Examples
# NOT RUN {
# ways to succeed:
init_num(1, 1, 1, 0, 100)  # => succeeds
init_num(1, 1, 0, 1, 100)  # => succeeds

# watch out for:
init_num(1, 1, 0, 1)           # => succeeds (with N computed)
init_num(1, 1, NA, 1, 100)     # => succeeds (with spec computed)
init_num(1, 1, 0, NA, 100)     # => succeeds (with fart computed)
init_num(1, 1, NA, 1)          # => succeeds (with spec and N computed)
init_num(1, 1, 0, NA)          # => succeeds (with fart and N computed)
init_num(1, 1, .51, .50, 100)  # => succeeds (as spec and fart are within tolarated range)

# ways to fail:
init_num(prev = NA)                                  # => NAs + warning (NA)
init_num(prev = 88)                                  # => NAs + warning (beyond range)
init_num(prev =  1, sens = NA)                       # => NAs + warning (NA)
init_num(prev =  1, sens = 1, spec = NA, fart = NA)  # => NAs + warning (NAs)
init_num(1, 1, .52, .50, 100)   # => NAs + warning (complements beyond range)

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

Community examples

Looks like there are no examples yet.