# 2x2 ANOVA - assess violations of homoscedasticity & normality

I have a 2x2 factorial unbalanced between-subject design, n = 355. My DV is a subjective probability estimate (i.e., a number between 0 and 100).

My ANOVA model:

aov1 <- aov(prob ~ utility * imagination, data = e3nndata)


To check for homoscedasticity I used Levene's Test, which was highly significant:

library(car)
leveneTest(prob ~ utility * imagination, data = e3nndata)

>        Df F value    Pr(>F)
> group   3   7.639 5.838e-05 ***
>       351


To check for normality of residuals I used the Shapiro-Wilk-Test, which was equally significant:

shapiro.test(aov1$residuals) > W = 0.897, p-value = 9.099e-15  In order to tackle both problems, I decided to log-transform the DV: aov1.log <- aov(log(prob) ~ utility * imagination, data = e3nndata)  In fact, now Levene's test is no longer significant: leveneTest(log(prob) ~ utility * imagination, data = e3nndata) > Df F value Pr(>F) > group 3 0.6385 0.5907 > 351  However, the Shapiro-Wilk-Test on the residuals remains significant: shapiro.test(aov1.log$residuals)

> W = 0.9661, p-value = 2.415e-07


Is it correct, though, to run the Shapiro-Wilk-Test on the entire sample or should it be calculated for each group individually?

From posts like this one I learnt that with larger sample sizes significant Shapiro-Wilk results are often rather meaningless and more focus should be put on graphical representations. Therefore I had a look at two diagnostic plots.

library(car)
qqPlot(aov1.log) library(ggplot2)
ggplot() + geom_histogram(aes(x=aov1.log\$residuals), binwidth=0.25) I don't have any experience with violations of model assumptions, so I cannot tell whether the two plots suggest such a strong violation of the normality assumption that ANOVA is no longer a suitable method.

## Questions:

1. What is the right conclusion from these plots?
2. Are there other plots/statistics to take into account?
3. As a consequence, how should the data be analyzed?
• I did not test the normality of the response, but the normality of the residuals. – vincentqu Jun 29 '14 at 21:00
• Good point about testing normality, when heteroscedasticity is present. I ran the Shapiro-Wilk-Test again, on each group individually. Now in all four groups, 0.001 < p < 0.01, so it gets closer to non-significance. But as you noted already, this entails reduced power and would require some p-value adjustment. Why exactly do the hypothesis tests answer the wrong question? – vincentqu Jun 29 '14 at 21:11
• So you recommend to just stick with the ANOVA and consider no assumptions violated? – vincentqu Jun 30 '14 at 15:21
• I've moved my comments (and extensive additional discussion) to an answer. – Glen_b Jun 30 '14 at 22:37

## 1 Answer

When you have heteroskedasticity, it doesn't make sense to try to check normality of the entire set of residuals, though you could still check groups individually (with corresponding loss of power of course).

On the other hand, it doesn't really make sense to formally test either normality or heterosckedasticity when checking assumptions, since the hypothesis tests answer the wrong question.

This is because your data aren't actually normal (and it's also very unlikely that your populations have identical variance) - so you already know the answer to the question the hypothesis test checks for. With a nice large sample like you have, the chance that a nice powerful test like the Shapiro-Wilk doesn't pick it up is small - so you'll reject as non-normal data from distributions that will have little impact on the signficance level or the power. That is, you'll tend to reject normality - even at quite small significance levels - when it really doesn't matter. The test is likely to reject when it matters least (i.e. when you have a big sample).

What you actually want to know is the answer to a different question than the test answers - something like "How much does this affect my inference?". The hypothesis test doesn't address that question - it doesn't consider the impact of the non-normality, only your ability to detect it.

Further, when you have a sequence "do this equal-variance normal theory analysis if I don't reject all these tests, otherwise do this analysis if I reject that one, this other analysis if I reject the other one and something else if I reject both" we must consider the properties of the whole scheme. Such programs of testing usually do worse (in terms of test bias, accuracy of significance level and very often, of power) than just assuming you'd rejected both tests.

So you recommend to just stick with the ANOVA and consider no assumptions violated?

Not quite. In fact, if anything my last sentence above suggests that you assume heteroskedasticity and normality are violated from the start. Either one alone being violated is relatively easy to deal with, both together is a little trickier (but still possible). However, in your case I think you're probably okay, since I think you needn't worry about one of the two:

Normality may not be such a problem - the considerations would be what kind of non-normality might you have, and how strongly non-normal, and with how large a sample size?

Your sample size seems reasonably large and the distribution pretty mildly left skew and light-tailed, though that assessment may be confounded with the heteroskedasticity. However, if you had good understanding of the properties of what was being measured - which you may well have - or information from similar studies, you might be able to make an a priori assessment on that basis and so better able to choose an appropriate procedure (though I'd still suggest diagnostic checking).

Since your data are probability estimates, they'll be bounded. In fact the left skewness may simply be caused by some probability assessments getting relatively close to 100. If that's the case, you must also tend to doubt your assumption of linearity, and that will be a likely cause of heteroskedasticity as well. If my guess about getting close to the upper bound is right you'll tend to see lower spread among the groups with higher mean.

You might consider an analysis suited to continuous proportions, perhaps a beta-regression - at least if you have no data exactly on either boundary. (An alternative might be a transformation, but models that deal with the data you have tend to be both easier to defend and more interpretable.)

With your decent-sized sample, you are probably safe enough on non-normality, but heteroskedasticity might be more of an issue - in particular, heteroskedasticity issues don't decrease with sample size.

On the other hand, if your sample sizes are equal (or at least very nearly equal), heteroskedasticity is of little consequence. Your tests will be little impacted in the case of equal sample sizes.

If equal-sample-sizes are not the case, I suggest you:

i) don't assume heteroskedasticity will simply be okay

ii) don't formally test it, for the same reasons outlined above (testing answers the wrong question)

Instead I suggest you start with the assumption that the variances differ - whether it's to use something like the Welch approach (I can't say I know how that works for 2x2 off the top of my head, but it should be quite possible to make it work in that case, since it only affects the calculation of residual variance and its df), or to implement your ANOVA in a regression and move to something like heteroskedasticity-consistent standard errors (which is used more widely in areas like econometrics).