0

I have run the model:

model2 <- lmer(tas ~ station
              + (1|date), data = all5)

where station is a categorical variable with 4 levels. I want to check for variance homogeneity. I find the residuals from lmerresid <- resid(model2). If I run the levene test: leveneTest(lmerresid ~ all5$station) I get p = 0.6572 so it implies homogeneity of variances. If I make the boxplots it implies homogeneity of variances:

boxplot(lmerresid ~ all5$station)

enter image description here But if I plot residuals vs fited then there is sth wrong: #Plot vs factors

par(mfrow = c(1,1))
plot(lmerresid ~ fitted(model2))

enter image description here

Are the variances homogeneous?

lola
  • 145
  • 1
  • 9
  • 1
    Since this question is about interpreting statistical results, it's better suited to stats.stackexchange.com Stack Overflow is for questions of specific code problems. Please consider deleting this question and asking on stats.stackexchange.com. – John Polo Mar 15 '23 at 12:27
  • The last graph indicates that the model is poorly specified (how many dates you got? What if you remove ``date``?) – runr Mar 15 '23 at 12:28
  • I have 210 days. – lola Mar 15 '23 at 12:32

1 Answers1

0

I'm not sure you use levene tests on mixed models (as opposed to lm()), though I could be wrong there.

THAT SAID

I have found the easiest way to test models for validity is to use library(performance).

performance(model2)

"Super easy, barely and inconvenience". I'm not going to say it's perfect* for what you have in mind, but it will run most (if not all) of the tests that you may need to check your model. This along with the standard lmer() output, should enable you to interpret your model.

* You will need to delve into the manual to understand all the appropriate uses of the tests.

MrSwaggins
  • 87
  • 8