comp_prob_freq: Compute probabilities from (4 essential) frequencies.

View source: R/comp_prob_freq.R

comp_prob_freqR Documentation

Compute probabilities from (4 essential) frequencies.

Description

comp_prob_freq computes current probability information from 4 essential frequencies (hi, mi, fa, cr). It returns a list of 11 frequencies freq for a population of N individuals as its output.

Usage

comp_prob_freq(hi = freq$hi, mi = freq$mi, fa = freq$fa, cr = freq$cr)

Arguments

hi

The number of hits hi (or true positives).

mi

The number of misses mi (or false negatives).

fa

The number of false alarms fa (or false positives).

cr

The number of correct rejections cr (or true negatives).

Details

Key relationships between frequencies and probabilities (see documentation of comp_freq or comp_prob for details):

  • Three perspectives on a population:

    by condition / by decision / by accuracy.

  • Defining probabilities in terms of frequencies:

    Probabilities can be computed as ratios between frequencies, but beware of rounding issues.

Functions translating between representational formats: comp_prob_prob, comp_prob_freq, comp_freq_prob, comp_freq_freq (see documentation of comp_prob_prob for details).

See Also

comp_freq_freq computes current frequency information from (4 essential) frequencies; comp_freq_prob computes current frequency information from (3 essential) probabilities; 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 probabilities: comp_FDR(), comp_FOR(), comp_NPV(), comp_PPV(), comp_accu_freq(), comp_accu_prob(), comp_acc(), comp_comp_pair(), comp_complement(), comp_complete_prob_set(), comp_err(), comp_fart(), comp_mirt(), comp_ppod(), comp_prob(), comp_sens(), comp_spec()

Other format conversion functions: comp_freq_freq(), comp_freq_prob(), comp_prob_prob()

Examples

## Basics:
comp_prob_freq()  # => computes prob from current freq

## Beware of rounding:
all.equal(prob, comp_prob_freq())  # => would be TRUE (IF freq were NOT rounded)!
fe <- comp_freq(round = FALSE)     # compute exact freq (not rounded)
all.equal(prob, comp_prob_freq(fe$hi, fe$mi, fe$fa, fe$cr))  # is TRUE (qed).

## Explain by circular chain (compute prob 1. from num and 2. from freq)
# 0. Inspect current numeric parameters:
num

# 1. Compute currently 11 probabilities in prob (from essential probabilities):
prob <- comp_prob()
prob

# 2. Compute currently 11 frequencies in freq (from essential probabilities):
freq <- comp_freq(round = FALSE)   # no rounding (to obtain same probabilities later)
freq

# 3. Compute currently 11 probabilities again (but now from frequencies):
prob_freq <- comp_prob_freq()
prob_freq

# 4. Check equality of probabilities (in steps 1. and 3.):
all.equal(prob, prob_freq)  # => should be TRUE!


riskyr documentation built on Aug. 15, 2022, 9:09 a.m.