Levene's test
In statistics, Levene's test is an inferential statistic used to assess the equality of variances for a variable calculated for two or more groups. Some common statistical procedures assume that variances of the populations from which different samples are drawn are equal. Levene's test assesses this assumption. It tests the null hypothesis that the population variances are equal (called "homogeneity of variance" or "homoscedasticity"). If the resulting "p"-value of Levene's test is less than some significance level (typically 0.05), the obtained differences in sample variances are unlikely to have occurred based on random sampling  from a population with equal variances. Thus, the null hypothesis of equal variances is rejected and it is concluded that there is a difference between the variances in the population. Some of the procedures typically assuming homoscedasticity, for which one can use Levene's tests, include analysis of variance and t-tests. Levene's test is sometimes used before a comparison of means, informing the decision on whether to use a pooled t-test or the Welch's t-test. However, it was shown that such a two-step procedure may markedly inflate the type 1 error obtained with the  t-tests and thus should not be done in the first place. Instead, the choice of pooled or Welch's test should be made a priori based on the study design. Levene's test may also be used as a main test for answering a stand-alone question of whether two sub-samples in a given population have equal or different variances. Definition. Levene's test is equivalent to a 1-way between-groups analysis of variance (ANOVA) with the dependent variable being the absolute value of the difference between a score and the mean of the group to which  the score belongs (shown below as formula_1 ). The test statistic, formula_2, is equivalent to the formula_3 statistic that would be produced by such an ANOVA, and is defined as follows: where (Both definitions are in use though the second one is, strictly speaking, the Brown–Forsythe test – see below for comparison.) The test statistic formula_2 is approximately F-distributed with formula_19 and formula_20 degrees of freedom, and hence is the significance of the outcome formula_21 of formula_2 tested against formula_23 where formula_3 is a quantile of the F-distribution, with formula_19 and formula_20 degrees of freedom, and formula_27 is the  chosen level of significance (usually 0.05 or 0.01). Comparison with the Brown–Forsythe test. The Brown–Forsythe test uses the median instead of the mean in computing the spread within each group (formula_28 vs. formula_29, above). Although the optimal choice depends on the underlying distribution, the definition based on the median is recommended as the choice that provides good robustness against many types of non-normal data while retaining good statistical power. If one has knowledge of the underlying distribution of the data, this may indicate using one of the other choices. Brown and Forsythe performed Monte Carlo studies that  indicated that using the trimmed mean performed best when the underlying data followed a Cauchy distribution (a heavy-tailed distribution) and the median performed best when the underlying data followed a chi-squared distribution with four degrees of freedom (a heavily skewed distribution). Using the mean provided the best power for symmetric, moderate-tailed, distributions.