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))
}
zzawadz/DepthProc documentation built on Feb. 4, 2022, 8:39 p.m.