1  | 
m | 
|
pts | 
|
zloc | 
|
zscale | 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28  | ##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.
## The function is currently defined as
function (m, pts = m, zloc = median, zscale = mad) 
{
    if (!is.matrix(m)) 
        stop("argument m should be a matrix")
    if (!is.matrix(pts)) 
        stop("argument pts should be a matrix")
    if (ncol(m) != ncol(pts)) 
        stop("Number of columns for m and pts are not equal")
    np <- ncol(m)
    val <- NA
    for (i in 1:nrow(pts)) {
        pval <- pts[i, ]
        START <- rep(1, np)/sqrt(np)
        temp <- nelderv2(m, np, FN = zdepth.sub, START = START, 
            zloc = zloc, zscale = zscale, pts = pval)
        temp <- temp/sqrt(sum(temp^2))
        y <- t(t(m) * temp)
        y <- apply(y, 1, sum)
        ppro <- sum(pval * temp)
        val[i] <- abs(ppro - zloc(y))/zscale(y)
    }
    val
  }
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.