hratio:

Usage Arguments Examples

Usage

1
hratio(x, y, regfun = bmreg)

Arguments

x
y
regfun

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
##---- 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, regfun = bmreg) 
{
    x <- as.matrix(x)
    xmat <- matrix(0, nrow(x), ncol(x))
    mval <- floor(length(y)/2)
    mr <- length(y) - mval
    xmatl <- matrix(0, mval, ncol(x))
    xmatr <- matrix(0, mr, ncol(x))
    hmat <- matrix(NA, ncol(x), ncol(x))
    isub <- c(1:length(y))
    ksub <- c(1:ncol(x)) + 1
    for (k in 1:ncol(x)) {
        xord <- order(x[, k])
        yord <- y[xord]
        yl <- yord[isub <= mval]
        yr <- yord[isub > mval]
        for (j in 1:ncol(x)) {
            xmat[, j] <- x[xord, j]
            xmatl[, j] <- xmat[isub <= mval, j]
            xmatr[, j] <- xmat[isub > mval, j]
        }
        coefl <- regfun(xmatl, yl)$coef
        coefr <- regfun(xmatr, yr)$coef
        hmat[k, ] <- coefr[ksub[ksub >= 2]]/coefl[ksub[ksub >= 
            2]]
    }
    hmat
  }

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