# Why is there an apparently large difference between Bartlett and Levene's test in this problem?

When running tests for homoscedasticity, using R gave the following results:

Bartlett test of homogeneity of variances
data:  list(Full_data_1$ICPP, Full_data_1$PI)
Bartlett's K-squared = 7.9171, df = 1, p-value = 0.00489


However, when running a Levene's test the result was a significance of 0.8397. The data is normal, so Bartlett's test would be appropriate, but it seems weird that there is such a big difference. Did I do something wrong maybe?

The tests used were:

bartlett.test(list(full_data_1$ICPP, full_data_1$PI)
leveneTest(Full_Data_1$ICPP, full_data_1$PI)

• Might help to give the full Leven output. If nobody can answer based on what you provide then prehaps edit in the data using dput(). Commented Nov 20, 2022 at 16:55
• 1. How do you know the population distributions are normal? 2. If the variables were all mutually independent and the populations were actually normal, the Bartlett test would be much more efficient 3. Neither test is exact, (What were the sample sizes?) 4. Outcomes for tests based on different statistics will sometimes be very different; they see the data differently. 5. If you're testing in order to decide whether to assume equal variances, it's better to simply not assume equal variances. Commented Nov 20, 2022 at 17:07
• hi Glen, 1. I ran the Kruskal-Wallis test and they showed normality 2. That is good to know 3. sample sizes are 105 on each. It's a survey and I want to test if I can use linear regression (or not) on the relationship between the two variables. They are both measured in the same survey through different items 4. Does that mean that it can still be that both tests were performed correctly? 5. Okay, that is also good to know, thanks! Commented Nov 20, 2022 at 17:16
• Can you share the data? Difficult to say much without so! If needed for privacy reasons, you can obfuscate by adding a constant, multiply by a constant. Commented Nov 20, 2022 at 17:53
• If you found the answer, maybe you can self-answer so as this do not linger on unresolved? Commented Nov 20, 2022 at 18:07

• I'm pretty sure the problem is one of syntax. If you call LeveneTest(A, B), the function treats B as the grouping variable. If my guess is right, you should have seen a warning message like In leveneTest.default(A, B) : B coerced to factor.. Commented Nov 21, 2022 at 15:30
• Try the following, except substitute A and B with your data. library(car); A = round(rnorm(16, 0, 2)); B = round(rnorm(16, 0, 5)); Y = c(A, B) Group = factor(c(rep("A", length(A)), rep("B", length(B)))); bartlett.test(Y ~ Group); leveneTest(Y ~ Group, center=mean); leveneTest(Y ~ Group, center=median) Commented Nov 21, 2022 at 15:30
• And then try leveneTest(A,B) Commented Nov 21, 2022 at 15:30