comp_min_N computes a population size value N (an integer as a power of 10) so that the frequencies of the 4 combinations of conditions and decisions (i.e., the cells of the confusion table, or center row of boxes in the frequency prism) reach or exceed a minimum value min_freq given the basic parameters prev, sens, and spec (spec = 1 - fart).

comp_min_N(prev, sens, spec, min_freq = 1)

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 specificity value spec (i.e., the conditional probability of a negative decision provided that the condition is FALSE).

min_freq

The minimum frequency of each combination of a condition and a decision (i.e., hits, misses, false alarms, and correct rejections). Default: min_freq = 1.

Value

An integer value N (as a power of 10).

Details

Using this function helps avoiding excessively small decimal values in categories -- especially hi, mi, fa, cr -- when expressing combinations of conditions and decisions as natural frequencies. As values of zero (0) are tolerable, the function only increases N (in powers of 10) while the current value of any frequency (cell in confusion table or leaf of a frequency tree) is positive but below min_freq.

By default, comp_freq_prob and comp_freq round frequencies to nearest integers to avoid decimal values in freq (i.e., round = TRUE by default). Using the option round = FALSE turns off rounding.

See also

population size N; num contains basic numeric parameters; freq contains current frequency information; comp_freq computes frequencies from probabilities; prob contains current probability information; comp_prob computes probabilities from probabilities; comp_freq_freq computes current frequency information from (4 essential) frequencies; comp_freq_prob computes current frequency information from (3 essential) probabilities; comp_prob_freq computes current probability information from (4 essential) frequencies; comp_prob_prob computes current probability information from (3 essential) probabilities.

Other functions computing frequencies: comp_freq_freq(), comp_freq_prob(), comp_freq(), comp_prob_prob()

Examples

comp_min_N(0, 0, 0)  # => 1
#> Warning: Extreme case (prev = 0 & spec = 0):
#>   N fa (FP) cases; 0 cond_true or dec_true cases; PPV = NaN.
#> [1] 1
comp_min_N(1, 1, 1)  # => 1
#> Warning: Extreme case (prev = 1 & sens = 1):
#>   N hi (TP) cases; 0 cond_false or dec_false cases; NPV = NaN.
#> [1] 1

comp_min_N(1, 1, 1, min_freq = 10)  # =>  10
#> Warning: Extreme case (prev = 1 & sens = 1):
#>   N hi (TP) cases; 0 cond_false or dec_false cases; NPV = NaN.
#> [1] 10
comp_min_N(1, 1, 1, min_freq = 99)  # => 100
#> Warning: Extreme case (prev = 1 & sens = 1):
#>   N hi (TP) cases; 0 cond_false or dec_false cases; NPV = NaN.
#> [1] 100

comp_min_N(.1, .1, .1)        # =>       100 = 10^2
#> [1] 100
comp_min_N(.001, .1, .1)      # =>    10 000 = 10^4
#> [1] 10000
comp_min_N(.001, .001, .1)    # => 1 000 000 = 10^6
#> [1] 1e+06
comp_min_N(.001, .001, .001)  # => 1 000 000 = 10^6
#> [1] 1e+06