rdplot:

Usage Arguments Examples

Usage

1
rdplot(x, fr = NA, plotit = TRUE, theta = 50, phi = 25, expand = 0.5, pyhat = FALSE, pts = NA, xlab = "X", ylab = "", ticktype = "simple")

Arguments

x
fr
plotit
theta
phi
expand
pyhat
pts
xlab
ylab
ticktype

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
##---- 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, fr = NA, plotit = TRUE, theta = 50, phi = 25, expand = 0.5, 
    pyhat = FALSE, pts = NA, xlab = "X", ylab = "", ticktype = "simple") 
{
    plotit <- as.logical(plotit)
    x <- elimna(x)
    x <- as.matrix(x)
    rmd <- NA
    if (ncol(x) == 1) {
        if (is.na(fr)) 
            fr <- 0.8
        if (is.na(pts[1])) 
            pts <- x
        for (i in 1:length(pts)) {
            rmd[i] <- sum(near(x, pts[i], fr))
        }
        if (mad(x) != 0) 
            rmd <- rmd/(2 * fr * mad(x))
        rmd <- rmd/length(x)
        if (plotit) {
            plot(pts, rmd, type = "n", ylab = ylab, xlab = xlab)
            sx <- sort(pts)
            xorder <- order(pts)
            sysm <- rmd[xorder]
            lines(sx, sysm)
        }
    }
    if (ncol(x) > 1) {
        library(MASS)
        if (is.na(fr)) 
            fr <- 0.6
        m <- cov.mve(x)
        for (i in 1:nrow(x)) {
            rmd[i] <- sum(near3d(x, x[i, ], fr, m))
        }
        rmd <- rmd/nrow(x)
        if (plotit && ncol(x) == 2) {
            library(akima)
            fitr <- rmd
            iout <- c(1:length(fitr))
            nm1 <- length(fitr) - 1
            for (i in 1:nm1) {
                ip1 <- i + 1
                for (k in ip1:length(fitr)) if (sum(x[i, ] == 
                  x[k, ]) == 2) 
                  iout[k] <- 0
            }
            fitr <- fitr[iout >= 1]
            mkeep <- x[iout >= 1, ]
            fit <- interp(mkeep[, 1], mkeep[, 2], fitr)
            persp(fit, theta = theta, phi = phi, expand = expand, 
                xlab = "Var 1", ylab = "Var 2", zlab = "", ticktype = ticktype)
        }
    }
    if (pyhat) 
        last <- rmd
    if (!pyhat) 
        last <- "Done"
    last
  }

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