In class, we saw how one could use a mixed model as an alternative to the paired t-test. Lets say that we have subjects and each subject is measured twice. So we have a sample before (t = 0) and a sample after (t = 1). A proper way to do this with a mixed model is as follows:

$$Y_{ij} = β_0 + β_1t + a_i + ε_{ij}, a_i ∼ N(0, σ^2_{subject} ), ε_{ij} ∼ N(0, σ^2_{res})$$

where $a_i$ is the random effect for subject. If I would analyse this in, for example SAS, I would use a random intercept model. But why wouldn't it make sense to include a random slope?

$$Y_{ij} = β_0 + (β_1 + a_{2i})t + a_{1i} + ε_{ij}, a_i ∼ N(0, G ), ε_{ij} ∼ N(0, σ^2_{res})$$

where $G$ is the covariance matrix.

  • 2
    $\begingroup$ You’re free to do that and might want to. However, then you’re introducing a wrinkle that has no analogue in the t-test. $\endgroup$
    – Dave
    Commented May 24, 2020 at 12:19
  • $\begingroup$ Thank you for your reply. But then, isn't it always better to use a random slope model instead of using a paired t-test/random intercept model? In reality, every subject will have a different slope, no? If you use the paired t-test, there is no assumption that the variances in the two groups are equal, but using the random intercept model, there is. $\endgroup$
    – MDG1999
    Commented May 24, 2020 at 13:34
  • 2
    $\begingroup$ As you include more parameters, the interpretation becomes harder. Remember George Box’s saying that all models are wrong but some are useful. $\endgroup$
    – Dave
    Commented May 24, 2020 at 13:50
  • $\begingroup$ See also stats.stackexchange.com/questions/23276/… $\endgroup$ Commented May 24, 2020 at 21:54

1 Answer 1


Indeed a paired $t$-test is equivalent to a linear mixed model that you formulated as

$Y_{ij} = β_0 + β_1t + a_i + ε_{ij}; \\a_i ∼ N(0, σ^2_{subject}), ~ε_{ij} ∼ N(0, σ^2_{res}); \\i=1,2,...,n; j=1,2;$

where $i$ indices the subjects and $j$ codes the two paired conditions.

why wouldn't it make sense to include a random slope?

The dummy variable $t$ for the two paired conditions in your LME model is directly mapped to the index $j$:

$t=0, ~j=1; \\t=1,~j=2.$

In other words, by adding a varying slope as you suggested,

$Y_{ij} = β_0 + (β_1 + a_{2i})t + a_{1i} + ε_{ij}; \\(a_{1i}, a_{2i})' ∼ N(0, G ), ~ε_{ij} ∼ N(0, σ^2_{res}); \\i=1,2,...,n; j=1,2;$

you would end up with a collinear problem:

$a_{1i} + a_{2i}t = ε_{ij}.$

That is, this latter LME model is indeterminate because you cannot differentiate the residuals from the varying intercept and slope.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.