Kruskal Wallis Test with Random Effect? I am trying to analyse the effect of season (autumn or summer) on frog sperm cell concentration (continuous, expressed as cells/ml). Because I don't know if there is an effect of male variation I want to run a model with a random effect. My data is not normally distributed, and the residuals are not random.



I think I need to run a Kruskal Wallis Test with a random effect, but cannot find the solution anywhere. Please help.
We originally had:
m1 <- lmer(cellsml ~ Season + (1 | male), data=data2, na.action=na.omit)
Can run:
kruskal.test(cellsml~Season, data=data2)
but cannot run:
kruskal.test(cellsml~Season + (1|male), data=data2)
Any ideas??? Thank you in advance!

Apart from what Christian said in the comments:

*

*In a linear mixed model, you have 2 errors, the residual error and the random effect. In lme4, you can extract the residual error via residuals(model), and the RE via ranef(model)


*In principle, both should be normally distributed. If you are not happy with a visual assessment, the normal way would be to use a shapiro.test, not a Kruskal Wallis test.
