← All posts

The Shared Offset: What a Random Intercept Really Is

Clinical Epidemiology ResearchUniqcret doctor knowledgesMethodology and Research Design
The Shared Offset: What a Random Intercept Really Is
On this page

Abstract

A random intercept is not a randomly placed y-axis crossing. It is one number per person, added unchanged to every row that person contributes. Using a simulated study of transepidermal water loss at four skin sites in eighty adults, this post shows that offset in the raw rows before any model is fitted, then derives in three lines that sharing one number is identical to inducing covariance: two measurements from the same participant covary by exactly the between-person variance, 6.25 of the 10.00 units each observation carries. Readers learn why correlation follows from the data structure rather than a software option, how to read random = ~ 1 | id token by token, and why the offset cancels in a within-person contrast, giving SE 0.43 against 0.50 for either mean.

Infographic summary of what a random intercept is in a linear mixed model
Visual summary

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

This series follows a single quantity from the first spreadsheet to the last standard error: $b_i$, the number one participant carries into every measurement they contribute. This opening post shows that number in raw data before any model is fitted, and then proves in three lines that sharing it is mathematically identical to inducing correlation. The next post turns the single covariance derived here into a full 4×4 matrix — Compound Symmetry and the ICC: One Offset, One Correlation.

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

The dataset, and one question before any modelling

The simulated study behind this series is deliberately ordinary. Eighty adults — 40 with moderate atopic dermatitis (AD) and 40 with no atopic disease (control) — attend a single visit, and transepidermal water loss (TEWL, g·m⁻²·h⁻¹) is measured with a closed-chamber evaporimeter at four standardised, clinically uninvolved skin sites, in the same order, under the same room temperature and humidity. Higher TEWL means a leakier barrier.

ElementValue
Participants80 (40 AD, 40 control)
Repeated unitsite, $k = 4$ per person
Unit labelsforearm · hand · shin · back (reference = forearm)
Observations320, fully balanced
Grouping factorgroup ∈ {AD, control}, reference = control
Outcometewl, continuous, g·m⁻²·h⁻¹
Person-level covariatesage (years), sex, phototype (Fitzpatrick I–VI)

The four sites are a fixed, unordered set of measurement locations, not a time sequence, and the scientific question is a two-factor one: does the AD–control difference in TEWL depend on which site you measure? Here are four of the simulated participants, laid out the way a spreadsheet usually arrives — one row per participant, with the four sites side by side. Sixteen measurements are on display; the long layout that the model actually reads, one measurement per row, appears later in this post.

idgroupforearmhandshinback
S01control14.120.111.417.0
S02control9.710.98.310.4
S03AD17.627.214.218.9
S04AD16.920.612.717.3

Spend thirty seconds on that table before reading on. Compare S01 with S02: both are controls, both were measured at the same four sites with the same instrument, and yet S01 is higher than S02 everywhere — at the forearm, at the hand, at the shin, and at the back. The gap is not the same size four times, but it never changes sign.

The reveal: everyone is being compared against the wrong number

The eye is not comparing S01 with S02. The eye is comparing each participant against the profile their group is supposed to follow. Because this dataset is simulated, we know that profile exactly — we wrote it before generating a single row.

sitecontrolADdifference (AD − control)
forearm12.018.0+6.0
hand16.024.0+8.0
shin10.013.0+3.0
back14.019.0+5.0

The differences are not equal across sites, which means the site × group interaction is real in this simulation and will need to stay in every model we fit. Now subtract each participant's own group profile from their four observed values:

idgroupforearmhandshinback
S01control+2.1+4.1+1.4+3.0
S02control−2.3−5.1−1.7−3.6
S03AD−0.4+3.2+1.2−0.1
S04AD−1.1−3.4−0.3−1.7

S01 is above their group profile at all four sites; S02 is below at all four; S04 is below at all four. That is the pattern, and independent measurement error sits uncomfortably with it. Of note, S03 is the honest counter-example — two positive and two negative deviations — and we will come back to why in a moment, because it protects you from over-reading this kind of eyeball test.

Forget the word "correlation" for a moment

Consider what an ordinary linear regression on all 320 rows actually claims. It says that every control participant measured at the forearm has the same expected value, 12.0, that every AD participant measured at the hand has the same expected value, 24.0, and that everything else in a row is $e_{ij}$ — an error term drawn fresh and independently for each of the 320 rows. Under that model, two rows belonging to S01 have exactly as much in common as one row from S01 and one row from S02.

