Learn R Programming

riskyr (version 0.1.0)

comp_min_N: Compute a suitable minimum population size value N.

Description

comp_min_N is a function that 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 bottom row of boxes in the natural frequency tree) reach or exceed a minimum value min.freq given the basic parameters prev, sens, and spec (spec = 1 - fart).

Usage

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 (esp. true positives, false negatives, false positives, and true negatives) 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 tree) is positive but below min.freq.

Note that comp_freq still needs to round to avoid decimal values in frequencies freq.

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_popu, comp_prob_prob

Examples

Run this code
# NOT RUN {
comp_min_N(0, 0, 0)  # => 1
comp_min_N(1, 1, 1)  # => 1

comp_min_N(1, 1, 1, min.freq = 10)  # =>  10
comp_min_N(1, 1, 1, min.freq = 99)  # => 100

comp_min_N(.1, .1, .1)        # =>       100 = 10^2
comp_min_N(.001, .1, .1)      # =>    10 000 = 10^4
comp_min_N(.001, .001, .1)    # => 1 000 000 = 10^6
comp_min_N(.001, .001, .001)  # => 1 000 000 = 10^6


# }

Run the code above in your browser using DataLab