R/madOutPair.R

Defines functions madOutPair

Documented in madOutPair

madOutPair <- function(x,whichPair,c=4){

  lb <- median(x)-c*mad(x)
  ub <- median(x)+c*mad(x)

  test1 <- (x[whichPair[1]] > ub) |  (x[whichPair[1]] < lb)
  test2 <- (x[whichPair[2]] > ub) |  (x[whichPair[2]] < lb)

  singleOut <- NA	  
  if(xor(test1,test2)){
    singleOut <- whichPair[which.max(c(test1,test2))]
  }

  return(singleOut)
    
}

  

Try the factDesign package in your browser

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

factDesign documentation built on Nov. 8, 2020, 8:32 p.m.