The table above sits awkwardly with that claim. S01's four deviations are +2.1, +4.1, +1.4 and +3.0, and a mechanism that drew four independent errors from a symmetric distribution would have to land them all on the same side of zero by luck — which happens with probability $2 \times (1/2)^4 = 1/8$ for any one participant. One such participant is unremarkable; a table in which most participants behave this way is not. Thus the question is not whether to allow for something person-specific; the question is what to add and what it costs.

The offset, made explicit

Before the hard part: everything below is one clinical idea written in symbols — some patients simply run high, and they run high on every reading you take from them. You have met this on the ward — the patient whose blood pressure sits a little above everyone else's at the morning check, the afternoon check and the night check, not because three separate errors happened to point the same way, but because that is where the patient sits. The equation below gives "where the patient sits" its own name, $b_i$, and gives the wobble of any one reading a different name, $e_{ij}$. Nothing more than that is being claimed.

Add one term to the model — a single number attached to the person, not to the row:

\[ Y_{ij} = \mu_{j,\,g(i)} + b_i + e_{ij}, \qquad b_i \sim N(0,\ \tau^2), \qquad e_{ij} \sim N(0,\ \sigma^2), \qquad b_i \perp e_{ij}, \quad e_{ij} \perp e_{ik}\ (j \neq k) \]

Read the three pieces as three separate jobs: $\mu_{j,g(i)}$ is the population signal for site $j$ in the group participant $i$ belongs to, $b_i$ is how far this particular person sits from that signal, and $e_{ij}$ is what is left over at that particular site. The two independence statements at the end of the line are not decoration — the offset is independent of the noise, and the noise at one site is independent of the noise at another — and the algebra below spends both of them. In the simulation, $\tau^2 = 6.25$ (SD 2.5) and $\sigma^2 = 3.75$ (SD 1.94). The whole of this post is the observation that $b_i$ has no $j$ in it.

Written out for the four participants, the dataset is a three-column sum:

idsitepopulation mean $\mu_{j,g}$+ person offset $b_i$+ noise $e_{ij}$= observed
S01forearm12.0+2.5−0.414.1
S01hand16.0+2.5+1.620.1
S01shin10.0+2.5−1.111.4
S01back14.0+2.5+0.517.0
S02forearm12.0−3.0+0.79.7
S02hand16.0−3.0−2.110.9
S02shin10.0−3.0+1.38.3
S02back14.0−3.0−0.610.4
S03forearm18.0+0.8−1.217.6
S03hand24.0+0.8+2.427.2
S03shin13.0+0.8+0.414.2
S03back19.0+0.8−0.918.9
S04forearm18.0−2.0+0.916.9
S04hand24.0−2.0−1.420.6
S04shin13.0−2.0+1.712.7
S04back19.0−2.0+0.317.3
Row anatomy: one observation as three additive pieces S01 at the forearm: population signal 12.0 plus person offset +2.5 plus noise −0.4 equals the observed 14.1. one row of the dataset — S01 · control · forearm population signal μj,g person offset bi 12.0 +2.5 eij = −0.4 observed 14.1 0 4 8 12 16 g·m⁻²·h⁻¹ 12.0 + 2.5 + (−0.4) = 14.1 μj,g — the population signal: the same for everyone in this group at this site bi — the person offset: the same +2.5 in all four of S01's rows eij — the noise: redrawn in every row, never repeated

Figure 1. Row anatomy — one observation, three additive pieces: population signal 12.0, person offset +2.5, measurement noise −0.4, giving the observed 14.1 for S01 at the forearm.

The offset column repeats. The noise column never does. S01 carries +2.5 into four rows, S02 carries −3.0 into four rows, and the noise term changes at every single row — which is precisely why S03, whose offset of +0.8 is small relative to a residual SD of 1.94, can look like an ordinary independent-error participant even though the same generating mechanism produced their data. This is the first warning of the post: the offset is a property of the model, and its visibility in any one participant is a property of luck.

Illustration: one glowing bar split into population signal, person offset and measurement noise, with a single node above sending four threads down to four labelled measurement sites.

Why it is called an intercept

The name is an inheritance from drawing straight lines on graph paper, and here it tends to confuse more than it explains. Read "intercept" as how high this participant's whole line sits — the way one patient's temperature chart can run half a degree above another's for a week without the two charts ever crossing. The paragraph below only says that precisely.

If every person shares the same site profile and differs only by $b_i$, then each person's mean profile is the population profile shifted vertically — parallel, never tilted, never crossing. S01's mean profile sits 2.5 units above the control profile at all four sites; S02's sits 3.0 units below it at all four sites. The observed points do not lie on those lines, and nothing in the model asks them to: S01's realised deviations were +2.1, +4.1, +1.4 and +3.0, which is one parallel line plus four separate draws of $e_{ij}$. Parallelism is a property of the conditional means, not of the data.

