summ_spread {pdqr}R Documentation

Summarize distribution with spread

Description

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.

Usage

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".

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).

Value

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

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)
summ_var(d_norm)
summ_iqr(d_norm)
summ_mad(d_norm)
summ_range(d_norm)

# Type "discrete"
d_pois <- as_d(dpois, lambda = 10)
summ_sd(d_pois)
summ_var(d_pois)
summ_iqr(d_pois)
summ_mad(d_pois)
summ_range(d_pois)

# 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))
## This returns difference between 2 and 4 as there are zero-probability
## tails
summ_range(zero_tails)

[Package pdqr version 0.3.1 Index]