← All posts

Random Slopes: When Each Person Carries a Trajectory

Clinical Epidemiology ResearchUniqcret doctor knowledgesMethodology and Research Design
Random Slopes: When Each Person Carries a Trajectory
On this page

Abstract

A random intercept lifts a person's whole profile and leaves its shape alone, so it cannot make the spread at one visit differ from another. This post gives Z a second column, so each person carries a personal rate of change as well as an offset, and G grows into a two-by-two matrix. In a simulated randomised sub-study the marginal variance becomes a quadratic function of time, reading 8.25, 7.81, 7.69 and 8.41 at weeks 0, 2, 4 and 8, while the six correlations run from 0.61 to 0.74 instead of staying equal, which formally kills compound symmetry. Readers learn why the intercept-slope correlation is a statement about the time origin alone, what a singular fit is telling them, and how much random structure to pre-specify.

Infographic summary of random slopes in a linear mixed model
Visual summary

Post 5 of 8 — One Number Per Person: Linear Mixed Models from the Ground Up.

Arriving here without the earlier posts? Here is where we are. When the same patient is measured more than once, those measurements are not independent of one another, and a linear mixed model deals with that by handing every patient one private number — an offset that lifts or lowers that patient's whole profile without changing its shape. Everything the model then assumes about the repeated measurements sits in a single line, $V_i = Z_i G Z_i' + R_i$, in which only two objects can ever be changed: $Z$, which sets what each person is allowed to carry, and $R$, which sets what a single measurement carries on its own. A gentler, non-technical tour of all eight posts is in the series guide.

Post 4 built that single line and left you with a map on which exactly two things can ever be changed. This post changes the first of them: it gives $Z$ a second column, so that each person carries not only an offset but a rate of change. The next post, When Compound Symmetry Is a Lie, leaves $Z$ alone and goes after $R$.

Every number in this series comes from simulated teaching data; later posts introduce clearly labelled variant simulations, and this post is one of them. It is not an empirical finding, it describes no real cohort, and it must not be cited as evidence about skin physiology.

The row of four numbers a random intercept with a single residual variance cannot produce

Before the hard part: Picture a clinic in which everybody improves, but nobody improves at the same pace — one patient's readings fall steeply, the next barely moves, a third drifts the wrong way. A model that gives each person only a personal starting level cannot describe that clinic. It lets people start high or start low, and then makes every one of them travel in parallel. If everybody travels in parallel, the gap between patients is exactly as wide at the last visit as it was at the first. The four numbers below are that gap, and they refuse to stay the same width.

Here is the artefact for this post. It is the diagonal of the marginal covariance matrix — the variance of the outcome at each of four visits — in a simulated randomised sub-study you will meet in a moment.

week0248
Var(TEWL) (g·m⁻²·h⁻¹)²8.257.817.698.41

Four visits, four different variances. In Post 2 the diagonal was 10.00 at every one of the four sites and the off-diagonal was 6.25 in every cell, and that flatness was not an accident of the simulation; it was forced by the structure. A random intercept adds the same number to every row a person contributes, so it lifts the whole profile and leaves the shape of the profile alone. That specification holds only two ingredients: one offset per person, and a single residual variance shared by every visit. Neither of them can make the spread at week 8 differ from the spread at week 4. The qualifier matters, and the closing section returns to it: a random intercept whose residual variance is allowed to differ from visit to visit can bend the diagonal too, which is the subject of Post 6.

The row above therefore announces, before any algebra, that something has been added to $Z$.

The fan: eight simulated personal trajectories over weeks 0 to 8 Eight noise-free personal trajectories, each a personal intercept plus a personal slope added to the population line, drawn from week 0 to week 8. The bundle starts wide, narrows a little near the middle of follow-up and splays open again by week 8. Two bold population lines are shown: standard care, 18.0 minus 0.60 per week, and the intensive arm, 18.0 minus 0.85 per week. Visit sub-study — eight simulated personal trajectories (noise-free), weeks 0–8 b0i + b1i t around the standard-care line standard care 18.0 − 0.60 t intensive 18.0 − 0.85 t 10141822 02468 week TEWL (g·m⁻²·h⁻¹) Visits at weeks 0, 2, 4, 8 · vertical spread (SD) 2.50 · 2.41 · 2.39 · 2.53 — narrowest near week 3.75, widest at week 8

