qsm:

Usage Arguments Examples

Usage

1
qsm(x, y, qval = c(0.2, 0.5, 0.8), fr = 0.8, plotit = TRUE, scat = TRUE, pyhat = FALSE, eout = FALSE, xout = FALSE, outfun = out, op = TRUE, LP = TRUE, xlab = "X", ylab = "Y")

Arguments

x
y
qval
fr
plotit
scat
pyhat
eout
xout
outfun
op
LP
xlab
ylab

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
51
52
53
54
55
56
57
58
59
##---- 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, qval = c(0.2, 0.5, 0.8), fr = 0.8, plotit = TRUE, 
    scat = TRUE, pyhat = FALSE, eout = FALSE, xout = FALSE, outfun = out, 
    op = TRUE, LP = TRUE, xlab = "X", ylab = "Y") 
{
    plotit <- as.logical(plotit)
    scat <- as.logical(scat)
    m <- cbind(x, y)
    if (ncol(m) != 2) 
        stop("Must have exactly one predictor. For more than one, use qhdsm.")
    m <- elimna(m)
    x <- m[, 1]
    y <- m[, 2]
    if (eout && xout) 
        stop("Not allowed to have eout=xout=T")
    if (eout) {
        flag <- outfun(m, plotit = FALSE)$keep
        m <- m[flag, ]
    }
    if (xout) {
        flag <- outfun(x)$keep
        m <- m[flag, ]
    }
    x <- m[, 1]
    y <- m[, 2]
    rmd <- c(1:length(x))
    if (pyhat) 
        outval <- matrix(NA, ncol = length(qval), nrow = length(x))
    if (scat) 
        plot(x, y, xlab = xlab, ylab = ylab)
    if (!scat) 
        plot(x, y, type = "n", xlab = xlab, ylab = ylab)
    for (it in 1:length(qval)) {
        if (!op) 
            for (i in 1:length(x)) rmd[i] <- qest(y[near(x, x[i], 
                fr)], q = qval[it])
        if (op) 
            for (i in 1:length(x)) rmd[i] <- hd(y[near(x, x[i], 
                fr)], q = qval[it])
        if (pyhat) 
            outval[, it] <- rmd
        points(x, rmd, type = "n")
        sx <- sort(x)
        xorder <- order(x)
        sysm <- rmd[xorder]
        if (LP) 
            sysm = lplot(sx, sysm, pyhat = TRUE, plotit = FALSE)$yhat.values
        lines(sx, sysm)
    }
    if (pyhat) 
        output <- outval
    if (!pyhat) 
        output <- "Done"
    list(output = output)
  }

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