Two conditional mean profiles, parallel to the population profile The control population mean profile across forearm, hand, shin and back is 12.0, 16.0, 10.0 and 14.0. S01's mean profile is parallel and 2.5 units above it; S02's is parallel and 3.0 units below. Observed measurements scatter around each line. 5 10 15 20 TEWL (g·m⁻²·h⁻¹) forearm hand shin back +2.5 −3.0 +2.5 −3.0 population mean (control) S01 mean profile (+2.5) S02 mean profile (−3.0) observed = that person's line + eij — parallelism belongs to the means, not to the data

Figure 2. Two conditional mean profiles — the population mean profile across the four sites in grey, S01's mean profile parallel and above it (+2.5), S02's parallel and below it (−3.0). The vertical gap is constant by construction; the observed measurements scatter around each line by $e_{ij}$.

The name is therefore about where the line sits, not about the y-axis being an interesting place. The word "random" is equally easy to misread: it does not mean arbitrary, and it does not mean the software picked a number. It means $b_i$ is treated as a draw from a distribution — here $N(0,\ 6.25)$ — rather than as a separate parameter to be estimated for each of the 80 participants. Because that distribution is centred at zero, adding $b_i$ leaves the population means untouched; it changes something else entirely, which is the subject of the next two sections.

Illustration: a clinician beside a floating chart where the grey population-average profile runs level across four sites and two brighter parallel lines sit a constant distance above and below it.

The moment the rows stop being independent

Nothing new is introduced here. The four lines below are S01's four rows from the table above, written as sums instead of as a table, so that the repeated number becomes impossible to miss.

Write out all four of S01's equations and look at the middle column:

\[ \begin{aligned} Y_{\text{S01},\,\text{forearm}} &= 12.0 + 2.5 - 0.4 = 14.1 \\ Y_{\text{S01},\,\text{hand}} &= 16.0 + 2.5 + 1.6 = 20.1 \\ Y_{\text{S01},\,\text{shin}} &= 10.0 + 2.5 - 1.1 = 11.4 \\ Y_{\text{S01},\,\text{back}} &= 14.0 + 2.5 + 0.5 = 17.0 \end{aligned} \]

The same $+2.5$ appears in all four rows, unchanged. Nobody asked the model for a correlation, no correlation parameter was typed anywhere, and no working correlation structure was selected — and yet these four rows now have something in common that four rows from four different people would not have.

The fan: one shared offset, four measurements One node b sub i at the top sends the same value +2.5 down to the four site measurements of participant S01, so every pair of those measurements has covariance tau squared equal to 6.25. participant S01 · control · four sites, one visit bi = +2.5 Var(bi) = τ² = 6.25 +2.5 +2.5 +2.5 +2.5 observed TEWL (g·m⁻²·h⁻¹) forearm 14.1 hand 20.1 shin 11.4 back 17.0 every pair shares the same bi ⇒ Cov(Yij, Yik) = τ² = 6.25 the noise eij is drawn afresh in every row (σ² = 3.75) and contributes nothing to the covariance one parent, four children — therefore correlated siblings

Figure 3. The fan — one node $b_i$ at the top with four arrows down to forearm, hand, shin and back. One parent, four children, therefore correlated siblings.

Three lines of algebra

Before the hard part: the line below looks like a wall of symbols, and it says something a clinician already believes — two measurements taken on the same person share whatever that person brought to both of them. If two nurses measure the same wound on the same afternoon, the part their readings have in common is the wound; the part they do not have in common is each nurse's own hand and each nurse's own tape. "Cov" is only the statistician's name for what these two have in common, and the three terms that vanish below are the three pairings that share nothing at all.

Take any two distinct sites $j \neq k$ from the same participant and expand the covariance:

\[ \operatorname{Cov}(Y_{ij},\,Y_{ik}) = \operatorname{Cov}(b_i + e_{ij},\ b_i + e_{ik}) = \underbrace{\operatorname{Var}(b_i)}_{\tau^2} + \underbrace{\operatorname{Cov}(b_i,\,e_{ik})}_{0} + \underbrace{\operatorname{Cov}(e_{ij},\,b_i)}_{0} + \underbrace{\operatorname{Cov}(e_{ij},\,e_{ik})}_{0} = \tau^2 = 6.25 \]

