ellipse.box | R Documentation |
Draw Conjugate Axes and Parallelogram Surrounding a Covariance Ellipse
ellipse.box(
x,
center = c(0, 0),
which = 1:2,
level = 0.95,
radius = sqrt(qchisq(level, 2)),
factor = c("cholesky", "pca"),
draw = c("box", "diameters", "both"),
...
)
x |
A square positive definite matrix at least 2x2 in size. It will be treated as the correlation or covariance of a multivariate normal distribution. |
center |
The center of the ellipse |
which |
An integer vector to select which variables from the object |
level |
The coverage level of a simultaneous region of the ellipse. The default is 0.95, for a 95% region. This is used to control the size of the ellipse. |
radius |
The size of the ellipsoid may also be controlled by specifying the
value of a t-statistic on its boundary. This defaults to the square root of a chi-square statistic
for a given |
factor |
A function defining the conjugate axes used to transform the unit
circle into an ellipse. |
draw |
What to draw? |
... |
Other arguments passed to |
Invisibly returns a 2 column matrix containing the end points of lines.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.