runmean:

Usage Arguments Examples

Usage

1
runmean(x, y, fr = 1, tr = 0.2, pyhat = FALSE, eout = FALSE, outfun = out, plotit = TRUE, xout = FALSE, xlab = "x", ylab = "y")

Arguments

x
y
fr
tr
pyhat
eout
outfun
plotit
xout
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
##---- 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, fr = 1, tr = 0.2, pyhat = FALSE, eout = FALSE, 
    outfun = out, plotit = TRUE, xout = FALSE, xlab = "x", ylab = "y") 
{
    if (eout && xout) 
        xout <- F
    temp <- cbind(x, y)
    temp <- elimna(temp)
    if (eout) {
        flag <- outfun(temp, plotit = FALSE)$keep
        temp <- temp[flag, ]
    }
    if (xout) {
        flag <- outfun(x, plotit = FALSE)$keep
        temp <- temp[flag, ]
    }
    x <- temp[, 1]
    y <- temp[, 2]
    pyhat <- as.logical(pyhat)
    rmd <- c(1:length(x))
    for (i in 1:length(x)) rmd[i] <- mean(y[near(x, x[i], fr)], 
        tr)
    if (pyhat) 
        return(rmd)
    if (plotit) {
        plot(x, y, xlab = xlab, ylab = ylab)
        sx <- sort(x)
        xorder <- order(x)
        sysm <- rmd[xorder]
        tempx <- (!duplicated(sx))
        lines(sx[tempx], sysm[tempx])
    }
  }

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