bins.optimize: Algorithms minimizing the binning error function 'bins.merr'.

bins.optimizeR Documentation

Algorithms minimizing the binning error function bins.merr.

Description

bins.move - Compute the best move of a value from one bin to its neighbor

bins.split - Split a bin into two bins optimally.

bins.merge - Merges the two bins yielding the largest gain in error reduction.

bins.move.iter - Apply bins.move until there's no change. Can only reduce the error.

bins.split.iter Iterate to repeatedly apply bins.split.

bins.merge.iter Iterate to repeatedly apply bins.merge.

Usage

bins.move(xval, xtbl, binlo, binhi, binct, target.bins, verbose = F)

bins.split(xval, xtbl, binlo, binhi, binct, target.bins, force = F,
  verbose = F)

bins.merge(xval, xtbl, binlo, binhi, binct, target.bins, force = F,
  verbose = F)

bins.move.iter(lst, target.bins, verbose = F)

bins.split.iter(lst, target.bins, exact.groups = F, verbose = F)

bins.merge.iter(lst, target.bins, exact.groups = F, verbose = F)

Arguments

xval

Sorted unique values of the data set x. This should be the numeric version of names(xtbl).

xtbl

Result of a call to table(x).

binlo

The "low" value falling into the bin.

binhi

The "high" value falling into the bin.

binct

The number of points falling into the bin.

target.bins

Number of bins desired; this is also the max number of bins.

verbose

When TRUE, prints resulting binct.

force

When TRUE, splits or merges bins regardless of whether the best gain is positive.

lst

List containing xval, xtbl, binlo, binhi, binct.

exact.groups

If FALSE, run until either the target.bins is reached or there's no more splits or merges that reduce the error. Otherwise (TRUE), run until the target.bins is reached, even if that increases the error.

Value

A list containing the following items (not all of them may be present):

  • binlo - The "low" value falling into the bin.

  • binhi - The "high" value falling into the bin.

  • binct - The number of points falling into the bin.

  • xtbl - The result of a call to table(x).

  • xval - The sorted unique values of the data points x. Essentially, a numeric version of names(xtbl).

  • changed - Flag indicating whether the bins have been modified by the function.

  • err - Mean square root error between the resulting counts and ideal bins.

  • imax - For the move, merge and split operations, the index of the bin with the maximum gain.

  • iside - For the move operation, the side of the move: 0 = left, 1 = right.

  • gain - Error gain obtained as the result of the function call.

See Also

bins, binr, bins.greedy, bins.quantiles


binr documentation built on June 26, 2022, 9:05 a.m.