Read the fan. Eight simulated participants start at visibly different heights — the intercept SD of 2.5 g·m⁻²·h⁻¹ sees to that, so there is no common origin — their lines lean at visibly different angles, the bundle narrows a little around the middle of follow-up, and then it splays open again by week 8. The lines drawn are the noise-free personal trajectories, $b_{0i} + b_{1i}t$ around the population line. The vertical spread of the bundle at any point on the horizontal axis is therefore a standard deviation and not a variance: 2.50, 2.41, 2.39 and 2.53 g·m⁻²·h⁻¹ at weeks 0, 2, 4 and 8. Square those four numbers, then add the $\sigma^2 = 2.00$ that a single measurement carries on top of the trajectory. The row in the table comes back exactly — $6.25 + 2.00 = 8.25$, $5.81 + 2.00 = 7.81$, $5.69 + 2.00 = 7.69$, $6.41 + 2.00 = 8.41$. Every claim in this post is read off that one picture.

Illustration: a fan of personal trajectories leaving a shared origin, each person moving at their own rate.

Why the design has to change

The four body sites of the running example are a fixed, unordered set of measurement locations, each with its own mean. They carry no sequence: back is not "later" than shin, and nothing is gained by multiplying a site label by a slope. A random slope needs a dimension along which a person can be said to move, and four sites do not provide one. The sites return in Post 6, where they are exactly the right structure for the question asked there.

So this post switches, explicitly and for one post only, to the visit sub-study: a simulated randomised sub-study inside the same fictional programme, in which the 80 participants with AD-range barrier impairment are randomised 1:1 to intensive emollient versus standard care, and transepidermal water loss is measured at the volar forearm only at four visits — week 0, 2, 4 and 8. That is 80 × 4 = 320 observations, fully balanced, and it is the mirror image of the earlier design: one site measured four times instead of four sites measured once.

The generating model is

\[ \text{tewl}_{ij} \;=\; \beta_0 + \beta_1 t_{ij} + \beta_{\text{arm}}\,\text{arm}_i + \beta_2\,(\text{arm}_i \times t_{ij}) \;+\; b_{0i} + b_{1i} t_{ij} \;+\; e_{ij} \]

with the following simulated values.

ParameterValueRead as
$\beta_0$ (week-0 mean, both arms)18.0where everybody starts
$\beta_1$ (standard care, per week)−0.60the population trajectory under standard care
$\beta_{\text{arm}}$ (arm main effect at week 0)0set to zero when the data were generated, not omitted from the model
$\beta_2$ (extra decline, intensive arm, per week)−0.25the treatment effect, which lives entirely in the interaction
$\tau_0^2$ (intercept variance)6.25 (SD 2.5)how far apart people are at week 0
$\tau_1^2$ (slope variance)0.04 (SD 0.20 per week)how far apart their rates of change are
$\text{corr}(b_{0i}, b_{1i})$−0.30 → $\tau_{01} = -0.15$how starting level and rate travel together
$\sigma^2$ (residual)2.00what is left at a single visit

Two features of the fixed part are worth one sentence each before we leave it. First, the arm main effect was set to zero when these data were generated, which is not the same as leaving it out of the model. Randomisation equalises the two arms at week 0 in expectation, not in the realised sample, so week * arm expands to week + arm + week:arm and the fitted model estimates that term rather than assuming it away; the treatment effect itself lives entirely in the interaction with time. Second, under standard care the simulated population falls from 18.0 to $18.0 - 8 \times 0.60 = 13.2$ over the eight weeks, while the intensive arm falls at $-0.60 - 0.25 = -0.85$ per week, reaching $18.0 - 8 \times 0.85 = 11.2$.

# random intercept + random slope on time (Post 5, visit sub-study)
fitS <- lmer(tewl ~ week * arm + (week | id), data = visits)

$G$ becomes a 2×2 matrix

