1 |
x1 |
|
y1 |
|
x2 |
|
y2 |
|
regfun |
|
pts |
|
xlab |
|
ylab |
|
zlab |
|
xout |
|
outfun |
|
ALL |
|
pts.out |
|
SCAT |
|
theta |
|
phi |
|
ticktype |
|
pr |
|
... |
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 | ##---- 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, regfun = tsreg, pts = x1, xlab = "VAR 1",
ylab = "VAR 2", zlab = "Group 2 minus Group 1", xout = FALSE,
outfun = out, ALL = TRUE, pts.out = FALSE, SCAT = FALSE,
theta = 50, phi = 25, ticktype = "simple", pr = TRUE, ...)
{
if (!is.matrix(x1))
stop("x1 should be a matrix")
if (!is.matrix(x2))
stop("x2 should be a matrix")
if (!is.matrix(pts))
stop("pts should be a matrix")
if (ncol(x1) != 2)
stop("x1 should be a matrix with two columns")
if (ncol(x2) != 2)
stop("x2 should be a matrix with two columns")
if (ncol(pts) != 2)
stop("pts should be a matrix with two columns")
if (ALL)
pts = rbind(x1, x2)
if (pts.out) {
flag = outfun(pts, plotit = FALSE, ...)$keep
pts = pts[flag, ]
}
e1 = regYhat(x1, y1, xout = xout, regfun = regfun, outfun = outfun,
xr = pts, ...)
e2 = regYhat(x2, y2, xout = xout, regfun = regfun, outfun = outfun,
xr = pts, ...)
if (SCAT) {
library(scatterplot3d)
scatterplot3d(cbind(pts, e2 - e1), xlab = xlab, ylab = ylab,
zlab = zlab)
}
if (!SCAT)
rplot(pts, e2 - e1, xlab = xlab, ylab = ylab, zlab = zlab,
theta = theta, phi = phi, pr = FALSE, ticktype = ticktype,
prm = FALSE)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.