R/min_MD.R

Defines functions min_MD

min_MD <- function(x, mu, Sigma_inv = NULL, S = numeric()){
  mu_tilde <- numeric()
  p <- length(x)
  if(p != length(S)){
    for(j in 1:p){
      sub <- unique(c(S, j))
      mu_tilde[j] <- (x[j]  - solve(Sigma_inv[sub,sub])[,which(sub == j)]%*%Sigma_inv[sub,]%*%(x - mu))
    }
  } else {
    mu_tilde <- mu
  }
  return(mu_tilde)
}

Try the ShapleyOutlier package in your browser

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

ShapleyOutlier documentation built on Oct. 17, 2024, 5:08 p.m.