Functions to compute spread (variability, dispersion) of distribution (i.e. "how wide it is spread"). summ_spread() is a wrapper for respective summ_*() functions (from this page) with default arguments.

summ_spread(f, method = "sd")

summ_sd(f)

summ_var(f)

summ_iqr(f)

summ_mad(f)

summ_range(f)

Arguments

f

A pdqr-function representing distribution.

method

Method of spread computation. Should be one of "sd", "var", "iqr", "mad", "range".

Value

All functions return a single number representing a spread of distribution.

Details

summ_sd() computes distribution's standard deviation.

summ_var() computes distribution's variance.

summ_iqr() computes distribution's interquartile range. Essentially, it is a as_q(f)(0.75) - as_q(f)(0.25).

summ_mad() computes distribution's median absolute deviation around the distribution's median.

summ_range() computes range length (difference between maximum and minimum) of "x" values within region of positive probability. Note that this might differ from length of support because the latter might be affected by tails with zero probability (see Examples).

See also

summ_center() for computing distribution's center, summ_moment() for general moments.

Other summary functions: summ_center(), 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()

Examples

# Type "continuous" d_norm <- as_d(dnorm) ## The same as `summ_spread(d_norm, method = "sd")` summ_sd(d_norm)
#> [1] 0.9999766
summ_var(d_norm)
#> [1] 0.9999531
summ_iqr(d_norm)
#> [1] 1.348976
summ_mad(d_norm)
#> [1] 0.6744882
summ_range(d_norm)
#> [1] 9.506849
# Type "discrete" d_pois <- as_d(dpois, lambda = 10) summ_sd(d_pois)
#> [1] 3.162233
summ_var(d_pois)
#> [1] 9.999717
summ_iqr(d_pois)
#> [1] 4
summ_mad(d_pois)
#> [1] 2
summ_range(d_pois)
#> [1] 28
# Difference of `summ_range(f)` and `diff(meta_support(f))` zero_tails <- new_d(data.frame(x = 1:5, y = c(0, 0, 1, 0, 0)), "continuous") ## This returns difference between 5 and 1 diff(meta_support(zero_tails))
#> [1] 4
## This returns difference between 2 and 4 as there are zero-probability ## tails summ_range(zero_tails)
#> [1] 2