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 thelmerTest::anova()
does not produce the DF and p-values, the module switches tocar::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 thelmertest::anova()
requires the factor contrast to becontr.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'))
Optimizer
Estimating a mixed model requires to minimize several quantities and
to refine the numerical solution is several ways. These operations are
based on an algorithm that optimize the minimization. Different
algorithms are available in R package lme4
provides
different algorithms, among which the bobyqa
, the
Nelder_Mead
and the nloptwrap
algorithm see
lme4 vignettes. GAMLj automatically
starts the estimation using the bobyqa
algorithm. If the
model does not converge, it move to Nelder_Mead
, and, upon
a new failure, tries nloptwrap
. If none converges, the
first estimation is provided and a warning is issued.