1 |
x |
|
y |
|
cov.fun |
|
loc.fun |
|
xout |
|
outfun |
|
... |
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 | ##---- 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, cov.fun = MARest, loc.fun = MARest, xout = FALSE,
outfun = out, ...)
{
xy = elimna(cbind(x, y))
p1 = ncol(xy)
p = p1 - 1
x = xy[, 1:p]
y = xy[, p1]
x <- as.matrix(x)
if (xout) {
x <- as.matrix(x)
flag <- outfun(x, ...)$keep
x <- x[flag, ]
y <- y[flag]
x <- as.matrix(x)
}
AC = cov.fun(cbind(x, y), ...)$cov
ma <- AC[1:p, p1]
m <- AC[1:p, 1:p]
slope <- solve(m, ma)
mvals <- loc.fun(cbind(x, y))$center
b0 <- mvals[p1] - sum(slope %*% mvals[1:p])
res <- y - x %*% slope - b0
list(coef = c(b0, slope), residuals = res)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.