Three of the four terms vanish by the two independence assumptions written into the model, so the covariance between two measurements from the same person is exactly the variance of the thing they share. The derivation contains no distributional appeal and no approximation; it is an identity — but an identity that spends both assumptions, not one. A residual covariance that was not zero would be added to $\tau^2$ rather than replace it, which is the situation Post 6 takes apart. Notice also that the answer has neither a $j$ nor a $k$ in it, which is a fact Post 2 will spend an entire matrix on.

The variance of a single observation follows from the same expansion:

\[ \operatorname{Var}(Y_{ij}) = \operatorname{Var}(b_i) + \operatorname{Var}(e_{ij}) = \tau^2 + \sigma^2 = 6.25 + 3.75 = 10.00 \]

So of the 10.00 squared TEWL units of total variance carried by one simulated measurement, 6.25 are shared with every other measurement from the same person and 3.75 are unique to that row. The ratio between those two numbers has a name, and it is the whole of the next post.

Two familiar versions of the same idea

Several girth measurements taken on the same person correlate because they all ride on one unobserved quantity — overall body size — that is common to every tape-measure reading. Four subject scores from the same student correlate because they all ride on one unobserved quantity — that student's general ability — that is common to every examination.

Both analogies name the structure and neither explains a mechanism. In the running example, $b_i$ is a placeholder for everything person-level that the model does not contain, and it should not be read as a biological quantity.

Reading random = ~ 1 | id token by token

Everything above is requested from the software in one short line, and the line is worth reading slowly once rather than copying repeatedly. It is four tokens long — a tilde, the number one, a vertical bar, and the name of the column that identifies the person — and each token does exactly one job.

The specification for this simulated dataset is short:

# Spec A — random intercept, pooled residual variance
library(nlme)
fitA <- lme(tewl ~ site * group + age + sex + phototype,
            random = ~ 1 | id, data = skin, method = "REML")

# equivalent in lme4
library(lme4)
fitA2 <- lmer(tewl ~ site * group + age + sex + phototype + (1 | id), data = skin)
* Stata equivalent of Spec A
* mixed estimates by ML unless reml is requested; lme() and lmer() above are REML
mixed tewl i.site##i.group age i.sex i.phototype || id:, reml

Read random = ~ 1 | id from the inside out. The 1 is a column of ones, which is to say one number and not a slope on anything. The | means "for each level of", and id names the level: one draw per participant, 80 draws in total. Everything to the left of the vertical bar is what gets repeated; everything to the right decides how often it is redrawn. The (1 | id) in lme4 and the || id: in Stata say the same three things in a different order.

Of importance, the fixed part of the formula — site * group + age + sex + phototype — is untouched by any of this. The random statement changes what the model assumes about the covariance between rows; it does not change what the model assumes about the means.

What you are claiming if you leave it out

One question comes up in every viva: what actually goes wrong if you ignore all of this and run an ordinary regression? The honest answer is not "the p-values are wrong" but "it depends which comparison you are making". The three cases below point in three different directions, and keeping them apart is the whole of the skill.

Fit ordinary least squares to all 320 rows and you are claiming, in plain clinical language, that a second measurement from a participant already in the study is worth as much new information as a first measurement from a participant who has never been examined. Under the simulation that claim is false in a specific way: two rows from the same person already share 6.25 of the 10.00 squared TEWL units each of them carries, whereas two rows from different people share none.

What follows is not one error with one direction. The direction depends on which contrast you are computing, so it is worth stating precisely rather than as a slogan. Take three contrasts this design supports. First, the AD-versus-control difference averaged over the four sites: every participant contributes four correlated rows to it, so an analysis that ignores the offset counts 160 rows per group as 160 independent ones, and the standard error comes out far too small — about 0.35 against a true 0.60 in this simulation. Second, the AD-versus-control difference at one site: here each participant contributes exactly one row, the values being compared really are independent, and ignoring the offset costs essentially nothing — the reported standard error of about 0.71 is approximately right. Third, a contrast between sites within the same person: the direction reverses, because an analysis with no person effect leaves $b_i$ sitting in the error term, inflates the residual variance, and makes a genuinely precise comparison look imprecise.

Notably, the middle case is the one most often assumed to be broken, and it is not; the first case is the one that quietly is. Thus a single sentence such as "we adjusted for repeated measurements" tells a reader almost nothing. What has to be named is the contrast, because two of these three standard errors are wrong in opposite directions and the third is not wrong at all.

The first payoff: a difference measured more precisely than either of its parts

Before the hard part: the two formulas below describe something you already exploit in clinic. To judge whether a wound is healing you measure the same wound twice and subtract; you do not compare today's wound against the ward average. Subtracting two readings from the same patient cancels everything that patient brought to both of them, and only the two measurement wobbles are left. That cancellation is what the algebra performs, and it is why a within-person difference can be estimated more precisely than either of the two means it is built from.

