addPoint: Add a Point to an Existing Configuration

Description Usage Arguments Value Examples

Description

addPoint adds a point to an existing binned configuration by first finding the bin to which it belongs, and updating the target bin

Usage

1
addPoint(point, treebinr_obj, binMeasure, makePoint, inputs)

Arguments

point

A vector containing the point to be added to the binned configuration

treebinr_obj

An object of class treebinr

binMeasure

A user supplied function to compute the measure associated with each bin

makePoint

A user supplied function to turn the contents of a bin into a single point

inputs

A list containing additional input parameters required by user supplied functions. Default is NULL.

Value

The return value is an object of class treebinr, which contains the following

points

A matrix containing the reduced point configuration

counts

A vector containing the number of points in each bin

bins

A list containing bin objects, which detail the contents of each bin

tree

An undirected graph object for the binning tree

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#Bin a Normal Configuration to 500 Points
set.seed(1337)
X <- matrix(rnorm(2000),ncol=2)

numbins <- 500
nCols <- ncol(X)
binMeasure <- gapMeasure
selectBin <- gapSelect
splitBin <- gapSplit
boundaryTest <- gapBoundaryTest
makePoint <- gapPoints

inputs <- list(dimRange = sapply(1:nCols, FUN = function(j) {range(X[,j])}), tau=1)
binInfo <- list(binRange = sapply(1:nCols, FUN = function(j) {range(X[,j])}))

treebinr_obj <- treebin(X, numbins, binMeasure, boundaryTest, selectBin, splitBin, makePoint, binInfo, inputs)

#Add a Point at (-3,3)
point <- c(-3,3)
out2 <- addPoint(point, treebinr_obj, binMeasure, makePoint, inputs)

rwoldford/treebinr documentation built on May 12, 2019, 4:38 a.m.