1 |
x |
|
y |
|
pcor |
|
regfun |
|
corfun |
|
outkeep |
|
outfun |
|
varfun |
|
op |
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 | ##---- 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, pcor = FALSE, regfun = tsreg, corfun = pbcor,
outkeep = FALSE, outfun = outmgvf, varfun = pbvar, op = TRUE)
{
xx <- elimna(cbind(x, y))
pval <- 1
if (is.matrix(x))
pval <- ncol(x)
pp <- pval + 1
x <- xx[, 1:pval]
y <- xx[, pp]
x <- as.matrix(x)
flag <- rep(T, nrow(x))
temp <- regfun(x, y)
ip <- ncol(x) + 1
yhat <- y - temp$res
if (!outkeep) {
temp <- outfun(cbind(x, y), plotit = FALSE)$out.id
flag[temp] <- F
}
epow1 <- varfun(yhat[flag])/varfun(y[flag])
if (pcor)
epow2 <- cor(yhat[flag], y[flag])^2
if (!pcor)
epow2 <- corfun(yhat[flag], y[flag])$cor^2
if (op)
est <- epow2
if (!op)
est <- epow1
est
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.