September 22, 2017 at 13:47 UTC #126
In the “Expand Random Effects” section of the afex manual one is warned to use the expand_re argument in case of missing value:
Note that it most likely differs from g/lmer in how it handles missing values so it is recommended to only pass data without missing values to it!
Is this only relevant to lmer_alt or also to mixed? Besides, what are the implications of using it anyway?
September 24, 2017 at 09:26 UTC #128
It is not advised to use any afex functions with missing data. Perhaps more generally, it is not advised for any standard (i.e., part of the
statspackage) R modeling function to have missing data. All those functions simply remove missing data on a casewise basis and it is a good idea to remove them before running any model. Otherwise you might get the false sense that all your data was used for fitting, whereas those observations with missing missing values were in fact simply removed.
The way in which
mixedworks (i.e., in many situations it first creates several model matrices that are then fitted separately) somewhat complicates this. If the different model matrices have different numbers of rows due to missing values the ensuing models are non-commensurable and cannot be used for hypothesis testing. This can also appear when using
expand_re = TRUEas this also creates a new model matrix (as the argument implies, it first expands the random effects structure into a new model matrix).
The point of this warning is simply that the way in which the creation of the new model matrix deals with missing values cannot be guaranteed to be the same as is done in
g/lmer. This also applies to both
mixed. Hence, I highly advise to remove missing values before fitting a model if they appear in any variables that are part of the model (i.e., for for dependent variables, fixed-, and random-effects). I would go so far to suggest this even when using modeling functions outside of
afexunless they explicitly deal with missing values (e.g., multiple imputation, but note that these also fit models where each data set has no missings as they are imputed in each case).
I hope this clears it up.
September 24, 2017 at 10:48 UTC #130
Yes, that made it clear! Thanks.
You must be logged in to reply to this topic.