checkEmptyBins-methods: Fix the empty bins of histograms

checkEmptyBinsR Documentation

Fix the empty bins of histograms

Description

Checks for empty bins, i.e. bins with zero weight (two consecutive equal values of the cdf). Each empty bin gets a weight of 1e-8 and the cdf is renormalised. Since version 1.0.9 empty bins are fixed when a distributionH object is created (see distributionH), so this method is useful for objects created with previous versions of the package or modified by assigning their slots directly. The MatH method applies the check to all the cells of the matrix.

Usage

checkEmptyBins(object)

Arguments

object

A distributionH or a MatH object.

Value

An object of the same class of object, without empty bins.

Examples

## an empty bin in an object modified by slot assignment
mydist <- distributionH(x = c(1, 2, 3, 10), p = c(0, 0.5, 0.6, 1))
mydist@p <- c(0, 0.5, 0.5, 1)
diff(checkEmptyBins(mydist)@p)
## all the distributions of a MatH
newMat <- checkEmptyBins(China_Seas[1:5, 1:3])

HistDAWass documentation built on Oct. 19, 2026, 1:06 a.m.