statsmodels.stats.weightstats.CompareMeans.ttest_ind

CompareMeans.ttest_ind(alternative='two-sided', usevar='pooled', value=0)[source]

ttest for the null hypothesis of identical means

this should also be the same as onewaygls, except for ddof differences

Parameters:
x1array_like, 1-D or 2-D

first of the two independent samples, see notes for 2-D case

x2array_like, 1-D or 2-D

second of the two independent samples, see notes for 2-D case

alternativestr

The alternative hypothesis, H1, has to be one of the following ‘two-sided’: H1: difference in means not equal to value (default) ‘larger’ : H1: difference in means larger than value ‘smaller’ : H1: difference in means smaller than value

usevarstr, ‘pooled’ or ‘unequal’

If pooled, then the standard deviation of the samples is assumed to be the same. If unequal, then Welch ttest with Satterthwait degrees of freedom is used

valuefloat

difference between the means under the Null hypothesis.

Returns:
tstatfloat

test statistic

pvaluefloat

pvalue of the t-test

dfint or float

degrees of freedom used in the t-test

Notes

The result is independent of the user specified ddof.