reg2g.p2plot:

Usage Arguments Examples

Usage

1
reg2g.p2plot(x1, y1, x2, y2, xout = FALSE, outfun = out, xlab = "Var 1", ylab = "Var 2", zlab = "Var 3", regfun = tsreg, COLOR = TRUE, STAND = TRUE, tick.marks = TRUE, type = "p", pr = TRUE, ...)

Arguments

x1
y1
x2
y2
xout
outfun
xlab
ylab
zlab
regfun
COLOR
STAND
tick.marks
type
pr
...

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
##---- 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, y1, x2, y2, xout = FALSE, outfun = out, xlab = "Var 1", 
    ylab = "Var 2", zlab = "Var 3", regfun = tsreg, COLOR = TRUE, 
    STAND = TRUE, tick.marks = TRUE, type = "p", pr = TRUE, ...) 
{
    x1 = as.matrix(x1)
    x2 = as.matrix(x2)
    if (ncol(x1) != 2) 
        stop("Argument x1 must be stored in a matrix with 2 columns.")
    if (ncol(x2) != 2) 
        stop("Argument x2 must be stored in a matrix with 2 columns.")
    xy1 <- elimna(cbind(x1, y1))
    xy2 <- elimna(cbind(x2, y2))
    if (xout) {
        if (!STAND) 
            flag1 = outfun(xy1[, 1:2], plotit = FALSE, ...)$keep
        if (STAND) 
            flag1 = outpro(xy1[, 1:2], plotit = FALSE, STAND = TRUE, 
                ...)$keep
        if (!STAND) 
            flag2 = outfun(xy2[, 1:2], plotit = FALSE, ...)$keep
        if (STAND) 
            flag2 = outpro(xy2[, 1:2], plotit = FALSE, STAND = TRUE, 
                ...)$keep
        xy1 = xy1[flag1, ]
        xy2 = xy2[flag2, ]
    }
    x1 = xy1[, 1:2]
    x2 = xy2[, 1:2]
    y1 = xy1[, 3]
    y2 = xy2[, 3]
    library(scatterplot3d)
    temp <- scatterplot3d(rbind(xy1, xy2), xlab = xlab, ylab = ylab, 
        zlab = zlab, tick.marks = tick.marks, type = type)
    vals1 <- regfun(x1, y1, ...)$coef
    vals2 <- regfun(x2, y2, ...)$coef
    if (COLOR) {
        if (pr) 
            print("First group is blue")
        temp$plane(vals1, col = "blue")
        temp$plane(vals2, col = "red")
    }
    if (!COLOR) {
        temp$plane(vals1)
        temp$plane(vals2)
    }
    list(coef.group.1 = vals1, coef.group.2 = vals2)
  }

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