locvarsm:

Usage Arguments Examples

Usage

1
locvarsm(x, y, pyhat = FALSE, pts = x, plotit = TRUE, nboot = 40, RNA = TRUE, xlab = "X", ylab = "VAR(Y|X)", op = 2, xout = T, eout = FALSE, pr = TRUE, fr = 0.6, scat = TRUE, outfun = out, SEED = TRUE)

Arguments

x
y
pyhat
pts
plotit
nboot
RNA
xlab
ylab
op
xout
eout
pr
fr
scat
outfun
SEED

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, pyhat = FALSE, pts = x, plotit = TRUE, nboot = 40, 
    RNA = TRUE, xlab = "X", ylab = "VAR(Y|X)", op = 2, xout = T, 
    eout = FALSE, pr = TRUE, fr = 0.6, scat = TRUE, outfun = out, 
    SEED = TRUE) 
{
    if (SEED) 
        set.seed(2)
    temp <- cbind(x, y)
    temp <- elimna(temp)
    x <- temp[, 1]
    y <- temp[, 2]
    if (op == 2) {
        if (pr) {
            print("Running interval method plus bagging has been chosen")
            print("op=1 will use Fan's method plus bagging")
        }
    }
    if (op == 1) {
        if (pr) {
            print("Fan's method plus bagging has been chosen (cf. Bjerve and Doksum)")
            print("op=2 will use running interval plus bagging")
        }
        mat <- matrix(NA, nrow = nboot, ncol = nrow(temp))
        for (it in 1:nboot) {
            idat <- sample(c(1:length(y)), replace = T)
            xx <- temp[idat, 1]
            yy <- temp[idat, 2]
            mat[it, ] <- locvar(xx, yy, pts = x, pyhat = TRUE, 
                plotit = FALSE)
        }
        rmd <- apply(mat, 2, mean)
        if (plotit) {
            plot(c(x, x), c(y, rmd), type = "n", xlab = xlab, 
                ylab = ylab)
            sx <- sort(x)
            xorder <- order(x)
            sysm <- rmd[xorder]
            lines(sx, sysm)
        }
        output <- "Done"
        if (pyhat) 
            output <- rmd
    }
    if (op == 2) {
        output <- runmbo(x, y, fr = fr, est = var, xlab = xlab, 
            ylab = ylab, pyhat = pyhat, eout = eout, xout = xout, 
            RNA = RNA, plotit = plotit, scat = scat, nboot = nboot, 
            outfun = outfun, SEED = SEED)
    }
    output
  }

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