Before the hard part: Each person now carries two personal numbers instead of one: where they start, and how fast they change. Across a population, two numbers raise exactly three questions worth asking. How far apart are people's starting points? How far apart are their rates? And do the two travel together — are the patients who start worst also the ones who change fastest? Those three quantities are all that $G$ contains, and the matrix notation below is simply the bookkeeping for them.

With one random effect, $G$ was a single number. With two, it is a symmetric 2×2 matrix holding two variances and one covariance:

\[ \begin{pmatrix} b_{0i}\\ b_{1i}\end{pmatrix} \sim N\!\left(\begin{pmatrix}0\\0\end{pmatrix},\; G=\begin{pmatrix} 6.25 & -0.15\\ -0.15 & 0.04 \end{pmatrix}\right) \]

The diagonal is read in the units of the thing it multiplies. The intercept SD of 2.5 g·m⁻²·h⁻¹ says that a participant one standard deviation above the mean starts 2.5 units leakier at randomisation. The slope SD of 0.20 g·m⁻²·h⁻¹ per week says that a participant one standard deviation above the mean on $b_{1i}$ sits 0.20 units per week above the population line in rate. Under standard care that means a decline of 0.40 rather than 0.60 units per week — a slower improvement, not a faster one. The departure accumulates to $8 \times 0.20 = 1.6$ units by the final visit, of the same order as the $8 \times 0.25 = 2.0$ units of treatment effect itself. Sign discipline is worth the extra sentences here, because the mean slope is negative, so "faster" and "higher" point in opposite directions.

The off-diagonal is the new object. It is a covariance, and covariances in mixed units are hard to feel, so convert it: $-0.15 = -0.30 \times 2.5 \times 0.20$, a correlation of −0.30 between where a person starts and how fast that person changes. In this simulated dataset, participants who begin leakier tend to decline slightly faster; on the fan, the lines that start highest are also the steepest, which is why the bundle narrows before it reopens.

G as a 2 by 2 matrix and as a tilted cloud The 2 by 2 covariance matrix G holds 6.25 and 0.04 on its diagonal and minus 0.15 off it. Drawn as a bivariate cloud on axes of personal offset and personal slope, the one and two standard deviation contours tilt down to the right, the shape of a correlation of minus 0.30. G — two numbers per person, one bivariate distribution b0i b1i b0i b1i 6.25 −0.15 −0.15 0.04 SD(b0i) = 2.50 g·m⁻²·h⁻¹ — where a person starts SD(b1i) = 0.20 per week — how fast a person changes corr(b0i, b1i) = −0.30 −0.15 = −0.30 × 2.50 × 0.20 the same G, drawn −5.0−2.502.55.0 0.40.20−0.2−0.4 b0i — personal offset at week 0 b1i — personal slope, per week The cloud leans down to the right: start leakier (b0i > 0), decline faster (b1i < 0). Contours: 1 SD and 2 SD.

That interpretation, however, may be far less portable than it looks, and it is the first thing this post asks you to distrust. A negative intercept–slope correlation is not by itself evidence of a biological tendency to converge; it is partly a statement about where you happened to put the origin of time, and it can be made to vanish or change sign by re-anchoring alone. The section on centring shows exactly that, with the same numbers.

The first consequence: variance becomes a function of time

Before the hard part: If patients change at different rates, they must be fanning apart or closing in as follow-up proceeds. How different the patients are from one another therefore cannot be a single fixed number for the whole study; it has one value at week 0, another at week 4, another at week 8. The formula below simply puts a number on the width of that fan at any time you name. Read it as one arithmetic sentence: the spread at time $t$ is the spread in starting levels, plus a term for whether starting level and rate travel together, plus the spread in rates — which counts for more and more as $t$ grows — plus the noise of a single measurement.

Because $Y$ now contains $b_{0i} + b_{1i}t$, the marginal variance inherits both random effects and their covariance:

\[ \operatorname{Var}(Y_{ij}\mid t) \;=\; \tau_0^2 \;+\; 2t\,\tau_{01} \;+\; t^2\tau_1^2 \;+\; \sigma^2 \]

