if(interactive()) {
testX <- rnorm(100, mean=1, sd=2)
testY <- rnorm(100, mean=2, sd=3)
plot(testX, testY, pch=16, xlim=c(-5,7), ylim=c(-7,11))
confEllipse(testX, testY, col="red", lwd=1)
confEllipse(testX, testY, conf=0.99, col="red", lwd=2)
confEllipse(testX, testY, conf=0.9, col="red", lwd=0.5)
}
if(interactive() & require("MASS")) {
testMVR <- mvrnorm(n=100, mu=c(2,3), Sigma=matrix(c(1, 0.65, 0.65, 1), nrow=2))
plot(testMVR, pch=16, xlim=c(-2,6), ylim=c(0,6))
confEllipse(testMVR, col="orange")
confEllipse(testMVR, conf=0.99, col="red")
confEllipse(testMVR, conf=0.9, col="lightblue")
}
Run the code above in your browser using DataLab