1 |
x |
|
y |
|
regfun |
|
cop |
|
fast |
|
pr |
|
prres |
|
STAND |
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, regfun = tsregMC, cop = 3, fast = FALSE, pr = TRUE,
prres = FALSE, STAND = TRUE)
{
library(parallel)
x <- as.matrix(x)
m <- cbind(x, y)
m <- elimna(m)
ivec <- outproMC(m, plotit = FALSE, cop = cop, fast = FALSE,
pr = FALSE, STAND = STAND)$keep
np1 <- ncol(x) + 1
coef <- regfun(m[ivec, 1:ncol(x)], m[ivec, np1])$coef
vec <- rep(1, length(y))
residuals <- y - cbind(vec, x) %*% coef
if (fast && pr) {
print("Intercept, followed by slopes:")
print(coef)
if (prres) {
print("Residuals:")
print(residuals)
}
}
list(coef = coef, residuals = residuals)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.