ecor:

Usage Arguments Examples

Usage

1
ecor(x, y, pcor = FALSE, regfun = tsreg, corfun = pbcor, outkeep = FALSE, outfun = outmgvf)

Arguments

x
y
pcor
regfun
corfun
outkeep
outfun

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
##---- 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 (x, y, pcor = FALSE, regfun = tsreg, corfun = pbcor, 
    outkeep = FALSE, outfun = outmgvf) 
{
    xx <- elimna(cbind(x, y))
    x <- xx[, 1]
    y <- xx[, 2]
    x <- as.matrix(x)
    if (ncol(x) > 1) 
        stop("x must be a vector or matrix with one column")
    flag <- rep(T, nrow(x))
    if (!outkeep) {
        temp <- outfun(cbind(x, y))$out.id
        flag[temp] <- F
    }
    coef <- regfun(x, y)$coef
    ip <- ncol(x) + 1
    yhat <- x %*% coef[2:ip] + coef[1]
    if (pcor) 
        epow2 <- cor(yhat[flag], y[flag])^2
    if (!pcor) 
        epow2 <- corfun(yhat[flag], y[flag])$cor^2
    ecor <- sqrt(epow2) * sign(coef[2])
    ecor
  }

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