Under this simulation, with $n = 40$ participants per group and a balanced design, the standard error of an estimated site mean within one group is

\[ \operatorname{SE}(\widehat{\mu}_{j}) = \sqrt{\frac{\tau^2 + \sigma^2}{n}} = \sqrt{\frac{10.00}{40}} = 0.50 \]

because a person's contribution to that mean carries both sources of variability, the offset and the noise. Now take a within-person contrast — the same participant's forearm minus their own back — and watch what happens algebraically:

\[ Y_{i,\text{forearm}} - Y_{i,\text{back}} = (\mu_{\text{forearm}} - \mu_{\text{back}}) + (e_{i,\text{forearm}} - e_{i,\text{back}}), \qquad b_i - b_i = 0 \]

The offset cancels exactly, for every participant, because it is the same number in both rows. What remains is the difference of two independent noise terms, so the standard error of that estimated within-person difference is

\[ \operatorname{SE}(\widehat{\mu}_{\text{forearm}} - \widehat{\mu}_{\text{back}}) = \sqrt{\frac{2\sigma^2}{n}} = \sqrt{\frac{7.50}{40}} = 0.43 \]

which is smaller than the 0.50 attached to either mean on its own. That is not a paradox and it is not a general law of nature: it holds whenever $\sigma^2 < \tau^2$, and in this simulation 3.75 is indeed smaller than 6.25. A model that treated the four measurements as independent could not produce 0.43, and this single number is the reason the last post of the series can defend a column of standard errors in front of an examiner.

A qualification belongs with both of those numbers. They are plug-in values — closed forms evaluated at the variance components the simulation was written with, for the unadjusted balanced cell-means model — and not the output of the fitted model in the code block above. Once age, sex and phototype join the fixed part, the site means and the between-person contrasts shift by a little, whereas the within-person difference does not shift at all, because a person-constant covariate cancels in exactly the same subtraction that removes $b_i$.

For reading a paper, one habit follows from this. When a within-person comparison is reported with a narrower confidence interval than the group means printed beside it, that is usually the offset cancelling rather than a mistake in the table.

What this post does not license

The claim defended here is narrow, and the surrounding claims that sound like it are not defended. First, a visible offset in two participants is not evidence that a random intercept is the correct covariance structure; S03's offset of +0.8 never showed a consistent sign, and four measurements per person are simply not many measurements. Second, $b_i$ is not an explanation of anything — it absorbs whatever is person-level and omitted, and reading it as a physiological property of a patient's skin would be a causal claim the design cannot support. Third, "the random intercept accounts for the repeated measurements" is at best half a sentence, because the term imposes a specific covariance pattern whose plausibility has to be examined rather than assumed, and Posts 2 and 6 examine it. Finally, no random effect repairs a wrong mean structure: if the site × group interaction belongs in the model and is left out, nothing in the random part will recover it.

What to do in your own analysis

  1. Plot the person profiles before you fit anything. A spaghetti plot of each participant across the repeated units may show you the offset directly, and it costs one line of code.
  2. Declare the grouping factor deliberately. Check that the rows you believe belong to one person really do share an identifier, because a mis-specified id silently converts a person effect into noise.
  3. Report $\widehat{\tau}^{2}$ and $\widehat{\sigma}^{2}$ as numbers. "A random intercept for participant was included" is not sufficient reporting; the two variance components could reasonably be reported alongside the fixed effects so that a reader can reconstruct what the model assumed.
  4. Label every contrast before interpreting its standard error — within-person, between-person with one row per participant, or between-person pooling each participant's repeated rows. The offset cancels in the first, does not bite in the second, and is decisive in the third, so the three carry different amounts of information even inside the same fitted model.
  5. Keep continuous person-level covariates continuous. Categorising age to make a table look tidy discards information and may distort the estimated effects; fractional polynomials or splines are the better first move if the relationship is not linear.
  6. Resist reading an individual's estimated offset as a clinical measurement. What $\widehat{b}_{i}$ is for, and what it is not for, is taken up properly in Post 3.

Key takeaways

Coming next

Post 2 fills in the remaining fifteen cells: one shared offset with equal-variance residuals produces exactly compound symmetry, and the ratio between 6.25 and 10.00 turns out to have a name that every epidemiologist already uses — Compound Symmetry and the ICC: One Offset, One Correlation.

Reference

  1. Laird NM, Ware JH. Random-effects models for longitudinal data. Biometrics. 1982;38(4):963–974.
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