Recently learned that Levene's test is a one-way equal-variance ANOVA done on absolute values of residuals calculated from the mean within each group.
For one-way ANOVA the minimal sample size seems to be having at least one group with more than 1 observation. But in the case of Levene's test it gets a bit tricky for me.
For example, if all groups have 2 observations each, the within-group variance will be 0. So the requirement would seem to be at least 1 group with at least 3 observations.
However what about situations where one group has only one sample? I did a few simulations in R using car::leveneTest()
and it seems like p-values are not distributed uniformly in the case of 2 groups where one group has only one sample. Here is a demonstration:
library(car)
groups <- factor(c(rep("A", 999), "B"))
ps <- replicate(100, leveneTest(rnorm(1000), groups)[1,3])
> range(ps)
[1] 0.1681269 0.2107370
Basically, after simulating 100 scenarios where group 1 has 999 observations and group 2 has 1 observation, the p-values range from 0.16 to 0.22. The levenTest()
function didn't complain, but that might be an oversight in the implementation.
Question: what are the minimum sample size requirements for Levene's test to be valid?
My current take: 2 samples per group with at least one group having 3 but I might have missed something.