View source: R/ellipse-functions.R
confidenceEllipse | R Documentation |
Draws a (1-alpha
)100% confidence ellipse (two dimensional) for a
multivariate normal distribution using the eigendecomposition of the
covariance matrix.
confidenceEllipse(
X.mean = c(0, 0),
eig,
n,
p,
xl = NULL,
yl = NULL,
axes = TRUE,
center = FALSE,
lim.adj = 0.02,
alpha = 0.05,
...
)
X.mean |
a column matrix giving the mean of the two dimensions of the p-dimensional multivariate normal distribution. |
eig |
the eigenvalues and eigenvectors of the covariance matrix. This
should be of the same form as the output of |
n |
the number of observations. |
p |
the number of dimensions of the multivariate normal distribution. (The resulting graph will always be a two-dimensional confidence region for the two dimensions of a p-dimensional multivaraite normal distribution under consideration.) |
xl |
a vector giving the lower and upper limits of the x-axis for
plotting. If |
yl |
a vector giving the lower and upper limits of the y-axis for
plotting. If |
axes |
logical. If |
center |
logical. If |
lim.adj |
a value giving an adjustment to the x-axis and y-axis limits
computed if either |
alpha |
a value giving the value of alpha to be used when computing the
contour. Contours are drawn at the |
... |
other arguments to be passed to the graphing functions. |
None
Johnson, R. A., & Wichern, D. W. (2007). Applied multivariate statistical analysis (6th ed). Pearson Prentice Hall.
# 90% Confidence Ellipse for Reading and Vocab from ability.cov
x.bar <- ability.cov$center[5:6]
Sigma <- ability.cov$cov[5:6,5:6]
n <- ability.cov$n.obs
p <- length(ability.cov$center)
confidenceEllipse(X.mean = x.bar,
eig = eigen(Sigma),
n = n, p = p,
alpha = 0.10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.