rplotpbCI:

Usage Arguments Examples

Usage

1
rplotpbCI(x, y, est = onestep, fr = 1, plotit = TRUE, scat = TRUE, pyhat = FALSE, xout = FALSE, xlab = "x", ylab = "y", outfun = out, LP = TRUE, alpha = 0.05, nboot = 500, SEED = TRUE, ...)

Arguments

x
y
est
fr
plotit
scat
pyhat
xout
xlab
ylab
outfun
LP
alpha
nboot
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
##---- 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, xout = FALSE, xlab = "x", ylab = "y", outfun = out, 
    LP = TRUE, alpha = 0.05, nboot = 500, SEED = TRUE, ...) 
{
    plotit <- as.logical(plotit)
    scat <- as.logical(scat)
    m <- cbind(x, y)
    if (ncol(m) > 2) 
        stop("To get a smooth with more than one covariate, use rplot")
    m <- elimna(m)
    if (xout) {
        flag <- outfun(m[, 1])$keep
        m <- m[flag, ]
    }
    x = m[, 1]
    y = m[, 2]
    low = rep(NA, length(y))
    up = rep(NA, length(y))
    rmd <- NA
    for (i in 1:length(x)) {
        sel = y[near(x, x[i], fr)]
        temp = onesampb(sel, est = est, nboot = nboot, alpha = alpha, 
            SEED = SEED, ...)
        low[i] = temp$ci[1]
        up[i] = temp$ci[2]
        rmd[i] = temp$estimate
    }
    all = elimna(cbind(x, low, up, y, rmd))
    x = all[, 1]
    low = all[, 2]
    up = all[, 3]
    y = all[, 4]
    rmd = all[, 5]
    if (plotit) {
        ord = order(x)
        x = x[ord]
        rmd = rmd[ord]
        up = up[ord]
        low = low[ord]
        if (LP) {
            rmd = lplot(x, rmd, plotit = FALSE, pyhat = TRUE, 
                pr = FALSE)$yhat
            up = lplot(x, up, plotit = FALSE, pyhat = TRUE, pr = FALSE)$yhat
            low = lplot(x, low, plotit = FALSE, pyhat = TRUE, 
                pr = FALSE)$yhat
        }
        if (scat) {
            plot(c(x, x), c(y, rmd), xlab = xlab, ylab = ylab, 
                type = "n")
            lines(x, up, lty = 2)
            lines(x, low, lty = 2)
            points(x, y)
        }
        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)
        lines(x, up, lty = 2)
        lines(x, low, lty = 2)
    }
    if (pyhat) 
        output <- rmd
    if (!pyhat) 
        output <- "Done"
    list(output = output)
  }

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