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)
A pdqr-function representing distribution.
Method of spread computation. Should be one of "sd", "var", "iqr", "mad", "range".
All functions return a single number representing a spread of distribution.
summ_sd() computes distribution's standard deviation.
summ_var() computes distribution's variance.
summ_iqr() computes distribution's interquartile range. Essentially, it is
as_q(f)(0.75) - as_q(f)(0.25).
summ_mad() computes distribution's median absolute deviation around the
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).
Other summary functions:
# Type "continuous" d_norm <- as_d(dnorm) ## The same as `summ_spread(d_norm, method = "sd")` summ_sd(d_norm)#>  0.9999766summ_var(d_norm)#>  0.9999531summ_iqr(d_norm)#>  1.348976summ_mad(d_norm)#>  0.6744882summ_range(d_norm)#>  9.506849# Type "discrete" d_pois <- as_d(dpois, lambda = 10) summ_sd(d_pois)#>  3.162233summ_var(d_pois)#>  9.999717summ_iqr(d_pois)#>  4summ_mad(d_pois)#>  2summ_range(d_pois)#>  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))#>  4## This returns difference between 2 and 4 as there are zero-probability ## tails summ_range(zero_tails)#>  2