In t.test()
, there's parameter var.equal
, which means we need to check variance homogeneity before t.test.
Which one should be used?

- 125
- 1
- 5
-
2Note that there is disagreement on whether doing a formal test for equal variance before doing the t-test is a good approach. – Dason Jul 07 '17 at 14:29
-
1I'm not sure I understand the question. There's no automated way to do a statistical analysis. Every result you get is based on a set of assumptions. Not everyone would agree on how to interpret the results of a particular test. R is just a calculator; it doesn't actually "do statistics" for you. Do you need help writing a function to do both parts based on your standards? If so, it would help to provide a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample data. – MrFlick Jul 07 '17 at 14:31
-
1@MrFlick I have a completely automatic way to do an analysis which has an exact type I error rate. It just returns the p-value though. You can use it for any test regardless of assumptions. `perfect_encompassing_test <- function(data){runif(1)}` – Dason Jul 07 '17 at 14:33
-
Link to(https://stats.stackexchange.com/questions/289331/whats-the-recognized-standard-of-test-selecting), is there a agreement in statistics world? – WhiteGirl Jul 07 '17 at 14:34
-
2Move over R.A. Fisher, @Dason has just solved statistics :) – MrFlick Jul 07 '17 at 14:34
-
2@WhiteGirl Sorry, no. There is no one universally accepted way to choose a test for any given hypothesis and input data. Statisticians need to make choices about tests based on different criteria for each project. It really comes down to deciding how you want to model your data and what type of inference you wish to make. This is not something R can do for you, it can help help perform calculations. – MrFlick Jul 07 '17 at 14:39
1 Answers
You do not need to do homogeneity of variance (HOV) test before doing the t-test. By default, R does Welch's test which accounts for absence of HOV. The papers below come to this conclusion.
Welch's test is more powerful than the regular t-test when there is no HOV, and almost as powerful under HOV. Additionally, the formal tests for HOV can be very problematic: low power with small sample sizes (n), too powerful with large n, no effect sizes, problematic under non-normality, ... Finally, Zimmerman (2004) showed that when you choose which test to conduct based on the result of the most commonly performed HOV test (Levene's test), the result from your subsequent analysis is unreliable.
So simply run the t-test in R without worrying about HOV. R by default does Welch's test which adjusts for lacking HOV.
Zimmerman, D. W. (2004). A note on preliminary tests of equality of variances. British Journal of Mathematical and Statistical Psychology, 57(1), 173–181. https://doi.org/10.1348/000711004849222
Delacre, M., Lakens, D., & Leys, C. (2017). Why Psychologists Should by Default Use Welch’s t-test Instead of Student’s t-test. International Review of Social Psychology, 30(1), 92–101. https://doi.org/10.5334/irsp.82

- 116
- 2