summ_pval() computes p-value(s) based on supplied distribution and observed value(s). There are several methods of computing p-values ("both", "right", and "left") as well as several types of multiple comparison adjustments (using on stats::p.adjust()).

summ_pval(f, obs, method = "both", adjust = "holm")

## Arguments

f A pdqr-function representing distribution. Numeric vector of observed values to be used as threshold for p-value. Can have multiple values, in which case output will be adjusted for multiple comparisons with p.adjust(). Method representing direction of p-value computation. Should be one of "both", "right", "left". Adjustment method as method argument to p.adjust().

## Value

A numeric vector with the same length as obs representing corresponding p-values after possible adjustment for multiple comparisons.

## Details

Method "both" for each element in obs computes two-sided p-value as min(1, 2 * min(right_p_val, left_p_val)), where right_p_val and left_p_val are right and left one-sided p-values (ones which are computed with "right" and "left" methods) of obs's elements correspondingly.

Method "right" for each element x of obs computes probability of f >= x being true (more strictly, of random variable, represented by f, being not less than x). This corresponds to right one-sided p-value.

Method "left" for each element x of obs computes probability of f <= x, which is a left one-sided p-value.

Note that by default multiple p-values in output are adjusted with p.adjust(*, method = adjust). To not do any adjustment, use adjust = "none".

Other summary functions: summ_center(), summ_classmetric(), summ_distance(), summ_entropy(), summ_hdr(), summ_interval(), summ_moment(), summ_order(), summ_prob_true(), summ_quantile(), summ_roc(), summ_separation(), summ_spread()

## Examples

# Type "discrete"
d_dis <- new_d(data.frame(x = 1:5, prob = c(1, 2, 3, 2, 1) / 9), "discrete")
summ_pval(d_dis, 3, method = "both")#> [1] 1summ_pval(d_dis, 3, method = "right")#> [1] 0.6666667summ_pval(d_dis, 3, method = "left")#> [1] 0.6666667
# Type "continuous"
d_norm <- as_d(dnorm)
summ_pval(d_norm, 2, method = "both")#> [1] 0.04549837summ_pval(d_norm, 2, method = "right")#> [1] 0.02274919summ_pval(d_norm, 2, method = "left")#> [1] 0.9772508
#> [15] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 0.9554658  # Use adjust = "none" for to not do any adjustment