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

20 Ansichten (letzte 30 Tage)
Christoper Angelo Malayan am 29 Jan. 2021
Bearbeitet: Walter Roberson am 30 Jul. 2024
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 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
dpb am 29 Jan. 2021
Read the "More About" section of the documentation...

Melden Sie sich an, um zu kommentieren.

### Antworten (1)

Sim am 30 Jul. 2024
Bearbeitet: Sim am 30 Jul. 2024
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.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Descriptive Statistics finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by