Is Levene's test necessary? My friend told me to use Levene's test to check the assumption of homoskedasticity before applying the two sample t-test. I think most people that use linear models don't do that. They check the residual plot to eye ball it instead, and it would be enough. If you look at a two sample t-test as a kind of linear model then you would not check for homoskedasticity by Levene's test.
Why do we need to check only before a t-test or Anova?
I appreciate advice with theoretical reasons.
 A: Regardless of the good points made in the comments above about whether you condition your testing procedure on the results of preliminary investigation (e.g. choosing Welch vs. standard t-tests based on the outcome of Levene's test) I suspect that the reason for this difference between ANOVA/t-test (i.e., linear models where all of the predictors are categorical) and other linear models such as regression, ANCOVA, etc. (i.e., linear models with at least one continuous predictor) is that questions of heteroscedasticity etc. apply to the conditional distribution of the data, i.e. the distribution of the $\epsilon$ in $y=\beta_0 + \beta_1 x + \ldots + \epsilon$.


*

*if you have all-categorical predictors, you can test for heteroscedasticity (and other issues such as non-Normality) by dividing the data into unique combinations of categories (i.e., in the t-test, compare the variability in each group).

*if you have continuous predictors, then the only way to test the conditional distribution is to fit the model first, then evaluate the distribution of the residuals. Furthermore, even after you have the residuals, there generally aren't discrete groups in the data to which you could apply Levene's test.

