1 |
x |
|
y |
|
xr |
|
regfun |
|
xout |
|
outfun |
|
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 | ##---- 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, xr = x, regfun = tsreg, xout = FALSE, outfun = outpro,
pr = FALSE, ...)
{
xy = elimna(cbind(x, y))
x <- as.matrix(x)
p = ncol(x)
p1 = p + 1
vals = NA
x <- xy[, 1:p]
y <- xy[, p1]
if (xout) {
m <- cbind(x, y)
flag <- outfun(x, plotit = FALSE, ...)$keep
m <- m[flag, ]
x <- m[, 1:p]
y <- m[, p1]
}
est = regfun(x, y, ...)$coef
xr = as.matrix(xr)
yhat = est[1] + xr %*% est[2:p1]
yhat
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.