Functions to compute center of distribution.
summ_center() is a wrapper for
summ_*() functions (from this page) with default arguments.
summ_center(f, method = "mean") summ_mean(f) summ_median(f) summ_mode(f, method = "global") summ_midrange(f)
A pdqr-function representing distribution.
Method of center computation. For
summ_mode(*, method = "global") always return a single number representing a center of
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
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
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
(average of left and right edges).
Other summary functions:
# Type "continuous" d_norm <- as_d(dnorm) ## The same as `summ_center(d_norm, method = "mean")` summ_mean(d_norm)#>  -1.358047e-16summ_median(d_norm)#>  2.292681e-14summ_mode(d_norm)#>  -2.904343e-12## As pdqr-functions always have finite support, output here is finite summ_midrange(d_norm)#>  -2.904788e-12# Type "discrete" d_pois <- as_d(dpois, lambda = 10) summ_mean(d_pois)#>  9.999985summ_median(d_pois)#>  10## Returns the smallest `x` with highest probability summ_mode(d_pois)#>  9## Returns all values which are non-strict local maxima summ_mode(d_pois, method = "local")#>  9 10## As pdqr-functions always have finite support, output here is finite summ_midrange(d_pois)#>  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")#>  12 14