This is a quadratic in $t$, and the arithmetic is worth doing in full at least once. At week 0 the two slope terms vanish and only the intercept and residual variance survive: $6.25 + 0 + 0 + 2.00 = 8.25$. At week 2 the cross-product term turns negative while the quadratic term is still tiny: $6.25 + 2(2)(-0.15) + (2^2)(0.04) + 2.00 = 6.25 - 0.60 + 0.16 + 2.00 = 7.81$. At week 4 the two continue to trade against each other: $6.25 - 1.20 + 0.64 + 2.00 = 7.69$. At week 8 the quadratic term finally dominates, because it grows with $t^2$ while the negative term grows only with $t$: $6.25 - 2.40 + 2.56 + 2.00 = 8.41$.

The curve reaches its minimum where its derivative $2\tau_{01} + 2t\tau_1^2$ is zero, that is at $t^{*} = -\tau_{01}/\tau_1^2 = 0.15/0.04 = 3.75$ weeks, where the variance is 7.69. The fan is narrowest a little before the third visit and widest at the last one.

The variance function is a quadratic in time Var of Y given t equals 8.25 minus 0.30 t plus 0.04 t squared, plotted from week 0 to week 8. The four visit values are 8.25, 7.81, 7.69 and 8.41, and the curve reaches its minimum of 7.69 at week 3.75. A dashed reference line marks 8.25, the constant value a random intercept alone would give at every visit. Var(Y | t) = τ0² + 2t τ01 + t² τ1² + σ² = 8.25 − 0.30 t + 0.04 t² τ1² = 0 would give 8.25 at every visit minimum at week 3.75 (7.69) 8.25 7.81 7.69 8.41 7.67.88.08.28.4 012345678 week Var(TEWL) τ0² = 6.25 · τ01 = −0.15 · τ1² = 0.04 · σ² = 2.00 — the diagonal of V is no longer constant

Two things follow, and they are of different kinds. Mathematically, the diagonal of $V$ is no longer constant, and no amount of estimation care will make it constant again while $\tau_1^2 > 0$. Practically, a variance function of this shape may be a reason to look at your own fitted model's implied diagonal rather than only at its fixed-effect table — because a model that is forced to hold the variance constant has to compromise somewhere, and where it compromises is usually at the ends of follow-up.

If the slope variance were switched off — $\tau_1^2 = 0$ and therefore $\tau_{01} = 0$ — the same expression returns $6.25 + 2.00 = 8.25$ at every visit. That is the random-intercept answer, and it is exactly the week-0 value, which is why an intercept-only fit tends to look most defensible precisely where the data are least informative about slopes.

Illustration: a U-shaped curve showing the marginal variance falling and then rising again over follow-up time.

The second consequence: the off-diagonal moves too

Before the hard part: Two visits on the same patient resemble each other, and this section asks how much — for each of the six possible pairs among the four visits. The intuition most clinicians already carry is that two visits close together should agree more closely than two far apart. Roughly, that is what happens here. The exception is the point of the section: once people carry personal rates, agreement depends on which two visits you name, not only on how many weeks separate them.

The covariance between two visits on the same person is obtained the same way, by collecting the terms that the two measurements share:

\[ \operatorname{Cov}(Y_{ij}, Y_{ik}) \;=\; \tau_0^2 \;+\; (t_j+t_k)\,\tau_{01} \;+\; t_j t_k\,\tau_1^2 \]

Work the extreme pair. For weeks 0 and 8, $t_j t_k = 0$, so the quadratic term disappears entirely and only the cross term acts: $6.25 + (0+8)(-0.15) + 0 = 5.05$. Divide by the two relevant standard deviations to get the correlation, $5.05/\sqrt{8.25 \times 8.41} = 5.05/8.33 = 0.61$. Now work an adjacent pair, weeks 2 and 4: $6.25 + (6)(-0.15) + (8)(0.04) = 6.25 - 0.90 + 0.32 = 5.67$, and $5.67/\sqrt{7.81 \times 7.69} = 5.67/7.75 = 0.73$. All six pairs, with the correlations that follow:

pair (weeks)0,20,40,82,42,84,8
covariance5.955.655.055.675.395.73
correlation0.740.710.610.730.670.71

