Tutorials › Nonlinear Mixed-Effects Models (NLME) › Choosing the Resampling Unit for NLME Bootstraps

Bootstrap, Profile Likelihood and Parameter Uncertainty · Tutorial 615 of 797

Choosing the Resampling Unit for NLME Bootstraps

Understand how to choose the bootstrap resampling unit so that NLME parameter uncertainty reflects the independent sampling units and the intended target population.

Advanced 12 min read

What You'll Learn

  • Define the subject record as the resampling unit for longitudinal NLME data.
  • Relate within-subject covariance to uncertainty in population-level estimates.
  • Distinguish subject-level and observation-level resampling targets.
  • Recognize how unequal numbers of records affect weighting and interpretation.
  • Identify assumptions and diagnostics relevant to choosing the resampling unit.

Why the Resampling Unit Matters

A longitudinal NLME data set may contain many measurements but far fewer independent subjects. A bootstrap that resamples individual measurements treats each selected row as a sampling unit; a bootstrap that resamples subjects carries each selected subject’s records together. These choices do not merely change the mechanics of resampling. They represent different assumptions about how the data were sampled, and can therefore produce different uncertainty estimates.

The key question is: what units would vary across repeated samples from the population relevant to the inference? For population parameters in a typical longitudinal NLME analysis, subjects are sampled from a population and each subject contributes a trajectory. Repeated measurements on one person share that person’s latent characteristics and are generally dependent. Treating those measurements as independent replicates can make the data appear to contain more independent information than they do.

Subject Records and the Dependence Structure

Index subjects by \(i=1,\ldots,N\) and observations within subject \(i\) by \(j=1,\ldots,n_i\). A general longitudinal NLME model can be written as

$$ y_{ij}=f(t_{ij},d_{ij},x_{ij};\theta,b_i)+\epsilon_{ij}. $$

Here \(y_{ij}\) is the response, such as concentration; \(t_{ij}\), \(d_{ij}\), and \(x_{ij}\) denote time, dose information, and other recorded covariates; \(\theta\) is a vector of population parameters; \(b_i\) is a subject-specific random effect; and \(\epsilon_{ij}\) is residual error. In the usual formulation, subjects’ random effects are independent draws from a population distribution, and residual errors are independent across observations conditional on the subject effects and the model covariates. The precise distributional assumptions depend on the model, but repeated observations from a subject remain linked through \(b_i\).

Definition: A subject record is the complete set of data associated with one subject: that subject’s response observations together with their times, doses, covariates, and other design information needed for the analysis. In a subject-level nonparametric bootstrap, the resampling unit is this whole record, not an individual response row.

The subject-level choice is appropriate when the independent sampling units are subjects and the target is uncertainty in population-level estimates across samples of subjects. It does not mean that every observation within a subject must be identical or that the observation schedule must be the same for all subjects. It means the cluster of linked records is kept together because its members are not independent sampling units.

A Covariance Justification

A simple random-intercept model makes the consequence of within-subject dependence explicit. Suppose

$$ y_{ij}=\mu+b_i+\epsilon_{ij}, \qquad b_i\sim N(0,\tau^2), \qquad \epsilon_{ij}\sim N(0,\sigma^2), $$

with random intercepts independent across subjects and residuals independent across observations and independent of the random intercepts. For two distinct observations from the same subject, the shared \(b_i\) contributes covariance. An individual observation, by contrast, includes both random-intercept and residual variation:

$$ \operatorname{Cov}(y_{ij},y_{ik})=\tau^2\quad (j\ne k), \qquad \operatorname{Var}(y_{ij})=\tau^2+\sigma^2, \qquad \operatorname{Cov}(y_{ij},y_{\ell k})=0\quad (i\ne \ell). $$

This distinction matters: the covariance \(\tau^2\) applies to two distinct same-subject observations, not to an observation with itself. The latter is a variance, \(\tau^2+\sigma^2\).

If every subject has \(m\) observations, the grand mean over all \(Nm\) responses is

$$ \bar{y}=\mu+\frac{1}{N}\sum_{i=1}^{N}b_i+ \frac{1}{Nm}\sum_{i=1}^{N}\sum_{j=1}^{m}\epsilon_{ij}. $$

Independence across subjects and residuals gives the variance directly. The random-intercept contribution is averaged over \(N\) subjects, while the residual contribution is averaged over \(Nm\) observations:

$$ \operatorname{Var}(\bar{y})=\frac{\tau^2}{N}+\frac{\sigma^2}{Nm}. $$

