Solved – Two-Way Non-Parametric Test for Non-normal Data

anovakruskal-wallis test”nonparametricnormality-assumptionr

I have an unbalanced design with two factors, gender and site. I'm trying to test for differences in a size variable. Levene's test reveals that the data has equal variances. However, log transformed size variables are not normally distributed, nor are the residuals from the ANOVA test.
Below are my R codes up to this point:

test.aov <- aov(log(ssize) ~ class$Site * class$Sex)
aov_residuals <- residuals(object = test.aov)
shapiro.test(x = aov_residuals )

W = 0.95049, p-value = 6.67e-06

I know there is a Kruskal-Wallis test as a non-parametric replacement for one way ANOVA. But I don't know how to perform a non-parametric variance analysis for two factors.

Should I just go ahead with type III ANOVA and ignore the assumption of normality? Or, should I split the data in two for each gender and do separate Kruskal-Wallis tests? Or am I totally wrong and there is a better (even an obvious) way to go?

Best Answer

Ignoring the assumptions of a test is not a great approach. But to check the residuals of the model you attempted, it is better to plot them, perhaps with a histogram or q-q plot for normality, and residuals vs. predicted for homoscedasticity. Your eyes will be a better judge than Shapiro-Wilks. You just need to get a feel for how stringent you need to be.

Probably your best bet for a two-way nonparametric test with interaction is an aligned ranks anova.

Related Question