<p>Following are some suggestions regarding your two questions.</p>

<ol>
<li><p>I would recommend an iterative modelling strategy.</p>

<p>Start with</p>

<pre><code>RT ~ 1 + A*B*Groups*Gender + (1+A | Subject ID)
</code></pre>

<p>and see if the problem is tractable. Above model will include both additive effects as well as <em>all</em> interaction terms between <code>A</code>, <code>B</code>, <code>Groups</code> and <code>Gender</code>.</p>

<p>If the problem is not tractable, discard the interaction terms between <code>Gender</code> and the other covariates, and model</p>

<pre><code>RT ~ 1 + A*B*Groups + Gender + (1+A | Subject ID)
</code></pre>

<p>It's difficult to make a statement about potential overfitting without any details on the number of observations.</p></li>
<li><p>Concerning your second question: Generally, I would recommend a Bayesian approach; take a look at the <code>rstan</code>-based <code>brms</code> R package, which allows you to use the same <code>lme4</code>/<code>glmm</code> formula syntax, making it easy to translate models. Model comparison and predictive performance are very broad terms. There exist various ways to explore and compare the predictive performance of these type of nested/hierarchical Bayesian models. See for example the papers by <a href="https://arxiv.org/abs/1503.08650" rel="nofollow noreferrer">Piironi and Vehtari</a> and <a href="https://projecteuclid.org/euclid.ssu/1356628931" rel="nofollow noreferrer">Vehtari and Ojanen</a>.</p></li>
</ol>
How to decide when and how to include covariates in a linear mixed-effects model in lme4
<p>I am running a linear mixed-effects model in R, and I'm not sure how to include a covariate of no interest in the model, or even how to decide if I should do that.</p>

<p>I have two within-subject variables, let's call them A and B with two levels each, with lots of observations per participant. I'm interested in how their interaction changes across 4 groups. My outcome is reaction time. At the simplest level, I have this model:</p>

<pre><code>RT ~ 1 + A*B*Groups + (1+A | Subject ID)
</code></pre>

<p>I would like to add Gender as a covariate of no interest. I have no theoretical reason to assume it affects anything, but it's really imbalanced across groups, so I'd like to include it. The first part of my question is: What is the best way to do this?</p>

<p>Is it this model:</p>

<pre><code>RT ~ 1 + A*B*Groups + Gender + (1+A | Subject ID)
</code></pre>

<p>or this:</p>

<pre><code>RT ~ 1 + A*B*Groups*Gender + (1+A | Subject ID)
</code></pre>

<p>? Or some other way? My worries about this second model is that it somewhat unreasonably inflates the number of terms in the model. Plus I'm worried about overfitting. </p>

<p>The second part of my question: When selecting the best model, when should I add the covariate to see if it makes any difference at all? Let me explain what I mean.</p>

<p>Let's say I start with the simplest model I mentioned above, but without the slope for A, so this:</p>

<pre><code>RT ~ 1 + A*B*Groups + (1| Subject ID)
</code></pre>

<p>Should I add the covariate first, either as a main effect ( + Gender) or as part of the interaction (*Gender), and <em>then</em> see if adding a slope for A makes a difference (by using the anova() function), or can I go ahead with adding the slope (which is theoretically more important) first, and then see if gender matters at all?</p>