In the univariate case, we have two independent random variables and want to determine whether the population means of the two random variables are equal, i.e. H0: μx = μy. To test this hypothesis we create a random sample for each variable. Assuming that sample for x has size, mean and standard deviation respectively nx, x̄ and sx, and that the sample for y has size, mean and standard deviation respectively ny, ȳ and sy, we define the following statistic
where s is the pooled standard deviation defined by
It then follows that the t-statistic defined above has a t distribution with nx + ny – 2 degrees of freedom, i.e.
provided the following assumptions are met
- The populations of x and y have unique means and there are no distinct sub-populations with different means
- The populations of x and y have a normal distribution
- The variances of the two populations are equal (homogeneity of variances)
- The sample for x and y are random with each element in the sample taken independently
Regarding the normality assumption, if nx and ny are sufficiently large, the Central Limit Theorem holds, and we can proceed as if the populations were normal. It turns out that the t-test is pretty robust for violations of the normality assumption provided each population is relatively symmetric about its mean.
The null hypothesis is rejected if |t| > tcrit. Also note that by Property 1 of F Distribution, an equivalent test can be made using the test statistic t2 and noting that
Also t2 can be expressed as follows:
where z̄ = x̄ – ȳ and µz = µx – µy.
We now look at a multivariate version of the problem, namely to test whether the population means of the k × 1 random vectors and Y are equal, i.e. the null hypothesis H0: μX = μY.
Definition 1: The Two sample Hotelling’s T-square test statistic is
where S is the pooled sample covariance matrix of X and Y, namely
where SX is the covariance matrix of the sample for X, X̄ is the mean of the sample, and the sample for each random variable xi in X has nx elements, and similarly SY is the covariance matrix of the sample for Y, Ȳ is the mean of the sample, and the sample for each random variable yi in Y has ny elements.
Note the similarity between the expression for T2 and the expression for t2 given above.
Theorem 1: For nx and ny sufficiently large, T2 ~ χ2(k)
Observation: For small nx and ny, T2 is not sufficiently accurate and a better estimate is achieved using the following theorem.
Theorem 2: Under the null hypothesis
where n = nx + ny – 1.
If F > Fcrit then we reject the null hypothesis.
Example 1: A certain type of tropical disease is characterized by fever, low blood pressure and body aches. A pharmaceutical company is working on a new drug to treat this type of disease and wanted to determine whether the drug is effective. They took a random sample of 20 people with this type of disease and 18 with a placebo. Based on the data in Figure 1 they wanted to determine whether the drug is effective at reducing these three symptoms.
Figure 1 – Data for Example 1
The difference in mean vectors, the sample sizes and the covariance matrices for the drug and placebo samples are displayed in Figure 2, as well as the pooled covariance matrix. Here we are assuming that the covariance matrices are approximately equal and so a better estimate of each of these covariance matrices is given by the pooled covariance matrix (see Assumptions below).
Figure 2 – Mean vectors, sample sizes and covariance matrices
We now calculate T2 using the array formula
Using Theorem 2, we perform Hotelling’s T2 test for independent samples, as described in Figure 3.
Figure 3 – Hotelling’s T2 test on two independent samples
Since p-value > α (or F < Fcrit), we can’t reject the null hypothesis, and conclude there is no significant difference between the mean vectors for the drug and placebo, providing evidence that the drug is not effective in reducing symptoms.
Example 2: The pharmaceutical company from Example 1 also had another drug which they also want to test for effectiveness in reducing the topical disease’s symptoms. Once again another random sample of 20 people with the disease was given the drug. Based on this data and the data for the control group, determine whether there is a significant difference between the drug and placebo in reducing the symptoms.
Figure 4 – Data for Example 2
Repeating the analysis of Example 1, we obtain the results shown in Figure 5.
Figure 5 – Analysis for Example 2
This time, we see there is a significant difference between the drug and the placebo in treating the symptoms. We summarize the results as (T2 = 44.84.45, F= 14.12, df = 3, 34; p < 0.0001).
Click on the following link for additional information about the Hotelling’s T2 test for two independent samples, including confidence intervals, effect size and assumptions: