akerd:

Usage Arguments Examples

Usage

1
akerd(xx, hval = NA, aval = 0.5, op = 1, fr = 0.8, pyhat = FALSE, pts = NA, plotit = TRUE, xlab = "", ylab = "", zlab = "", theta = 50, phi = 25, expand = 0.5, scale = TRUE, ticktype = "simple", color = "black")

Arguments

xx
hval
aval
op
fr
pyhat
pts
plotit
xlab
ylab
zlab
theta
phi
expand
scale
ticktype
color

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
##---- 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 (xx, hval = NA, aval = 0.5, op = 1, fr = 0.8, pyhat = FALSE, 
    pts = NA, plotit = TRUE, xlab = "", ylab = "", zlab = "", 
    theta = 50, phi = 25, expand = 0.5, scale = TRUE, ticktype = "simple", 
    color = "black") 
{
    xx = elimna(xx)
    fval <- "Done"
    if (is.matrix(xx)) {
        if (ncol(xx) > 1) 
            fval <- akerdmul(xx, pts = pts, hval = hval, aval = aval, 
                fr = fr, pr = pyhat, plotit = plotit, theta = theta, 
                phi = phi, expand = expand, scale = scale, ticktype = ticktype)
        plotit <- F
    }
    if (is.matrix(xx) && ncol(xx) == 1) 
        xx <- xx[, 1]
    if (!is.matrix(xx)) {
        x <- sort(xx)
        if (op == 1) {
            m <- mad(x)
            if (m == 0) {
                temp <- idealf(x)
                m <- (temp$qu - temp$ql)/(qnorm(0.75) - qnorm(0.25))
            }
            if (m == 0) 
                m <- sqrt(winvar(x)/0.4129)
            if (m == 0) 
                stop("All measures of dispersion are equal to 0")
            fhat <- rdplot(x, pyhat = TRUE, plotit = FALSE, fr = fr)
            if (m > 0) 
                fhat <- fhat/(2 * fr * m)
        }
        if (op == 2) {
            init <- density(xx)
            fhat <- init$y
            x <- init$x
        }
        n <- length(x)
        if (is.na(hval)) {
            sig <- sqrt(var(x))
            temp <- idealf(x)
            iqr <- (temp$qu - temp$ql)/1.34
            A <- min(c(sig, iqr))
            if (A == 0) 
                A <- sqrt(winvar(x))/0.64
            hval <- 1.06 * A/length(x)^(0.2)
        }
        gm <- exp(mean(log(fhat[fhat > 0])))
        alam <- (fhat/gm)^(0 - aval)
        dhat <- NA
        if (is.na(pts[1])) 
            pts <- x
        pts <- sort(pts)
        for (j in 1:length(pts)) {
            temp <- (pts[j] - x)/(hval * alam)
            epan <- ifelse(abs(temp) < sqrt(5), 0.75 * (1 - 0.2 * 
                temp^2)/sqrt(5), 0)
            dhat[j] <- mean(epan/(alam * hval))
        }
        if (plotit) {
            plot(pts, dhat, type = "n", ylab = ylab, xlab = xlab)
            lines(pts, dhat, col = color)
        }
        if (pyhat) 
            fval <- dhat
    }
    fval
  }

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