plot_trajectory: Plot a peeling trajectory

Description Usage Arguments References See Also Examples

View source: R/plots.R

Description

Displays the peeling trajectory of a prim object with chosen cut-points.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
plot_trajectory(
  object,
  xtype = c("support", "nobs"),
  ytype = c("yfun", "diff", "rel.diff"),
  npeel = NULL,
  support = NULL,
  yfun = NULL,
  npaste = NULL,
  abline.pars = list(),
  se = TRUE,
  se.pars = list(),
  ...
)

Arguments

object

A prim object.

xtype

A character indicating the how to display the x axis of the plot. 'support' (the default) for the support of the boxes or 'nobs' for the number of observations inside the box.

ytype

A character indicating which trajectory to plot. 'yfun' (the default) for the objective function value, 'diff' for the difference between successive boxes and 'rel.diff' for the relative difference. See jump.prim for details.

npeel

Integer vector. If not NULL, draw a vertical line at the corresponding peeling iterations of the trajectory.

support

Numeric vector. If not NULL, draw a vertical line at the corresponding supports of the trajectory.

yfun

Numeric vector. If not NULL, draw a vertical line at the boxes with the closest yfun value.

npaste

Integer vector. If not NULL, draw a vertical line at the corresponding pasting iterations of the trajectory.

abline.pars

List of parameters to be passed to abline for the vertical lines.

se

Logical indicating if standard error bars should be drawn. Works only for cv.prim objects and ytype = "yfun".

se.pars

Parameters to be passed to arrows for drawing strandard error bars.

...

Additional graphical parameters for plot.

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

peeling for peeling trajectories.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
   # 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 with alpha = 0.05 and beta.stop = 0.05
   peel_res <- peeling(y, x, beta.stop = 0.05)

   # Display the peeling trajectory
   plot_trajectory(peel_res, type = "b", pch = 16, col = "cornflowerblue", 
     support = 0.11, abline.pars = list(lwd = 2, col = "indianred"), 
     xlab = "")

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