Functions to compute center of distribution. summ_center() is a wrapper for respective summ_*() functions (from this page) with default arguments.

summ_center(f, method = "mean")



summ_mode(f, method = "global")




A pdqr-function representing distribution.


Method of center computation. For summ_center() is one of "mean", "median", "mode", "midrange". For summ_mode() is one of "global" or "local".


summ_center(), summ_mean(), summ_median() and summ_mode(*, method = "global") always return a single number representing a center of distribution. summ_mode(*, method = "local") can return a numeric vector with multiple values representing local maxima.


summ_mean() computes distribution's mean.

summ_median() computes a smallest x value for which cumulative probability is not less than 0.5. Essentially, it is a as_q(f)(0.5). This also means that for pdqr-functions with type "discrete" it always returns an entry of "x" column from f's "x_tbl" metadata.

summ_mode(*, method = "global") computes a smallest x (which is an entry of "x" column from f's x_tbl) with the highest probability/density. summ_mode(*, method = "local") computes all x values which represent non-strict local maxima of probability mass/density function.

summ_midrange() computes middle point of f's support (average of left and right edges).

See also

summ_spread() for computing distribution's spread, summ_moment() for general moments.

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


# Type "continuous" d_norm <- as_d(dnorm) ## The same as `summ_center(d_norm, method = "mean")` summ_mean(d_norm)
#> [1] -1.358047e-16
#> [1] 2.292681e-14
#> [1] -2.904343e-12
## As pdqr-functions always have finite support, output here is finite summ_midrange(d_norm)
#> [1] -2.904788e-12
# Type "discrete" d_pois <- as_d(dpois, lambda = 10) summ_mean(d_pois)
#> [1] 9.999985
#> [1] 10
## Returns the smallest `x` with highest probability summ_mode(d_pois)
#> [1] 9
## Returns all values which are non-strict local maxima summ_mode(d_pois, method = "local")
#> [1] 9 10
## As pdqr-functions always have finite support, output here is finite summ_midrange(d_pois)
#> [1] 14
# Details of computing local modes my_d <- new_d(data.frame(x = 11:15, y = c(0, 1, 0, 2, 0) / 3), "continuous") ## Several values, which are entries of `x_tbl`, are returned as local modes summ_mode(my_d, method = "local")
#> [1] 12 14