ancdes <-
function(x,depfun=fdepth,DH=FALSE,FRAC=.5,...){
#
# Choose points for design of an ANCOVA
# x is the n by p matrix m.
#
# FRAC some value between 0 and 1.
#
# FRAC is the fraction of the least deep points that will not be returned when
# DH=TRUE
# That is, return 1-FRAC deepest points.
# For example, FRAC=.2 means that the deepest 80% of the
# data will be returned.
#
# DH=F, return deepest point and those points on the
# .5 depth contour
#
if(is.data.frame(x))x=as.matrix(x)
if(!is.matrix(x))stop("x must be a matrix or a data frame")
temp<-depfun(x,plotit=FALSE,...)
temp2<-order(temp)
if(!DH){
val<-matrix(x[temp2[length(temp)],],ncol=ncol(x))
nmid<-round(length(temp)/2)
id2<-(temp[temp2[nmid]]==temp)
val2<-matrix(x[id2,],ncol=ncol(x))
if(!is.matrix(val2))val2<-t(as.matrix(val2))
val<-rbind(val,val2)
}
if(DH){
bot=round(length(temp)*FRAC)
val=matrix(x[temp2[bot:length(temp)],],ncol=ncol(x))
}
val=elimna(val)
val
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.