Is ttest2 with the 'Vartype' set as 'unequal' essentially the same as a Welch's t-test?

27 次查看(过去 30 天)
Hi all,
Just like to confirm that I've understand the documentation for using the ttest2 ( https://www.mathworks.com/help/stats/ttest2.html ) correctly.
Am I right to assume that when I set 'Vartype' as 'unequal' (essentially saying that variance of samples are NOT known to be the same), ttest2 becomes a Welch's t-test?
Hope you could help me confirm this.
Thank you

回答(1 个)

Sim
Sim 2024-7-30,7:59
编辑:Sim 2024-7-30,8:01
First Comment. As @DJB wrote in his/her comment, we can go to the "More About" Section of Two-sample t-test, and read the following:
In the case where it is not assumed that the two data samples are from populations with equal variances, the test statistic under the null hypothesis has an approximate Student's t distribution with a number of degrees of freedom given by Satterthwaite's approximation. This test is sometimes called Welch’s t-test.
Second Comment. If you open the algorithm from the Command Window
>> open ttest2
At Line 210 we can read (Please @MathWorks Support Team tell me if the following line is allowed to be shown!)
% unequal variances
...
dfe = (s2xbar + s2ybar) .^2 ./ (s2xbar.^2 ./ (nx-1) + s2ybar.^2 ./ (ny-1));
where "dfe" should be the "effective degrees of freedom" given by Satterthwaite's approximation, that we can read in the Welch's t-test article on Wikipedia:
Third Comment. The author of the Welch's t-test article on Wikipedia, recognises the MATLAB command
ttest2(data1, data2, 'Vartype', 'unequal')
to perform the Welch's t-test.

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by