Categories &

Functions List

Function Reference: hotelling_t2test2

statistics: [h, pval, stats] = hotelling_t2test2 (x, y)
statistics: […] = hotelling_t2test2 (x, y, Name, Value)

Compute Hotelling’s T^2 ("T-squared") test for two independent samples.

For two samples x from multivariate normal distributions with the same number of variables (columns), unknown means and unknown equal covariance matrices, test the null hypothesis mean (x) == mean (y).

hotelling_t2test2 treats NaNs as missing values, and ignores the corresponding rows for each sample independently.

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

If h is 1 the null hypothesis is rejected, meaning that the tested samples 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 both samples come from the same multivariate distribution.

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 "Tsq", and the degrees of freedom of the F distribution in the fields "df1" and "df2". Under the null hypothesis, $$ {(n_x+n_y-p-1) T^2 \over p(n_x+n_y-2)} $$ has an F distribution with p and n_×+n_y-p-1 degrees of freedom, where n_× and n_y are the sample sizes and p is the number of variables.

See also: hotelling_t2test

Source Code: hotelling_t2test2