comp_popu is a function that computes a table popu (as an R data frame) from the current frequency information (contained in freq).

comp_popu(hi = freq$hi, mi = freq$mi, fa = freq$fa, cr = freq$cr,
  cond_lbl = txt$cond_lbl, cond_true_lbl = txt$cond_true_lbl,
  cond_false_lbl = txt$cond_false_lbl, dec_lbl = txt$dec_lbl,
  dec_pos_lbl = txt$dec_pos_lbl, dec_neg_lbl = txt$dec_neg_lbl,
  sdt_lbl = txt$sdt_lbl, hi_lbl = txt$hi_lbl, mi_lbl = txt$mi_lbl,
  fa_lbl = txt$fa_lbl, cr_lbl = txt$cr_lbl)

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).

cond_lbl

Text label for condition dimension ("by cd" perspective).

cond_true_lbl

Text label for cond_true cases.

cond_false_lbl

Text label for cond_false cases.

dec_lbl

Text label for decision dimension ("by dc" perspective).

dec_pos_lbl

Text label for dec_pos cases.

dec_neg_lbl

Text label for dec_neg cases.

sdt_lbl

Text label for 4 cases/combinations (SDT classifications).

hi_lbl

Text label for hi cases.

mi_lbl

Text label for mi cases.

fa_lbl

Text label for fa cases.

cr_lbl

Text label for cr cases.

Format

An object of class data.frame with N rows and 3 columns ("Truth", "Decision", "SDT").

Value

A data frame popu containing N rows (individual cases) and 3 columns ("Truth", "Decision", "SDT") encoded as ordered factors (with 2, 2, and 4 levels, respectively).

Details

comp_popu also uses the current text settings contained in txt.

A visualization of the current population contained in popu is provided by plot_icon.

See also

the corresponding data frame popu; read_popu interprets a data frame as a riskyr scenario; num for basic numeric parameters; freq for current frequency information; txt for current text settings; pal for current color settings.

Other functions computing frequencies: comp_freq_freq, comp_freq_prob, comp_freq, comp_min_N, comp_prob_prob

Examples

popu <- comp_popu() # => initializes popu (with current values of freq and txt) dim(popu) # => N x 3
#> [1] 1000 3
head(popu)
#> Truth Test Cases #> 1 True Positive TP #> 2 True Positive TP #> 3 True Positive TP #> 4 True Positive TP #> 5 True Positive TP #> 6 True Positive TP
# (A) Diagnostic/screening scenario (using default labels): comp_popu(hi = 4, mi = 1, fa = 2, cr = 3) # => computes a table of N = 10 cases.
#> Truth Test Cases #> 1 True Positive TP #> 2 True Positive TP #> 3 True Positive TP #> 4 True Positive TP #> 5 True Negative FN #> 6 False Positive FP #> 7 False Positive FP #> 8 False Negative TN #> 9 False Negative TN #> 10 False Negative TN
# (B) Intervention/treatment scenario: comp_popu(hi = 3, mi = 2, fa = 1, cr = 4, cond_lbl = "Treatment", cond_true_lbl = "pill", cond_false_lbl = "placebo", dec_lbl = "Health status", dec_pos_lbl = "healthy", dec_neg_lbl = "sick")
#> Treatment Health status Cases #> 1 pill healthy TP #> 2 pill healthy TP #> 3 pill healthy TP #> 4 pill sick FN #> 5 pill sick FN #> 6 placebo healthy FP #> 7 placebo sick TN #> 8 placebo sick TN #> 9 placebo sick TN #> 10 placebo sick TN
# (C) Prevention scenario (e.g., vaccination): comp_popu(hi = 3, mi = 2, fa = 1, cr = 4, cond_lbl = "Vaccination", cond_true_lbl = "yes", cond_false_lbl = "no", dec_lbl = "Disease", dec_pos_lbl = "no flu", dec_neg_lbl = "flu")
#> Vaccination Disease Cases #> 1 yes no flu TP #> 2 yes no flu TP #> 3 yes no flu TP #> 4 yes flu FN #> 5 yes flu FN #> 6 no no flu FP #> 7 no flu TN #> 8 no flu TN #> 9 no flu TN #> 10 no flu TN