comp_freq_freq
computes current frequency information
from 4 essential frequencies
(hi
, mi
, fa
, cr
).
It returns a list of 9 frequencies freq
for a population of N
individuals
as its output.
comp_freq_freq(hi = freq$hi, mi = freq$mi, fa = freq$fa, cr = freq$cr)
The number of hits hi
(or true positives).
The number of misses mi
(or false negatives).
The number of false alarms fa
(or false positives).
The number of correct rejections cr
(or true negatives).
Key relationships:
Other functions translating between representational formats:
comp_freq_freq
(defined here) is
an analog to 3 other format conversion functions:
comp_freq_prob
computes
current frequency information contained in freq
from 3 essential probabilities
(prev
, sens
, spec
).
comp_prob_freq
computes
current probability information contained in prob
from 4 essential frequencies
(hi
, mi
, fa
, cr
).
comp_prob_prob
computes
current probability information contained in prob
from 3 essential probabilities
(prev
, sens
, spec
).
Two perspectives:
A population of N
individuals can be split into 2 subsets
in 2 different ways:
by condition:
The frequency cond.true
depends on the prevalence prev
and
the frequency cond.false
depends on the prevalence's complement 1 - prev
.
by decision:
The frequency dec.pos
depends on the proportion of positive decisions ppod
and
the frequency dec.neg
depends on the proportion of negative decisions 1 - ppod
.
The population size N
is a free parameter (independent of the
essential probabilities prev
, sens
, and spec
).
If N
is unknown (NA
), a suitable minimum value can be computed by comp_min_N
.
Combinations of frequencies:
In a population of size N
the following relationships hold:
The two perspectives (by condition vs. by decision) combine the 4 essential frequencies
(i.e., hi
, mi
, fa
, cr
)
in 2 different ways.
Defining probabilities in terms of frequencies:
Probabilities are -- determine, describe, or are defined as -- the relationships between frequencies. Thus, they can be computed as ratios between frequencies.
The following relationships hold (and are used in computations):
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;
num
contains basic numeric parameters;
init_num
initializes basic numeric parameters;
prob
contains current probability information;
comp_prob
computes current probability information;
freq
contains current frequency information;
comp_freq
computes current frequency information;
is_prob
verifies probability inputs;
is_freq
verifies frequency inputs.
Other functions computing frequencies: comp_freq_prob
,
comp_freq
, comp_min_N
,
comp_popu
, comp_prob_prob
Other format conversion functions: comp_freq_prob
,
comp_prob_freq
,
comp_prob_prob
# NOT RUN {
## Basics:
comp_freq_freq()
all.equal(freq, comp_freq_freq()) # => should be TRUE
## Circular chain:
# 1. Current numeric parameters:
num
# 2. Compute all 10 probabilities in prob (from essential probabilities):
prob <- comp_prob()
prob
# 3. Compute 9 frequencies in freq from probabilities:
freq <- comp_freq(round = FALSE) # no rounding (to obtain same probabilities later)
freq
# 4. Compute 9 frequencies AGAIN (but now from frequencies):
freq_freq <- comp_freq_freq()
# 5. Check equality of results (steps 2. and 4.):
all.equal(freq, freq_freq) # => should be TRUE!
# }
Run the code above in your browser using DataLab