1 | ffplot(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 27 28 29 | ##---- 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 = 6)
lsfit <- y - lsfit(x, y)$residuals
print("got OLS")
l1fit <- y - l1fit(x, y)$residuals
print("got L1")
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] <- l1fit
rmat[, 4] <- almsfit
rmat[, 5] <- altsfit
rmat[, 6] <- MBAFIT
pairs(rmat, labels = c("Y", "OLS Fit", "L1 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.