1 | ffplot2(x, y, nsamps = 7)
|
x |
|
y |
|
nsamps |
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 | ##---- 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, nsamps = 7)
{
n <- length(y)
rmat <- matrix(nrow = n, ncol = 5)
lsfit <- y - lsfit(x, y)$residuals
print("got OLS")
almsfit <- y - lmsreg(x, y)$resid
print("got ALMS")
altsfit <- y - ltsreg(x, y)$residuals
print("got ALTS")
mbacoef <- mbareg(x, y, nsamp = nsamps)$coef
MBAFIT <- mbacoef[1] + x %*% mbacoef[-1]
print("got MBA")
rmat[, 1] <- y
rmat[, 2] <- lsfit
rmat[, 3] <- almsfit
rmat[, 4] <- altsfit
rmat[, 5] <- MBAFIT
pairs(rmat, labels = c("Y", "OLS Fit", "ALMS Fit", "ALTS Fit",
"MBAREG Fit"))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.