An analysis that instead treats all \(Nm\) observations as independent with variance \(\tau^2+\sigma^2\) would use \((\tau^2+\sigma^2)/(Nm)\). That expression divides the between-subject component by \(Nm\), although the study sampled only \(N\) independent subject effects. A subject-level bootstrap retains the clustering that produces the correct sampling structure.

Worked Example: How Repeated Measurements Change the Standard Error

Suppose a hypothetical study has \(N=20\) subjects, each with \(m=4\) measurements. For illustration, assume a random-intercept variance of \(\tau^2=9\) concentration-units squared and a residual variance of \(\sigma^2=16\) concentration-units squared. The model assumptions above imply independent subjects and residuals, with the same random-intercept contribution shared by a subject’s distinct observations.

The variance of the grand mean under this model is

$$ \operatorname{Var}(\bar{y})=\frac{9}{20}+\frac{16}{20(4)} =0.45+0.20=0.65. $$

Thus its standard error is \(\sqrt{0.65}=0.8062\) concentration units. If the 80 observations were incorrectly treated as independent, the corresponding variance would be

$$ \frac{9+16}{20(4)}=\frac{25}{80}=0.3125, \qquad SE=\sqrt{0.3125}=0.5590\text{ concentration units}. $$

The independent-row calculation gives a smaller standard error because it incorrectly lets the shared subject effect average away across 80 independent units. In fact, that component averages across 20 subjects. These calculations illustrate the dependence problem; a fitted NLME estimator may not equal the grand mean, but its uncertainty is still affected by the sampling unit.

What a Subject-Level Bootstrap Represents

Let \(D_i\) denote the subject record for subject \(i\), and let \(\hat{\theta}\) be the estimate from the original data. A subject-level nonparametric bootstrap approximates repeated sampling by drawing subject records from the observed collection of \(N\) records, with replacement, and refitting the model to each replicate. A selected record contributes all of its linked observations. If a record is selected more than once, each copy represents a bootstrap subject in that replicate.

The resulting variation in estimates represents sensitivity to which subjects, and which complete subject trajectories, appear in a sample from the empirical subject population. It is not the same as uncertainty obtained by treating individual measurements as independent draws from a population of rows. The latter targets a different sampling story and usually breaks the longitudinal dependence that the NLME model is intended to represent.

The target also depends on how subjects are weighted in the analysis. A likelihood-based NLME fit is not generally a simple average of subject means, but the distinction between subject-weighted and observation-weighted summaries helps show why unequal record counts require care.

Worked Example: Unequal Record Counts and the Target Summary

Consider hypothetical concentration measurements in mg/L for three subjects: subject A has 8 and 10; subject B has 12, 14, and 16; subject C has 20. The mean of the three subject-specific means is

$$ \frac{(8+10)/2+(12+14+16)/3+20/1}{3} =\frac{9+14+20}{3}=14.33\text{ mg/L}. $$

The pooled observation mean is instead

$$ \frac{8+10+12+14+16+20}{6} =\frac{80}{6}=13.33\text{ mg/L}. $$

These are different summaries: the first weights each subject equally, whereas the second gives more weight to subjects with more observations. Now consider one hypothetical subject-level bootstrap draw containing A twice and C once. Keeping each selected record intact gives subject means 9, 9, and 20 mg/L, whose equal-subject average is \(38/3=12.67\) mg/L. The pooled mean of the duplicated records is

$$ \frac{(8+10)+(8+10)+20}{2+2+1} =\frac{56}{5}=11.20\text{ mg/L}. $$

This draw illustrates two points: resampling a subject carries that subject’s full observed record, and the statistic or fitted model determines how records of different sizes contribute. Before interpreting bootstrap variability, clarify the population target and the weighting implicit in the estimator. If record counts differ because of missed visits or informative dropout, resampling whole records does not by itself correct bias caused by that process.

When Trajectories Carry More Than a Shared Intercept

Dependence can also arise through subject-specific slopes or other random effects. For example, in a linear random-intercept-and-slope model with time \(t\),

$$ y_{ij}=\beta_0+\beta_1t_{ij}+b_{0i}+b_{1i}t_{ij}+\epsilon_{ij}, \qquad \operatorname{Var} \begin{pmatrix}b_{0i}\\b_{1i}\end{pmatrix} = \begin{pmatrix}\omega_{00}&\omega_{01}\\\omega_{01}&\omega_{11}\end{pmatrix}, $$

assuming independent residual errors with variance \(\sigma^2\), the covariance between distinct observations from the same subject at times \(t\) and \(s\) is

$$ \operatorname{Cov}(y_i(t),y_i(s)) =\omega_{00}+\omega_{01}(t+s)+\omega_{11}ts. $$

Worked Example: Keeping a Subject-Specific Slope Together

