hotelling_test_ind#
- skfda.inference.hotelling.hotelling_test_ind(fd1: FData, fd2: FData, *, n_reps: int | None = None, random_state: int | RandomState | Generator | None = None, return_dist: typing_extensions.Literal[False] = False) Tuple[float, float] [source]#
- skfda.inference.hotelling.hotelling_test_ind(fd1: FData, fd2: FData, *, n_reps: int | None = None, random_state: int | RandomState | Generator | None = None, return_dist: typing_extensions.Literal[True]) Tuple[float, float, ndarray[Any, dtype[float64]]]
Compute Hotelling \(T^2\)-test.
Calculate the \(T^2\)-test for the means of two independent samples of functional data.
This is a two-sided test for the null hypothesis that 2 independent samples have identical average (expected) values. This test assumes that the populations have identical variances by default.
The p-value of the test is calculated using a permutation test over the statistic
hotelling_t2()
. If a maximum number of repetitions of the algorithm is provided then the permutations tested are generated randomly.This procedure is from Pini, Stamm and Vantinni [1].
- Parameters:
fd1 – First sample of data.
fd2 – Second sample of data. The data objects must have the same type.
n_reps – Maximum number of repetitions to compute p-value. Default value is None.
random_state – Random state.
return_dist – Flag to indicate if the function should return a numpy.array with the values of the statistic computed over each permutation.
- Returns:
Value of the sample statistic, one tailed p-value and a collection of statistic values from permutations of the sample.
- Raises:
TypeError – In case of bad arguments.
Examples
>>> from skfda.inference.hotelling import hotelling_test_ind >>> from skfda.representation import FDataGrid >>> from numpy import printoptions
>>> fd1 = FDataGrid([[1, 1, 1], [3, 3, 3]]) >>> fd2 = FDataGrid([[3, 3, 3], [5, 5, 5]]) >>> t2n, pval, dist = hotelling_test_ind(fd1, fd2, return_dist=True) >>> '%.2f' % t2n '2.00' >>> '%.2f' % pval '0.00' >>> with printoptions(precision=4): ... print(dist) [ 2. 2. 0. 0. 2. 2.]
References