data(iris)
cov <- cov(iris[,3:4])
mu <- colMeans(iris[,3:4])
radius <- sqrt(qchisq(0.68, 2))
plot(iris[,3:4], asp=1)
car::ellipse(mu, cov, radius = radius)
ellipse.axes(cov, center=mu, level = 0.68,
labels = TRUE)
ellipse.box(cov, center=mu, level = 0.68,
factor = "pca",
col = "red", lwd = 2 )
res <- ellipse.box(cov, center=mu, level = 0.68, factor = "chol", col = "green", lwd = 2 )
res
Run the code above in your browser using DataLab