Categories &

Functions List

Function Reference: hotelling_t2test

statistics: [h, pval, stats] = hotelling_t2test (x)

statistics: […] = hotelling_t2test (x, m)

statistics: […] = hotelling_t2test (x, y)

statistics: […] = hotelling_t2test (x, m, Name, Value)

statistics: […] = hotelling_t2test (x, y, Name, Value)

Compute Hotelling’s T^2 ("T-squared") test for a single sample or two dependent samples (paired-samples).

For a sample x from a multivariate normal distribution with unknown mean and covariance matrix, test the null hypothesis that mean (x) == m.

For two dependent samples x and y from a multivariate normal distributions with unknown means and covariance matrices, test the null hypothesis that mean (x - y) == 0.

hotelling_t2test treats NaNs as missing values, and ignores the corresponding rows.

Name-Value pair arguments can be used to set statistical significance. 'alpha' can be used to specify the significance level of the test and the level of the confidence interval (the default value is 0.05).

If h is 1 the null hypothesis is rejected, meaning that the tested sample does not come from a multivariate distribution with mean m, or in case of two dependent samples that they do not come from the same multivariate distribution. If h is 0, then the null hypothesis cannot be rejected and it can be assumed that it holds true.

The p-value of the test is returned in pval.

stats is a structure containing the value of the Hotelling’s T^2 test statistic in the field "t2stat", its F transform in "fstat", and the degrees of freedom of the F distribution in the fields "df1" and "df2". Under the null hypothesis, (n-p) T^2 / (p(n-1)) has an F distribution with p and n-p degrees of freedom, where n and p are the numbers of samples and variables, respectively.

The effect size is the Mahalanobis distance D between the mean and m, in the field "MahalanobisD", with its 100 (1 - alpha)% confidence interval in "MahalanobisDCI". The noncentrality of the F statistic is n D^2; the distance is estimated from max (F df1 (df2 - 2) / df2 - df1, 0), unbiased for the noncentrality before its truncation at zero, and the interval inverts the noncentral F distribution. Where the interval would need a noncentrality above 10^5, where ncfcdf loses accuracy, it is NaN.

See also: hotelling_t2test2

Source Code: hotelling_t2test