# 95% confidence ellipse using Hotelling T-squared in a score plot (R)

I am trying to draw a 95% confidence ellipse using Hotelling T-squared in a score plot of two principal components from a PCA. I have checked that:

https://stackoverflow.com/questions/42637860/pca-and-hotellings-t2-for-confidence-intervall-in-r

But, I didn't find information to perform an outlier detection using Hotelling T2 since the ellipse used doesn't seem to be based on Hotelling T2.

Do you have any example?

• Out of context, I do not like calling it a confidence ellipse. A confidence ellipse is a multivariate analogue of a confidence interval. You seem to want something analogous to the 68-95-99.7 empirical rule for normal distributions. For multivariate normal distributions, ~68% of the density is contained within 1 Mahalanobis distance of the mean; ~95% is contained within 2 Mahalanobis distances of the mean, etc. These regions form ellipses in two dimensions, but they are NOT confidence ellipses any more than 2 standard deviations (not errors) from the mean is a confidence interval. – Dave Jan 29 at 13:22
• @Dave Because the distribution of the Mahalanobis distance for a multivariate Normal is proportional to a $\chi$ distribution, which is highly skewed for small dimensions, the 68-95-99.7 rule does not apply (and gives highly misleading results). What is sought here is a kind of "tolerance region" for the PCs, rather than a confidence region, as you correctly point out. – whuber Jan 30 at 14:40
• @whuber Mahalanobis distance in one dimension is literally the z-score, so the 68-95-99.7 rule works in one dimension, stops working in two dimensions, and then gradually gets more accurate as the dimension increases? – Dave Jan 30 at 16:16
• @Dave It depends on how one interprets your statement. If by "mean" you intended the center of the ellipse, then the rule rapidly gets extremely inaccurate. If instead by "mean" you intended the mean standardized distance to the center, then the rule could be modified to account for the standardized standardized distance to the center, where it would indeed become more and more accurate. – whuber Jan 30 at 16:54
• @whuber But then isn't that how Hotelling's $T^2$ test works, seeing how many Mahalanobis distances of the sampling distribution the observed value and suspected value are apart? If it works for the sampling distribution, why not for the original multivariate normal distribution? – Dave Jan 30 at 17:08