pdisMC:

Usage Arguments Examples

Usage

1
pdisMC(m, MM = FALSE, cop = 3, dop = 1, center = NA)

Arguments

m
MM
cop
dop
center

Examples

 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
##---- 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, MM = FALSE, cop = 3, dop = 1, center = NA) 
{
    library(parallel)
    m <- elimna(m)
    m <- as.matrix(m)
    if (ncol(m) == 1) {
        if (is.na(center[1])) 
            center <- median(m)
        dis <- abs(m[, 1] - center)
        if (!MM) {
            temp <- idealf(dis)
            pdis <- dis/(temp$qu - temp$ql)
        }
        if (MM) 
            pdis <- dis/mad(dis)
    }
    if (ncol(m) > 1) {
        if (is.na(center[1])) {
            if (cop == 1) 
                center <- dmean(m, tr = 0.5, dop = dop)
            if (cop == 2) 
                center <- cov.mcd(m, print = FALSE)$center
            if (cop == 3) 
                center <- apply(m, 2, median)
            if (cop == 4) 
                center <- cov.mve(m, print = FALSE)$center
            if (cop == 5) 
                center <- smean(m)
        }
        cenmat = matrix(rep(center, nrow(m)), ncol = ncol(m), 
            byrow = TRUE)
        Amat = m - cenmat
        B = listm(t(Amat))
        dis = mclapply(B, outproMC.sub, Amat, mc.preschedule = TRUE)
        if (!MM) {
            dmat <- mclapply(dis, IQRstand, mc.preschedule = TRUE)
        }
        if (MM) 
            dmat <- mclapply(dis, MADstand, mc.preschedule = TRUE)
        pdis <- apply(matl(dmat), 1, max, na.rm = TRUE)
    }
    pdis
  }

musto101/wilcox_R documentation built on May 23, 2019, 10:52 a.m.