1 | lsviews(x, Y, ii = 1)
|
x |
|
Y |
|
ii |
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, ii = 1)
{
x <- as.matrix(x)
out <- cov.mcd(x)
center <- out$center
cov <- out$cov
rd2 <- mahalanobis(x, center, cov)
labs <- c("90%", "80%", "70%", "60%", "50%", "40%", "30%",
"20%", "10%", "0%")
tem <- seq(0.1, 1, 0.1)
for (i in ii:10) {
val <- quantile(rd2, tem[i])
bhat <- lsfit(x[rd2 <= val, ], Y[rd2 <= val])$coef
ESP <- bhat[1] + x %*% bhat[-1]
plot(ESP, Y)
points(ESP[rd2 <= val], Y[rd2 <= val], pch = 15, cex = 1.4)
abline(0, 1)
title(labs[i])
identify(ESP, Y)
print(bhat)
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.