Set this against the Post 2 matrix, where every off-diagonal cell was 6.25 and every correlation was 0.625. Neither the diagonal nor the off-diagonal is constant any more. Compound symmetry is not approximately violated here; it is formally false, by construction, the moment a random slope enters. If the slope terms are zeroed the six correlations collapse to the single value $6.25/8.25 = 0.76$, which is the flat structure the earlier posts described.

Notice also what the pattern is not. In this simulation the six correlations do fall as the visits move apart — 0.74 at the shortest gap, 0.61 at the longest. They are not, however, a function of that gap, and that is the property that matters. Weeks 0 and 2 correlate at 0.74, while weeks 2 and 4, exactly the same two weeks apart, correlate at 0.73. The two four-week gaps separate in the third decimal place (0.709 for weeks 0 and 4 against 0.713 for weeks 4 and 8), and their covariances separate visibly, at 5.65 against 5.73. An autoregressive structure cannot do that. Its correlation $\rho^{|t_j - t_k|}$ knows the distance between two visits and nothing else, so every equally spaced pair must return the identical value. A random slope is therefore not an autoregressive structure wearing a different name: it generates a quadratic pattern whose shape is dictated by $G$ and by where on the time axis the visits sit, not by how far apart they are alone.

Two ways to write the random part

The formula (week | id) asks for both random effects and the covariance between them: two variances and one covariance, three parameters in $G$. The alternative (1 | id) + (0 + week | id) asks for the same two variances but fixes their covariance at zero, spending two parameters instead of three.

# correlated random intercept and slope — three parameters in G
fitS <- lmer(tewl ~ week * arm + (week | id), data = visits)

# independent random intercept and slope — two parameters in G
fitS_ind <- lmer(tewl ~ week * arm + (1 | id) + (0 + week | id), data = visits)

The second specification is not merely a simpler version of the first; it is a different claim. It asserts that, at the origin you chose, a person's starting level carries no information about that person's rate of change. In this simulation that claim is false at week 0, where the correlation is −0.30 by construction. The independent form may nevertheless be a reasonable pragmatic choice when the correlated form will not converge, provided the reduction is reported rather than quietly adopted. The same two-column random structure is available through a two-column random-effects formula in nlme and through the corresponding random-effects specification in Stata's mixed; the syntax differs, the parameter count does not.

Where you put week zero changes what $G$ means

Before the hard part: "Baseline" is a decision, not a fact. The intercept describes whatever the patient's level was at the moment you chose to call time zero — randomisation, first dose, symptom onset — so a claim such as "the sickest patients improve fastest" is really a claim about that moment and no other. Shift time zero to the middle of follow-up and the same data, with not one observation altered, tell a different-sounding story. The arithmetic below shows it happening.

This is the most common source of confusion in practice, and it deserves its own arithmetic rather than a warning.

The random intercept is a person's departure from the population line at $t = 0$, wherever you have put $t = 0$. Move the origin and you are asking about a different quantity, so both the intercept variance and the intercept–slope covariance change. Re-anchoring at time $c$ gives a new intercept $b_{0i}^{*} = b_{0i} + c\,b_{1i}$, and therefore

\[ \operatorname{Var}(b_{0i}^{*}) = \tau_0^2 + 2c\,\tau_{01} + c^2\tau_1^2, \qquad \operatorname{Cov}(b_{0i}^{*}, b_{1i}) = \tau_{01} + c\,\tau_1^2 \]

Anchor at week 4 — the middle of this follow-up — and the covariance becomes $-0.15 + 4(0.04) = +0.01$, with intercept variance $6.25 - 1.20 + 0.64 = 5.69$ and hence a correlation of $0.01/\sqrt{5.69 \times 0.04} = 0.02$. The same simulated dataset, the same fitted model, the same fixed-effect estimates for the treatment interaction — and an intercept–slope correlation that has gone from −0.30 to essentially zero because the origin moved by four weeks.

The covariance is exactly zero at $c = -\tau_{01}/\tau_1^2 = 3.75$ weeks, which is the same 3.75 that minimised the variance function. That is not a coincidence, and the two lines of algebra already on this page prove it: the derivative of the variance function, $2\tau_{01} + 2t\,\tau_1^2$, is exactly twice the re-anchored covariance $\tau_{01} + c\,\tau_1^2$, so one is zero if and only if the other is. The identity holds for any $G$ with $\tau_1^2 > 0$, not only for these numbers. The origin at which starting level and rate are uncorrelated is precisely the origin at which the fan is narrowest.

