qhomt:

Usage Arguments Examples

Usage

1
qhomt(x, y, nboot = 100, alpha = 0.05, qval = c(0.2, 0.8), plotit = TRUE, SEED = TRUE, xlab = "X", ylab = "Y", xout = FALSE, outfun = outpro, pr = TRUE, ...)

Arguments

x
y
nboot
alpha
qval
plotit
SEED
xlab
ylab
xout
outfun
pr
...

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
49
50
##---- 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, nboot = 100, alpha = 0.05, qval = c(0.2, 0.8), 
    plotit = TRUE, SEED = TRUE, xlab = "X", ylab = "Y", xout = FALSE, 
    outfun = outpro, pr = TRUE, ...) 
{
    if (length(qval) != 2) 
        stop("Argument qval should have 2 values exactly")
    x <- as.matrix(x)
    if (ncol(x) != 1) 
        stop("Only one predictor is allowed; use qhomtv2")
    xy <- elimna(cbind(x, y))
    x <- xy[, 1]
    x <- as.matrix(x)
    y <- xy[, 2]
    if (xout) {
        flag <- outfun(x, ...)$keep
        x <- as.matrix(x)
        x <- x[flag, ]
        y <- y[flag]
        x <- as.matrix(x)
    }
    if (SEED) 
        set.seed(2)
    if (pr) 
        print("Taking bootstrap samples. Please wait.")
    data <- matrix(sample(length(y), size = length(y) * nboot, 
        replace = TRUE), nrow = nboot)
    bvec <- apply(data, 1, qhomtsub, x, y, qval)
    se <- sqrt(var(bvec))
    temp <- qplotreg(x, y, qval = qval, plotit = plotit, xlab = xlab, 
        ylab = ylab)
    crit <- qnorm(1 - alpha/2)
    crit.ad <- NA
    dimnames(temp) = c(NULL, NULL)
    dif <- temp[2, 2] - temp[1, 2]
    regci <- NA
    regci[1] <- dif - crit * se
    regci[2] <- dif + crit * se
    sig.level <- 2 * (1 - pnorm(abs(dif)/se))
    regci.ad <- NA
    if (alpha == 0.05 && qval[1] == 0.2 && qval[2] == 0.8) 
        crit.ad <- qnorm(0 - 0.09/sqrt(length(y)) + 0.975)
    ci.ad <- c(dif - crit.ad * se, dif + crit.ad * se)
    list(slope.bottom = temp[1, 2], slope.top = temp[2, 2], dif.est = dif, 
        dif.ci = regci, sig.level = sig.level, se = se, adjusted.ci = ci.ad)
  }

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