# R: result of Levene test correct?

I want to use the Levene test to quantify the homo/heterogeneity of the variances of two samples. The density plot looks like this:

But the Levene test for the data [hov(average~window,data=df)] yields 1.531-e13, i.e. the probability that the variances are not equal is very high.

But given the density plot, is this result reasonable or have I used the function incorrectly? To me the samples look identical, thus the variance should not be so different.

• What's the sample size? What are the actual variances? Commented Apr 24, 2014 at 20:40
• Of what is this the density plot? What are the "windows" and what does "V5" mean? What are your group sizes?
– whuber
Commented Apr 24, 2014 at 20:41
• (1) NB the p-value is NOT "the probability that the variances are not equal". This is a serious mistake. $\quad$ (2) What R package are you using? It's not in base R, and we don't necessarily know which of many thousands of packages you're using. Is this the hov in HH? If so, you're doing Browne-Forsythe, not Levene (3) If the sample size is large, then hypothesis tests can pick up small, even trivial differences. If that concerns you, it implies that you shouldn't have been doing hypothesis tests in the first place, because you're interested in a different question to the one they answer Commented Apr 24, 2014 at 22:48
• Right, I was using Browne-Forsythe from the HH package. I mixed it up. The sample size is around 23300 samples for each group. That's the reason for the p-value. Thanks for reminding me. Commented Apr 25, 2014 at 14:49
• Regarding your comment (3). I don't fully understand. Levene or Browne-Forsyth test for homoscedasticity. And I'm interested in the spread of the variance of both samples. Commented Apr 25, 2014 at 14:53

Here's some data that looks vaguely something like yours:

n=16000
m1=rbinom(n,1,.475)*.4+5.9
m2=rbinom(n,1,.475)*.35+5.93
ds1=rnorm(n,m1,.1)
ds2=rnorm(n,m2,.15)

a=stack(list(ds1=ds1,ds2=ds2))
hov(values~ind,a)

hov: Brown-Forsyth

data:  values
F = 54.5708, df:ind = 1, df:Residuals = 31998, p-value = 1.536e-13
alternative hypothesis: variances are not identical


If you have lots of points, it can easily happen.

• Yes, sample size is around 23.300 per group. Should I sample from both distributions and then use the BF test (as the data doesn't follow a normal distribution)? Commented Apr 25, 2014 at 14:54
• Why would you sample from them? What purpose does it serve? Commented Apr 25, 2014 at 14:57
• If I take 46.000 samples then the tiniest effect will be significant. I thought if I sampled only a few hundreds from both populations, then I could check for the variance homo/heterogeneity correctly. Commented Apr 26, 2014 at 10:30
• How is increasing the chance of failing to pick up a difference doing it "correctly"? If you think that the behavior of a significance test in a large sample doesn't have desirable behavior, it's a clear signal that your actual question of interest isn't answered by a hypothesis test. Commented Apr 26, 2014 at 10:38