Mixed Models module technical details

Degrees of freedom

As far as it is possible, inferential tests are based on an automatic selection of the degrees of freedom for the t-tests and the F-tests.

  • For the t-tests the module relies on the Satterthwaite approximation of degrees of freedom as it is implemented by the lmerTest package. Lmertest::summary() produces t-test DF and p-values in the majority of cases. When the model does not converge, or some problem with the model occurs, the DF cannot be estimated and thus the p-values are not reported in the parameter estimates table. A warning note is displayed in those cases. See details in lmerTest package.

  • For the F-tests of the main model (“Fixed Effects ANOVA”), the module relies again on the Satterthwaite approximation of degrees of freedom as it is implemented by the lmerTest package. Lmertest::anova() has difficulties in calculating F-test DF and p-values when the model does not converge, there are problems with the model random variances, or when numerical independent variables appear in complex interactions. When the lmerTest::anova() does not produce the DF and p-values, the module switches to car::Anova(..,type=3, test="F") function of the R car package. car::Anova(..,type=3, test="F") implements the Kenward-Roger method for degrees of freedom. A warning note is displayed in those cases.

  • For F-tests of simple effects, the car::Anova(..,type=3, test="F") is always used, thus the the Kenward-Roger method for degrees of freedom is employed. This is because the lmertest::anova() requires the factor contrast to be contr.sum(), which does not allow to estimate simple effects. car::Anova(..,type=3, test="F") has not such a limitations, so it works fine for the purpose.

Post Hocs

Post-hocs tests are performed as implemented in the emmeans package. In particular, the actual implementation is as follows (for any given model term selected by the user) :

      formula <- as.formula(paste('~', term))
      referenceGrid <- emmeans::emmeans(private$.model, formula)
      bonferroni <- summary(pairs(referenceGrid, adjust='bonferroni'))
      holm <- summary(pairs(referenceGrid, adjust='holm'))
      tukey<-summary(pairs(referenceGrid, adjust='tukey'))
      scheffe<-summary(pairs(referenceGrid, adjust='scheffe'))
      sidak<-summary(pairs(referenceGrid, adjust='sidak'))