summ_center {pdqr} | R Documentation |
Summarize distribution with center
Description
Functions to compute center of distribution. summ_center()
is a wrapper for
respective summ_*()
functions (from this page) with default arguments.
Usage
summ_center(f, method = "mean")
summ_mean(f)
summ_median(f)
summ_mode(f, method = "global")
summ_midrange(f)
Arguments
f |
A pdqr-function representing distribution. |
method |
Method of center computation. For |
Details
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).
Value
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.
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()
Examples
# Type "continuous"
d_norm <- as_d(dnorm)
## The same as `summ_center(d_norm, method = "mean")`
summ_mean(d_norm)
summ_median(d_norm)
summ_mode(d_norm)
## As pdqr-functions always have finite support, output here is finite
summ_midrange(d_norm)
# Type "discrete"
d_pois <- as_d(dpois, lambda = 10)
summ_mean(d_pois)
summ_median(d_pois)
## Returns the smallest `x` with highest probability
summ_mode(d_pois)
## Returns all values which are non-strict local maxima
summ_mode(d_pois, method = "local")
## As pdqr-functions always have finite support, output here is finite
summ_midrange(d_pois)
# 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")