# pingouin.multivariate_ttest

pingouin.multivariate_ttest(X, Y=None, paired=False)[source]

Hotelling T-squared test (= multivariate T-test)

Parameters
Xnp.array

First data matrix of shape (n_samples, n_features).

Ynp.array or None

Second data matrix of shape (n_samples, n_features). If Y is a 1D array of shape (n_features), a one-sample test is performed where the null hypothesis is defined in Y. If Y is None, a one-sample is performed against np.zeros(n_features).

pairedboolean

Specify whether the two observations are related (i.e. repeated measures) or independent. If paired is True, X and Y must have exactly the same shape.

Returns
statspandas DataFrame

Hotelling T-squared test summary

'T2' : T-squared value
'F' : F-value
'df1' : first degree of freedom
'df2' : second degree of freedom
'p-val' : p-value


multivariate_normality

Multivariate normality test

ttest

Univariate T-test.

Notes

Hotelling ‘s T-squared test is the multivariate counterpart of the T-test.

Rows with missing values are automatically removed using the remove_na() function.

Tested against the R package Hotelling.

References

1

Hotelling, H. The Generalization of Student’s Ratio. Ann. Math. Statist. 2 (1931), no. 3, 360–378.

2

http://www.real-statistics.com/multivariate-statistics/

3

https://cran.r-project.org/web/packages/Hotelling/Hotelling.pdf

Examples

Two-sample independent Hotelling T-squared test

>>> import pingouin as pg
>>> dvs = ['Fever', 'Pressure', 'Aches']
>>> X = data[data['Condition'] == 'Drug'][dvs]
>>> Y = data[data['Condition'] == 'Placebo'][dvs]
>>> pg.multivariate_ttest(X, Y)
T2      F  df1  df2      pval
hotelling  4.229  1.327    3   32  0.282898


Two-sample paired Hotelling T-squared test

>>> pg.multivariate_ttest(X, Y, paired=True)
T2      F  df1  df2      pval
hotelling  4.468  1.314    3   15  0.306542


One-sample Hotelling T-squared test with a specified null hypothesis

>>> null_hypothesis_means = [37.5, 70, 5]
>>> pg.multivariate_ttest(X, Y=null_hypothesis_means)
T2      F  df1  df2          pval
hotelling  253.231  74.48    3   15  3.081281e-09