| distributionH-class | R Documentation |
The distributionH class describes a histogram (a distribution) by means
of its cumulative distribution function (cdf): the bounds of the bins and the
values of the cdf at the bounds. All the methods of the package are based on
the L2 Wasserstein distance between distributions.
distributionH(x = numeric(0), p = numeric(0))
x |
A numeric vector, the bounds of the bins, in non-decreasing order. A single value defines an impulse distribution. |
p |
A numeric vector of the same length of |
distributionH() returns a distributionH object.
xA non-decreasing numeric vector: the bounds of the bins (the domain of the distribution).
pA non-decreasing numeric vector of the same length of x, from 0
to 1: the cdf at the values in x.
mThe mean of the distribution.
sThe standard deviation of the distribution.
Objects are created with distributionH(x, p) or, equivalently, with
new("distributionH", x, p, m, s), where the optional m and
s (mean and standard deviation) are computed when not given.
Empty bins, i.e. bins with zero weight (two consecutive equal values in
p), may produce numerical problems. Since version 1.0.9 each empty bin
gets a weight of 1e-8 and the cdf is renormalised when the object is
created (see also checkEmptyBins).
Irpino, A., Verde, R. (2015) Basic statistics for distributional symbolic variables: a new metric-based approach, Advances in Data Analysis and Classification, 9(2), 143-175. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s11634-014-0176-4")}
data2hist to build a histogram from raw data;
meanH, stdH, plot,distributionH-method.
# the histogram
# | Bins | Prob | cdf |
# | [1,2) | 0.4 | 0.4 |
# | [2,3] | 0.6 | 1.0 |
mydist <- distributionH(x = c(1, 2, 3), p = c(0, 0.4, 1))
mydist
str(mydist)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.