R/mregdepth.R

Defines functions mregdepth

mregdepth <- function(coef, x, y, ndir = 1000) {

  if (is.null(dim(x))) {
    x <- matrix(x, ncol = 1)
  }

  yest <- cbind(1, x) %*% coef
  res <- y - yest
  u <- runifsphere(ndir, length(coef))
  rdtmp <- as.vector(res) / t(u %*% t(cbind(1, x))) < 0
  min(colSums(rdtmp))
}

Try the DepthProc package in your browser

Any scripts or data that you put into this service are public.

DepthProc documentation built on Feb. 4, 2022, 1:07 a.m.