g2plot:

Usage Arguments Examples

Usage

1
g2plot(x1, x2, op = 4, rval = 15, fr = 0.8, aval = 0.5, xlab = "X", ylab = "")

Arguments

x1
x2
op
rval
fr
aval
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
##---- 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 (x1, x2, op = 4, rval = 15, fr = 0.8, aval = 0.5, xlab = "X", 
    ylab = "") 
{
    x1 <- elimna(x1)
    x2 <- elimna(x2)
    if (op == 3) {
        rd2plot(x1, x2, fr = fr, xlab = xlab, ylab = ylab)
        print("Might consider using op=4 if graph is ragged")
    }
    if (op == 2) {
        tempx <- density(x1, na.rm = TRUE, kernel = "epanechnikov")
        tempy <- density(x2, na.rm = TRUE, kernel = "epanechnikov")
        plot(c(tempx$x, tempy$x), c(tempx$y, tempy$y), type = "n", 
            xlab = xlab, ylab = ylab)
        lines(tempx$x, tempx$y)
        lines(tempy$x, tempy$y, lty = 2)
    }
    if (op == 1) {
        y1 <- sort(x1)
        z1 <- 1
        z2 <- 1
        par(yaxt = "n")
        temp <- floor(0.01 * length(x1))
        if (temp == 0) 
            temp <- 5
        ibot <- y1[temp]
        itop <- y1[floor(0.99 * length(x1))]
        xaxis1 <- seq(ibot, itop, length = rval)
        for (i in 1:rval) z1[i] <- kerden(x1, 0, xaxis1[i])
        y2 <- sort(x2)
        temp <- floor(0.01 * length(x2))
        if (temp == 0) 
            temp <- 5
        ibot <- y2[temp]
        itop <- y2[floor(0.99 * length(x2))]
        xaxis2 <- seq(ibot, itop, length = rval)
        for (i in 1:rval) z2[i] <- kerden(x2, 0, xaxis2[i])
        plot(c(xaxis1, xaxis2), c(z1, z2), xlab = xlab, ylab = ylab, 
            type = "n")
        lines(xaxis1, z1)
        lines(xaxis2, z2, lty = 2)
    }
    if (op == 4) {
        x1 <- sort(x1)
        x2 <- sort(x2)
        z1 <- akerd(x1, aval = aval, fr = fr, pyhat = TRUE, plotit = FALSE)
        z2 <- akerd(x2, aval = aval, fr = fr, pyhat = TRUE, plotit = FALSE)
        plot(c(x1, x2), c(z1, z2), xlab = xlab, ylab = ylab, 
            type = "n")
        lines(x1, z1)
        lines(x2, z2, lty = 2)
    }
  }

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