Compute a probability's (missing) complement and return both.

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

comp_comp_pair(p1 = NA, p2 = NA)

A numeric probability value (in range from 0 to 1). p1 is optional when p2 is provided.


A numeric probability value (in range from 0 to 1). p2 is optional when p1 is provided.


comp_comp_pair does nothing when both arguments are provided (i.e., ! & ! and only issues a warning if both arguments are missing (i.e., &

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.


A vector v containing 2 numeric probability values (in range from 0 to 1): v = c(p1, p2).

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_accu_freq, comp_accu_prob, comp_acc, comp_complement, comp_complete_prob_set, comp_err, comp_fart, comp_mirt, comp_ppod, comp_prob_freq, comp_prob, comp_sens, comp_spec

  • comp_comp_pair
# ways to work:
comp_comp_pair(1, 0)   # => 1 0
comp_comp_pair(0, 1)   # => 0 1
comp_comp_pair(1, NA)  # => 1 0
comp_comp_pair(NA, 1)  # => 0 1

# watch out for:
comp_comp_pair(NA, NA) # => NA NA + warning
comp_comp_pair(8, 8)   # => 8 8 + NO warning (as is_prob is not verified)
comp_comp_pair(1, 1)   # => 1 1 + NO warning (as is_complement is not verified)

# }
Documentation reproduced from package riskyr, version 0.2.0, License: GPL-2 | GPL-3

Community examples

Looks like there are no examples yet.