rungen:

Usage Arguments Examples

Usage

1
rungen(x, y, est = onestep, fr = 1, plotit = TRUE, scat = TRUE, pyhat = FALSE, eout = FALSE, xout = FALSE, xlab = "x", ylab = "y", outfun = out, LP = TRUE, pch = ".", ...)

Arguments

x
y
est
fr
plotit
scat
pyhat
eout
xout
xlab
ylab
outfun
LP
pch
...

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
##---- 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, est = onestep, fr = 1, plotit = TRUE, scat = TRUE, 
    pyhat = FALSE, eout = FALSE, xout = FALSE, xlab = "x", ylab = "y", 
    outfun = out, LP = TRUE, pch = ".", ...) 
{
    plotit <- as.logical(plotit)
    scat <- as.logical(scat)
    m <- cbind(x, y)
    m <- elimna(m)
    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(m[, 1])$keep
        m <- m[flag, ]
    }
    x = m[, 1]
    y = m[, 2]
    rmd <- c(1:length(x))
    for (i in 1:length(x)) rmd[i] <- est(y[near(x, x[i], fr)], 
        ...)
    if (LP) {
        ord = order(x)
        x = x[ord]
        rmd = rmd[ord]
        y = y[ord]
        rmd = lplot(x, rmd, plotit = FALSE, pyhat = TRUE, pr = FALSE)$yhat
    }
    if (plotit) {
        if (scat) {
            plot(c(x, x), c(y, rmd), xlab = xlab, ylab = ylab, 
                type = "n")
            points(x, y, pch = pch)
        }
        if (!scat) 
            plot(c(x, x), c(y, rmd), type = "n", ylab = ylab, 
                xlab = xlab)
        points(x, rmd, type = "n")
        sx <- sort(x)
        xorder <- order(x)
        sysm <- rmd[xorder]
        lines(sx, sysm)
    }
    if (pyhat) 
        output <- rmd
    if (!pyhat) 
        output <- "Done"
    list(output = output)
  }

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