tshd:

Usage Arguments Examples

Usage

1
tshd(x, y, HD = TRUE, plotit = FALSE, xlab = "X", ylab = "Y", OPT = FALSE)

Arguments

x
y
HD
plotit
xlab
ylab
OPT

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
##---- 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, HD = TRUE, plotit = FALSE, xlab = "X", ylab = "Y", 
    OPT = FALSE) 
{
    temp <- matrix(c(x, y), ncol = 2)
    temp <- elimna(temp)
    x <- temp[, 1]
    y <- temp[, 2]
    ord <- order(x)
    xs <- x[ord]
    ys <- y[ord]
    vec1 <- outer(ys, ys, "-")
    vec2 <- outer(xs, xs, "-")
    v1 <- vec1[vec2 > 0]
    v2 <- vec2[vec2 > 0]
    if (!HD) 
        slope <- median(v1/v2, na.rm = TRUE)
    if (HD) 
        slope <- hd(v1/v2, na.rm = TRUE)
    res = y - slope * x
    if (!OPT) 
        int = hd(res)
    if (OPT) 
        int = hd(y, na.rm = TRUE) - slope * hd(x, na.rm = TRUE)
    coef = c(int, slope)
    if (plotit) {
        plot(x, y, xlab = xlab, ylab = ylab)
        abline(coef)
    }
    list(coef = coef)
  }

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