pasting: Bottom up pasting

Description Usage Arguments Details Value References See Also Examples

View source: R/pasting.R

Description

Refines the edges of a chosen box in a prim object by pasting.

Usage

1
2
3
4
5
6
7
8
9
pasting(
  object,
  npeel = NULL,
  support = NULL,
  yfun = NULL,
  alpha = object$alpha,
  obj.fun = object$obj.fun,
  peeling.side = object$peeling.side
)

Arguments

object

prim object resulting from a call to peeling.

npeel

Numeric value indicating which box to choose in object through the number of peeling iteration.

support

Numeric value between 0 and 1 indicating the support of the box to choose in object.

yfun

Numeric value indicating the value of the objective function for the chosen box in object.

alpha

The proportion of observations to add at each pasting iteration. Usually equal to the peeling fraction used in peeling.

obj.fun

The objective function to maximize by pasting. See peeling.

peeling.side

Constraints on the pasting side. -1 indicates pasting only on the 'left' of the box (i.e. moving the lower limit only), 1 indicate pasting only on the 'right' and 0 for no constraint.

Details

The function takes a prim object and choose one of its boxes as a starting point for pasting. Bottom-up pasting is the reverse of of the top down peeling. It starts from the result of the peeling and refines its edges by iteratively adding alpha times N observations at each iteration, where N is the number of observations in the current box.

The best box after the peeling should be chosen by analyzing the peeling trajectory (see plot_trajectory). It is given by one of: number of peeling iteration leading to the box (argument npeel), the closest support (argument support), or the closest objective function value (argument yfun).

Although it is possible to use different algorithm parameters (alpha, obj.fun, peeling.side) than the peeling step, it is advised to keep the same values (the default).

Value

A prim object which is a list with the following elements:

npeel

The number of peeling iteration performed.

support

A vector of length npeel + npaste + 1 containing the support of each successivepeeled box.

yfun

A vector of length npeel + npaste + 1 containing the objective function value of each successive peeled box.

limits

A list of length npeel + npaste + 1 containing the limits of each successive box. Each limit is a list with one element per input variable.

x,y

The input and response data used in the algorithm.

numeric.vars

A logical vector indicating, for each input variable, if it was considered as a numeric variable.

alpha, peeling.side, obj.fun

The value of the arguments used for peeling. Useful for prim methods.

npaste

Number of pasting iteration performed.

References

Friedman, J.H., Fisher, N.I., 1999. Bump hunting in high-dimensional data. Statistics and Computing 9, 123-143. https://doi.org/10.1023/A:1008894516817

See Also

extract.box to extract information about a particular box in a prim object. plot_box to visualize boxes. predict.prim to predict if new data falls into particular boxes.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
   # A simple bump
   set.seed(12345)
   x <- matrix(runif(2000), ncol = 2, dimnames = list(NULL, c("x1", "x2")))
   y <- 2 * x[,1] + 5 * x[,2] + 10 * (x[,1] >= .8 & x[,2] >= .5) + rnorm(1000)
   # Peeling step
   peel_res <- peeling(y, x)
   # Pasting from the box with support 0.01
   paste_res <- pasting(peel_res, support = 0.01)
   # Visualize the peeled box and pasted one (npaste 0 and 2)
   plot_box(paste_res, pch = 16, ypalette = hcl.colors(10), npaste = c(0, 2), 
     box.args = list(lwd = 2, border = c("grey", "black"), lty = 1:2))

PierreMasselot/primr documentation built on Feb. 5, 2021, 7:33 p.m.