rrplot <-
function(x, y, nsamps = 7)
{
# Makes an RR plot. Needs the mbareg function.
n <- length(y)
rmat <- matrix(nrow = n, ncol = 5)
lsres <- lsfit(x, y)$residuals
print("got OLS")
l1res <- l1fit(x, y)$residuals
print("got L1")
almsres <- lmsreg(x, y)$resid
print("got ALMS")
altsres <- ltsreg(x, y)$residuals
print("got ALTS")
out <- mba$coef
mbacoef <- mbareg(x, y, nsamp = nsamps)$coef
MBARES <- y - mbacoef[1] - x %*% mbacoef[-1]
print("got MBA")
rmat[, 1] <- lsres
rmat[, 2] <- l1res
rmat[, 3] <- almsres
rmat[, 4] <- altsres
rmat[, 5] <- MBARES
pairs(rmat, labels = c("OLS residuals",
"L1 residuals", "ALMS residuals",
"ALTS residuals", "MBA residuals"))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.