Covariance: Get significance of means difference...

Gets the level of significance for the difference of two means from the selected Covariance object being different from a hypothesized value.


Index1, Index2
the positions of the two elements of the means vector whose difference is compared to the hypothesized difference.
the hypothesized difference (μ).
determines whether we treat the two means as being dependent.
Equal variances
determines whether the distribution of the difference of the means is a Student t-distribution (see below).


This is Student's t-test for the significance of a difference of means. The test statistic is:

t = (x̄1 - x̄2 - μ) √ (N / s2) with ndf degrees of freedom.

In the formula above x̄1 and x̄2 are the elements of the means vector, μ is the hypothesized difference and N is the number of observations. The value that we use for the (combined) variance s2 is:

s2 = var1 + var2 - 2 * covar12,

when the samples are paired, and

s2 = var1 + var2

when they are not.

The var1 and var2 are the variance components for x̄1 and x̄2, respectively, and covar12 is their covariance. When we have paired samples we assume that the two variances are not independent and their covariance is subtracted, otherwise their covariance is not taken into account. Degrees of freedom parameter ndf usually equals 2(N-1).

If the two variances are significantly different, the statistic t above is only approximately distributed as Student's t with degrees of freedom equal to:

ndf = (N-1) · (var1 + var2)2 / (var12 + var22).

The returned probability p will be the two-sided probability

p = 2 * studentQ (t, ndf)

A low probability p means that the difference is significant.

Links to this page

© djmw, January 2, 2016