# Relation between Two Sample Hotelling's T-test and Mahalanobis Distance?

Mahalanobis distance is a measure of distance between a point and distribution. So if we want to check if a point belongs to a particular distribution or not, we can use Hotelling's T-test, which is squared Mahalanobis distance. But if we have two sample distribution and we want to check if they belong to the same group or not, we can use two sample Hotelling's T-test, that is,

$T^2$ = $n(X-Y)^T$$(X-Y)$ /$S$

(assuming same number of samples), where $S$=$Sx$+$Sy$ is the pooled covariance. Now my question is this, Is there any relation between Two Sample Hotelling's T-test and Mahalanobis Distance (similar to 1 sample H T-test and MD)? How are they mathematically related?

My thinking is that, there is some relation (equality) between them but I can't get my head around it. Any guidance would be greatly appreciated. Thanks

• Speaking of Mahalanobis distance we usually mean a distance between a point and a clouds's centroid, or between two points in the same cloud. So its is a pointwise distance in any case, like Euclidean one. But you want to extend its definition to a set distance, a distance between two clouds. It is surely possible, but I think it will transgress the definition of "Mahalanobis distance", so why need to do it? There are other well-known kinds of distance between sets/distributions. Nov 1 '16 at 12:33
• As I see a clear relation between Mahalanobis and 1 sample Hotelling's T-test, I assume that two sample Hotelling's T-test will be just an extension. What do you mean by other kinds of distance sets? Nov 2 '16 at 2:08
• Does the answer here help?
– Carl
Mar 2 '17 at 18:32

Assuming $$X \sim \operatorname{MVN}(\boldsymbol{\mu}, \Sigma)$$, ie it follows a multivariate normal distribution with known mean $$\boldsymbol{\mu}$$ and variance $$\Sigma$$, $$(\mathbf{X} - \boldsymbol{\mu}) \Sigma^{-1}(\mathbf{X} - \boldsymbol{\mu})$$ (which is the Mahalanobis distance squared), follows a Chi squared distribution with $$p$$ degrees of freedom, where $$p$$ is the number of dimensions in $$X$$.
However, if we have to estimate $$\Sigma$$ from $$n$$ samples, we denote it as $$\mathbf{S}$$, which follows a Wishart distribution with $$n$$ degrees of freedom. Then, $$(\mathbf{X} - \boldsymbol{\mu}) S^{-1}(\mathbf{X} - \boldsymbol{\mu})$$ follows the Hotelling $$T^2$$ distribution with $$p$$ and $$n$$ degrees of freedom.
Note that this is directly analogous to in the univariate case, where $$X \sim N(\mu, \sigma^2)$$. In this case, with known $$\sigma^2$$, $$z = \frac{X-\mu}{\sigma / \sqrt{n}} \sim N(0, 1)$$, ie the standard normal distribution. However, if we have to estimate $$\sigma^2$$ from data, the scaled estimator follows a chi squared distribution, ie $$\frac{(n-1)s^2}{\sigma^2} \sim \chi^2(n-1)$$. Then, $$t = \frac{X-\mu}{s / \sqrt{n}} \sim t(n-1)$$.
So, both the Student $$t$$ and the Hotelling $$t$$ represent "more uncertain" versions (ie sampling distributions) of their respective "certain" versions. However, both asymptotically approach their "certain" versions, namely $$\chi^2(p)$$ and and $$N(0, 1)$$ respectively, as $$n$$, the number of samples, approaches infinity.