1 |
x1 |
|
y1 |
|
x2 |
|
y2 |
|
xout |
|
outfun |
|
est |
|
pcrit |
|
p.crit |
|
iter |
|
nboot |
|
SEED |
|
MC |
|
nmin |
|
pts |
|
fr1 |
|
fr2 |
|
xlab |
|
ylab |
|
LP |
|
... |
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 | ##---- 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 = outpro, est = tmean,
pcrit = NULL, p.crit = NULL, iter = 100, nboot = 500, SEED = TRUE,
MC = FALSE, nmin = 12, pts = NULL, fr1 = 1, fr2 = 1, xlab = "X",
ylab = "Y", LP = TRUE, ...)
{
if (is.null(pts))
stop("pts should be specified")
if (SEED)
set.seed(2)
x1 <- as.matrix(x1)
p1 <- ncol(x1) + 1
p <- ncol(x1)
if (p > 1)
stop("Current version is for one independent variable only")
xy <- cbind(x1, y1)
xy <- elimna(xy)
x1 <- xy[, 1:p]
y1 <- xy[, p1]
xy <- cbind(x2, y2)
xy <- elimna(xy)
x2 <- xy[, 1:p]
y2 <- xy[, p1]
if (xout) {
m <- cbind(x1, y1)
flag <- outfun(x1, plotit = FALSE, ...)$keep
m <- m[flag, ]
x1 <- m[, 1:p]
y1 <- m[, p1]
m <- cbind(x2, y2)
flag <- outfun(x2, plotit = FALSE, ...)$keep
m <- m[flag, ]
x2 <- m[, 1:p]
y2 <- m[, p1]
}
N1 = length(y1)
N2 = length(y2)
if (length(pts) < 2)
stop("Should have at least two points (With one point, use the R function ancova)")
g1 = list()
g2 = list()
for (i in 1:length(pts)) {
g1[[i]] <- y1[near(x1, pts[i], fr1)]
g2[[i]] <- y2[near(x2, pts[i], fr2)]
}
n1 = lapply(g1, length)
nv = (min(as.vector(matl(n1))))
res = aov2depth(g1, g2, est = est, SEED = SEED, nboot = nboot,
nmin = nmin, ...)$p.value
res
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.