
Compute a probability's (missing) complement and return both.
Source:R/comp_prob_prob.R
comp_comp_pair.Rdcomp_comp_pair is a function that takes 0, 1, or 2
probabilities (p1 and p2) as inputs.
If either of them is missing (NA), it computes the complement
of the other one and returns both probabilities.
Details
comp_comp_pair does nothing when both arguments are provided
(i.e., !is.na(p1) & !is.na(p2)) and only issues
a warning if both arguments are missing
(i.e., is.na(p1) & is.na(p2)).
Inputs are not verified:
Use is_prob to verify that an input is
a probability and is_complement to verify
that two provided values actually are complements.
See also
is_complement verifies numeric complements;
is_valid_prob_set verifies sets of probabilities;
comp_complete_prob_set completes valid sets of probabilities;
is_extreme_prob_set verifies extreme cases;
comp_prob computes current probability information;
prob contains current probability information;
is_prob verifies probabilities.
Other functions computing probabilities:
comp_FDR(),
comp_FOR(),
comp_NPV(),
comp_PPV(),
comp_acc(),
comp_accu_freq(),
comp_accu_prob(),
comp_complement(),
comp_complete_prob_set(),
comp_err(),
comp_fart(),
comp_mirt(),
comp_ppod(),
comp_prob(),
comp_prob_freq(),
comp_sens(),
comp_spec()
Examples
# ways to work:
comp_comp_pair(1, 0) # => 1 0
#> [1] 1 0
comp_comp_pair(0, 1) # => 0 1
#> [1] 0 1
comp_comp_pair(1, NA) # => 1 0
#> [1] 1 0
comp_comp_pair(NA, 1) # => 0 1
#> [1] 0 1
# watch out for:
comp_comp_pair(NA, NA) # => NA NA + warning
#> Warning: One argument (either p1 or p2) is necessary.
#> [1] NA NA
comp_comp_pair(8, 8) # => 8 8 + NO warning (as is_prob is not verified)
#> [1] 8 8
comp_comp_pair(1, 1) # => 1 1 + NO warning (as is_complement is not verified)
#> [1] 1 1