0
$\begingroup$

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)
$\endgroup$
6
  • $\begingroup$ 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(). $\endgroup$
    – mdewey
    Commented Nov 20, 2022 at 16:55
  • $\begingroup$ 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. $\endgroup$
    – Glen_b
    Commented Nov 20, 2022 at 17:07
  • $\begingroup$ 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! $\endgroup$
    – lucas
    Commented Nov 20, 2022 at 17:16
  • $\begingroup$ 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. $\endgroup$ Commented Nov 20, 2022 at 17:53
  • 2
    $\begingroup$ If you found the answer, maybe you can self-answer so as this do not linger on unresolved? $\endgroup$ Commented Nov 20, 2022 at 18:07

1 Answer 1

1
$\begingroup$

If the variables were all mutually independent and the populations were actually normal, the Bartlett test would be much more efficient Outcomes for tests based on different statistics will sometimes be very different; they see the data differently. If you're testing in order to decide whether to assume equal variances, it's better to simply not assume equal variances

$\endgroup$
4
  • $\begingroup$ +1 for the attempt, but I don't think this gets to the problem. If the two samples are relatively normal, Bartlett's test, Levene's test (center=mean), and Levene's test(center=median) shouldn't be grossly different in their results. $\endgroup$ Commented Nov 21, 2022 at 15:27
  • $\begingroup$ 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.. $\endgroup$ Commented Nov 21, 2022 at 15:30
  • $\begingroup$ 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) $\endgroup$ Commented Nov 21, 2022 at 15:30
  • $\begingroup$ And then try leveneTest(A,B) $\endgroup$ Commented Nov 21, 2022 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.