mplot <-
function(x)
{
# Makes a DD plot only using the MDi, the RDi are not used.
p <- dim(x)[2]
center <- apply(x, 2, mean)
cov <- var(x)
md2 <- mahalanobis(x, center, cov)
md <- sqrt(md2)
rd <- md
const <- sqrt(qchisq(0.5, p))/median(rd)
rd <- const * rd
plot(md, rd)
abline(0, 1)
identify(md, rd)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.