0% found this document useful (0 votes)
33 views1 page

T-Tests in R: Examples and Usage

There are different t-tests that can be performed in R for one sample, two samples, and paired samples. The two-sample t-test assumes by default that there is unequal variance between groups, and the syntax is "t.test(group1, group2)". Welch's t-test assumes normal distribution but not equal variance between groups, and it should be the default approach. Statology provides an example of using Welch's t-test in R to compare students who prepared for an exam versus those who did not.

Uploaded by

Say My NAME
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views1 page

T-Tests in R: Examples and Usage

There are different t-tests that can be performed in R for one sample, two samples, and paired samples. The two-sample t-test assumes by default that there is unequal variance between groups, and the syntax is "t.test(group1, group2)". Welch's t-test assumes normal distribution but not equal variance between groups, and it should be the default approach. Statology provides an example of using Welch's t-test in R to compare students who prepared for an exam versus those who did not.

Uploaded by

Say My NAME
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

There are various functions in R for carrying out a t-test.

GeeksforGeeks (2021) gives


examples for using the t-tests for one sample, two sample, and paired samples. The one-
sample t-test uses “t.test(x, mu= ). The two-sample test will use the syntax “t.test(v1, v2,
var.equal = TRUE/FALSE). Interestingly enough, GeeksforGeeks says R assumes there is
unequal variance, hence the need for the “var.equal” to be TRUE or FALSE.

Statology (2021) talks about the difference between equal and unequal variance. The
“Student’s t-test” assume normal distribution and same variance, whereas “Welch’s t-test”
assumes normal distribution, but not the same variance. Statology (2019) says the Welch test
should be the default because “it performs better than the Student’s t-test when sample sizes
and variances are unequal between groups, and it gives identical results when sample sizes
are variances are equal.” In R, this is done with the “t.test(1,2)” functionality where the 1 and 2
are the different samples/variables.

Statology (2020) gives the example of a teacher with students who prepared for an exam,
versus those who did not. Because R defaults to assuming unequal variance, the format here
is “t.test(group1,group2)”. In that example, the two sample t-test was the correct test to use
because of the different variables.

References

GeeksforGeeks. (2021, December 16). T-Test Approach in R Programming. GeeksforGeeks.


Retrieved March 18, 2023, from https://www.geeksforgeeks.org/t-test-approach-in-r-
programming/

Statology. (2019, May 29). Welch's t-test: When to Use it + Examples. Statology. Retrieved March
18, 2023, from https://www.statology.org/welchs-t-test/

Statology. (2020, October 21). How to Perform Welch's t-Test in R. Statology. Retrieved March 18,
2023, from https://www.statology.org/welch-t-test-in-r/

Statology. (2021, April 11). How to Determine Equal or Unequal Variance in t-tests. Statology.
Retrieved March 18, 2023, from https://www.statology.org/determine-equal-or-unequal-
variance/

You might also like