1 |
x |
|
y |
|
xout |
|
outfun |
|
xlab |
|
ylab |
|
zlab |
|
regfun |
|
COLOR |
|
tick.marks |
|
... |
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 | ##---- 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, xout = FALSE, outfun = out, xlab = "Var 1", ylab = "Var 2",
zlab = "Var 3", regfun = tsreg, COLOR = FALSE, tick.marks = TRUE,
...)
{
x = as.matrix(x)
if (ncol(x) != 2)
stop("Argument x must be stored in a matrix with 2 columns.")
xy <- elimna(cbind(x, y))
if (xout) {
flag = outfun(xy[, 1:2])$keep
xy = xy[flag, ]
}
x = xy[, 1:2]
y = xy[, 3]
library(scatterplot3d)
temp <- scatterplot3d(xy, xlab = xlab, ylab = ylab, zlab = zlab,
tick.marks = tick.marks)
vals <- regfun(x, y, ...)$coef
if (COLOR)
temp$plane(vals, col = "blue")
if (!COLOR)
temp$plane(vals)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.