Thus the practical instruction is not "centre time" but something narrower. Anchor $t = 0$ at whatever moment you actually want the intercept to describe — randomisation, first dose, symptom onset — and then interpret the intercept–slope correlation as a statement about that moment only. Reporting a raw intercept–slope correlation without naming the origin is close to uninterpretable.

When a random slope cannot be estimated

Before the hard part: You cannot tell how fast a patient is changing from a single visit, and from two visits you can barely tell it at all. A personal slope has the same appetite. It needs enough visits per person, and it needs the variable being given a slope to actually move within a person. When the design does not supply that, the software will say so — usually in a form that looks like an error message rather than a finding.

A random slope is a variance component, and variance components need information to be identified. Three situations recur.

First, too few repeated measurements per person. Estimating a person-specific slope requires enough within-person points to separate a personal trend from residual noise. With only two visits, at the same two times for everybody, the obstacle is not difficulty but arithmetic. A $2 \times 2$ marginal covariance matrix contains three distinct quantities — two variances and one covariance — while the correlated random-slope model asks for four: $\tau_0^2$, $\tau_{01}$, $\tau_1^2$ and $\sigma^2$. Four parameters cannot be recovered from three quantities, so the model is not identified at all, and no sample size repairs it. This is the same counting argument that Post 6 runs at greater length under the heading of the identifiability ceiling. Three or more visits restore identification in principle, and with only a handful of participants the estimate can still be unstable even once it is technically identified.

Second, no within-person variation in the variable being given a slope. The randomised arm in this sub-study is constant within a person, so a random effect of arm within id is not estimable at all; only variables that move inside a person — time here — can carry a random slope over that person.

Third, boundary and singular fits. The likelihood may be maximised at the edge of the parameter space, and the output announces that edge in more than one way. You may see a slope variance estimated at or extremely close to zero, an intercept–slope correlation estimated at exactly −1.00 or +1.00, or lme4's boundary (singular) fit message (Bates et al., 2015). Those are not one configuration but two. A slope variance of zero empties the slope dimension outright — the design carries no recoverable information about person-to-person differences in rate. A correlation of exactly ±1.00 says something else: both variances are estimated as positive, yet $G$ has collapsed to rank one, so the two random effects have become a single dimension in disguise. A singular fit is not a software failure and it is not automatically a reason to keep the model; in either configuration it is the data reporting that the requested random structure is more elaborate than the design can support.

The practical rule, stated as the hedged advice it is: with a small number of visits per person, a correlated random-slope structure may be more than the data can identify, and a pre-specified simplification path — correlated slope, then independent slope, then intercept only — could reasonably be declared in the analysis plan before the first model is fitted.

How much random structure to fit

Two defensible positions exist in the methodological literature, and it is more honest to present both than to pick one.

The maximal position (Barr et al., 2013) holds that, for confirmatory hypothesis testing, the random-effects structure should include every random slope the design justifies. Omitting a random slope for a term that genuinely varies across units can severely inflate the Type I error rate for that term. The parsimony position (Matuschek et al., 2017) accepts that argument in principle, but shows that maximal structures fitted to data that cannot support them lose power and produce unstable fits, and that a structure chosen with attention to the balance between Type I error and power performs better in realistic settings. Pinheiro and Bates (2000) supply the underlying framing for both: the random-effects covariance model is a set of parameters that must be identified, not a wish list.

A recommendation that respects both, offered as an opinion rather than a rule: the random structure could reasonably be pre-specified from the design and the research question, retaining a random slope for the variable the primary hypothesis is about whenever the number of repeated measurements per person plausibly supports it, and simplifying along a declared path when it does not. What should not happen is selecting the random structure by inspecting p-values for the fixed effects, because that makes the reported inference conditional on the outcome it is meant to test.

Comparing random structures without fooling yourself

Before the hard part: Sooner or later you will want to ask whether the personal-slope version of the model is "better" than the simpler one. What follows is the small print on that comparison. Compare like with like; do not trust the usual p-value when the quantity being tested is a variance, which cannot go below zero; and treat AIC and BIC as advisers rather than judges.

