ellipse.axes | R Documentation |
A function to draw the principal axes of a 2D ellipse from a correlation, covariance or sums of squares and cross products matrix in an existing plot.
ellipse.axes(
x,
centre = c(0, 0),
center = center,
scale = c(1, 1),
which = 1:2,
level = 0.95,
radius = sqrt(qchisq(level, 2)),
labels = TRUE,
label.ends = c(2, 4),
label.pos = c(2, 4, 1, 3),
...
)
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. |
centre , center |
The center of the ellipse |
scale |
If x is a correlation matrix, then the standard deviations of
each parameter can be given in the scale parameter. This defaults to
|
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 |
labels |
Either a logical value, a character string, or a character
vector of length 2. If |
label.ends |
A vector of indices in the range |
label.pos |
Positions of text labels relative to the ends of the axes used in |
... |
Other arguments passed to |
Invisibly returns a 4 x 2 matrix containing the end points of the axes in pairs (min, max) by rows.
Michael Friendly
lines
, text
data(iris)
cov <- cov(iris[,1:2])
mu <- colMeans(iris[,1:2])
radius <- sqrt(qchisq(0.68, 2))
plot(iris[,1:2], asp=1)
car::ellipse(mu, cov, radius = radius)
res <- ellipse.axes(cov, center=mu, level = 0.68,
labels = TRUE)
res
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.