Here summ_prob_false() returns a probability of 0 and summ_prob_true() - complementary probability (one minus summ_prob_false() output). Both of them check if their input is a boolean pdqr-function: type "discrete" with x in x_tbl identical to c(0, 1). If it is not, warning is thrown.

summ_prob_false(f)

summ_prob_true(f)

Arguments

f

A pdqr-function representing distribution.

Value

A single numeric value representing corresponding probability.

See also

Examples

d_unif <- as_d(dunif) d_norm <- as_d(dnorm) summ_prob_true(d_unif > d_norm)
#> [1] 0.6843735
summ_prob_false(2 * d_norm > d_unif)
#> [1] 0.5977087
# When input is "continuous" function or doesn't have 0 as distribution # element, probability of being false is returned as 0. summ_prob_false(d_unif)
#> Warning: `f` is not a "boolean" pdqr-function (type "discrete" with "x" values equal to 0 and 1). Proceed with caution.
#> [1] 0
summ_prob_true(new_d(2, "discrete"))
#> Warning: `f` is not a "boolean" pdqr-function (type "discrete" with "x" values equal to 0 and 1). Proceed with caution.
#> [1] 1