gamplotINT:

Usage Arguments Examples

Usage

1
gamplotINT(x, y, pyhat = FALSE, plotit = TRUE, theta = 50, phi = 25, expand = 0.5, xout = FALSE, SCALE = FALSE, zscale = TRUE, eout = FALSE, outfun = out, ticktype = "simple", xlab = "X", ylab = "Y", zlab = "", ...)

Arguments

x
y
pyhat
plotit
theta
phi
expand
xout
SCALE
zscale
eout
outfun
ticktype
xlab
ylab
zlab
...

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
##---- 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, pyhat = FALSE, plotit = TRUE, theta = 50, phi = 25, 
    expand = 0.5, xout = FALSE, SCALE = FALSE, zscale = TRUE, 
    eout = FALSE, outfun = out, ticktype = "simple", xlab = "X", 
    ylab = "Y", zlab = "", ...) 
{
    if (eout && xout) 
        stop("Not allowed to have eout=xout=T")
    x <- as.matrix(x)
    if (ncol(x) != 2) 
        stop("x must be an n by 2 matrix")
    library(akima)
    library(mgcv)
    np = ncol(x)
    np1 = np + 1
    m <- elimna(cbind(x, y))
    x <- m[, 1:np]
    x <- as.matrix(x)
    y <- m[, np1]
    if (xout) {
        flag <- outfun(x, ...)$keep
        m <- m[flag, ]
    }
    if (eout) {
        flag <- outfun(m, ...)$keep
        m <- m[flag, ]
    }
    x1 <- m[, 1]
    x2 <- m[, 2]
    y <- m[, 3]
    xrem <- m[, 1:2]
    n <- nrow(x)
    fitr <- fitted(gam(y ~ s(x1) + s(x2) + s(x1, x2)))
    allfit <- fitr
    if (plotit) {
        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(xrem[i, ] == 
                xrem[k, ]) == 2) 
                iout[k] <- 0
        }
        fitr <- fitr[iout >= 1]
        mkeep <- xrem[iout >= 1, ]
        fit <- interp(mkeep[, 1], mkeep[, 2], fitr)
        persp(fit, theta = theta, phi = phi, expand = expand, 
            xlab = xlab, ylab = ylab, zlab = zlab, scale = scale, 
            ticktype = ticktype)
    }
    m <- "Done"
    if (pyhat) 
        m <- allfit
    m
  }

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