Three factual points govern this comparison. First, likelihood-ratio tests of nested random structures must be fitted with identical fixed effects, because REML likelihoods are not comparable across different fixed-effect specifications. Second, testing whether a single variance component is zero places the null value on the boundary of the parameter space. The correct reference is then a 50:50 mixture of $\chi^2_0$ and $\chi^2_1$ rather than $\chi^2_1$ itself, and referring the statistic to the conventional chi-square distribution is conservative — the resulting p-value is too large rather than too small. That clean result belongs to one variance component at a time and should not be generalised: removing a random slope together with its covariance deletes two parameters of which only one is bounded, and the reference distribution then has to be worked out rather than assumed. Third, AIC and BIC are supporting evidence about structure, not deciding evidence, and neither is a substitute for looking at the residuals and the observed trajectories.

What this post does not license

A random slope explains where the correlation comes from; it does not certify that the explanation is the right one.

First, a non-constant variance in real data does not prove that a random slope is needed. A model with a constant random intercept and residual variances that differ by occasion can generate a very similar diagonal, and the two specifications are not separated by looking at a variance plot — Post 6 takes that question up directly.

Second, the intercept–slope correlation is origin-dependent, as the centring arithmetic above demonstrates, and should never be reported as a biological finding about convergence or regression to the mean without naming the anchor.

Third, nothing here converts an association into a causal statement. The treatment effect in this simulated sub-study is interpretable as a randomised contrast only because the sub-study was simulated as randomised; in an observational cohort the same random-slope model would carry every confounding problem it started with.

Fourth, the predicted person-specific slopes a mixed model returns are shrunken quantities, not measurements. Extracting them and analysing them as if they were observed rates of change is a second-stage analysis that ignores their uncertainty, and it may produce badly over-confident conclusions. Where the person-specific intercept and slope genuinely need to be used elsewhere — as predictors of a later clinical event, for instance — the appropriate structure is a joint model that estimates both parts together, which is the subject of Joint models for longitudinal and survival data.

What to do in your own analysis

  1. Plot the trajectories before fitting anything. If the observed lines are visibly non-parallel, a random slope is worth considering; if they are parallel and short, it may not be identifiable no matter how theoretically attractive it is.
  2. Anchor time deliberately. Put $t = 0$ at the moment you want the intercept to describe, and state that anchor whenever you report $G$.
  3. Pre-specify the random structure and its simplification path. Declaring the fall-back before the first fit could prevent the structure from being chosen by whichever version produced the more agreeable p-value.
  4. Report $G$, not only $\beta$. The two variances, the covariance and the implied correlation are results; in a longitudinal paper they may be more informative to a reader than a third decimal place on the fixed effects.
  5. Treat a singular fit as information. Report it, report what you simplified to, and avoid presenting the simplified model as though it had been the plan all along.
  6. Compare nested random structures by REML with identical fixed effects, and remember that the conventional test of a single variance component at zero is conservative before concluding that a slope variance is "not significant".

Key takeaways

Next. In Post 6 we leave $Z$ untouched and go after $R$ — and discover that a random intercept contributes the same covariance to every pair of measurements, but does not by itself force the correlations to be equal.

References

  1. Pinheiro JC, Bates DM. Mixed-Effects Models in S and S-PLUS. Springer; 2000.
  2. Bates D, Mächler M, Bolker B, Walker S. Fitting linear mixed-effects models using lme4. J Stat Softw. 2015;67(1):1–48.
  3. Barr DJ, Levy R, Scheepers C, Tily HJ. Random effects structure for confirmatory hypothesis testing: keep it maximal. J Mem Lang. 2013;68(3):255–278.
  4. Matuschek H, Kliegl R, Vasishth S, Baayen H, Bates D. Balancing Type I error and power in linear mixed models. J Mem Lang. 2017;94:305–315.
0
Message for International and Thai ReadersUnderstanding My Medical Context in ThailandRead more →Message for International and Thai ReadersUnderstanding My Broader Content Beyond MedicineRead more →

Comments

No comments yet. Be the first to share your thoughts.

Sign in to comment