distributionH-class: Histogram objects: the distributionH class

distributionH-classR Documentation

Histogram objects: the distributionH class

Description

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.

Usage

distributionH(x = numeric(0), p = numeric(0))

Arguments

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 x, the values of the cdf at x, non-decreasing from 0 to 1.

Value

distributionH() returns a distributionH object.

Slots

x

A non-decreasing numeric vector: the bounds of the bins (the domain of the distribution).

p

A non-decreasing numeric vector of the same length of x, from 0 to 1: the cdf at the values in x.

m

The mean of the distribution.

s

The standard deviation of the distribution.

Creating objects

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

References

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")}

See Also

data2hist to build a histogram from raw data; meanH, stdH, plot,distributionH-method.

Examples

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

HistDAWass documentation built on Oct. 29, 2026, 5:07 p.m.