1 |
x |
|
y |
|
SEED |
|
xout |
|
outfun |
|
initreg |
|
... |
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 | ##---- 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, SEED = TRUE, xout = FALSE, outfun = outpro, initreg = chregF,
...)
{
if (xout) {
x <- as.matrix(x)
flag <- outfun(x, plotit = plotit, ...)$keep
x <- x[flag, ]
y <- y[flag]
x <- as.matrix(x)
}
x <- as.matrix(x)
X <- cbind(x, y)
X <- elimna(X)
np <- ncol(X)
npm1 = np - 1
x = X[, 1:npm1]
x = as.matrix(x)
y = X[, np]
N <- np - 1
temp <- initreg(x, y, SEED = SEED)$coef
START <- temp[2:np]
temp <- nelder(X, N, FN = snmreg.sub, START = START)
alpha <- median(y - x %*% temp)
coef <- c(alpha, temp)
res <- y - x %*% temp - alpha
list(coef = coef, residuals = res)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.