Suppose a hypothetical model has \(\omega_{00}=4\) concentration-units squared, \(\omega_{01}=0\), \(\omega_{11}=1\) concentration-units squared per day squared, and residual variance \(\sigma^2=1\) concentration-units squared. For distinct observations at days 0 and 1 from the same subject, their covariance is

$$ 4+0(0+1)+1(0)(1)=4\text{ concentration-units squared}. $$

The day-0 observation has variance \(4+1=5\) concentration-units squared. The day-1 observation has variance \(4+1+1=6\) concentration-units squared: 4 from the random intercept, 1 from the random slope at day 1, and 1 from residual error. Resampling the subject record preserves the pair of observations and their trajectory. Resampling rows separately can pair a day-0 value from one subject with a day-1 value from another, losing the within-subject relationship that informs the random-effects distribution.

Assumptions, Diagnostics, and Alternatives

The subject-level resampling rationale relies on the subject being the independent sampling unit for the target inference. In broad terms, subjects should be exchangeable draws from the population represented by the analysis, conditional on any design features that define separate sampling groups. Within each subject, the observed records should remain attached to that subject. The fitted NLME model also needs to be suitable for the intended estimation; resampling the correct unit cannot repair structural model misspecification.

Useful checks before interpreting results include:

  • Confirm that subject identifiers uniquely define the independent clusters and that every observation is assigned to the right subject.
  • Check that each record includes the observations and covariates needed for refitting, not just the response values.
  • Compare the number of independent subjects with the total number of observations. A large row count does not compensate for very few independent subjects.
  • Inspect whether subjects have markedly different observation counts or schedules, and decide whether the estimator’s weighting matches the scientific target.
  • Consider whether recruitment, sites, families, or other features create dependence across nominal subject identifiers. If the true independent unit is a higher-level cluster, resampling subjects separately would still treat dependent units as independent.

Observation-level resampling can be defensible when the rows really are independent sampling units for the target question. That is not the usual situation for repeated measures with subject-specific random effects. A parametric bootstrap is a different alternative: it generates data from a specified fitted model rather than resampling observed subject records. Its uncertainty therefore relies on the adequacy of that model’s distributional assumptions. Neither alternative should be chosen simply because it is easier to compute.

A subject-level nonparametric bootstrap also has limitations. Its empirical population contains only the observed subjects, so it cannot create new kinds of subjects absent from a small sample. With few subjects, bootstrap estimates of tail uncertainty can be unstable. If subjects are sampled in meaningful groups or from a multistage design, the resampling scheme must reflect that design; a plain subject-level draw may not do so. Finally, an unusual or incomplete record is resampled as observed. This preserves the data structure, but does not automatically address informative missingness or correct a biased sampling process.

Common Mistake

Common mistake: “There are 400 concentration measurements, so the bootstrap should draw 400 rows; each measurement is a replicate.” This reasoning confuses the number of observations with the number of independent sampling units. If those measurements come from 40 subjects, and within-subject responses share random effects, the independent units for population-level subject sampling are generally the 40 subject records. Resampling rows separately breaks trajectories and does not represent repeated samples of subjects.

The correction is to identify the source of replication relevant to the estimand before choosing the resampling unit. For population-level NLME parameter uncertainty under subject sampling, retain each subject’s complete record as one unit. Then assess whether the subject-level sampling assumptions and study design support that choice.

Key takeaway: The bootstrap resampling unit determines what is allowed to vary across hypothetical repeated samples. For longitudinal NLME inference about a population of subjects, resampling complete subject records typically preserves the dependence and trajectory structure that individual-row resampling destroys.

Check Your Understanding

Answer each question using the distinction between an observation and an independent sampling unit.

  1. In a random-intercept model, what is the covariance between two distinct observations from the same subject, and what is the variance of one observation?
  2. A study observes 30 subjects five times each. Why is a row-level bootstrap generally inappropriate for population-level subject uncertainty?
  3. Three subjects have 2, 3, and 1 observations, respectively. Why might a pooled observation summary differ from an equally subject-weighted summary?
  4. What sampling assumption could fail if subjects are recruited in families but family members are resampled independently?

Solutions. (1) The covariance of distinct same-subject observations is \(\tau^2\); the variance of one observation is \(\tau^2+\sigma^2\), because it includes residual variance as well. (2) The five rows within each subject are linked through subject-specific effects, so there are 30 subject sampling units, not 150 independent subjects; row resampling breaks the trajectories. (3) The pooled summary weights subjects in proportion to their record counts, whereas an equally subject-weighted summary gives each subject the same weight. (4) Family members may be dependent, violating independent subject sampling; the independent unit may instead be the family or another cluster defined by the sampling design.