Tutorials › Pharmacokinetic-Pharmacodynamic (PK/PD) Modeling › Mixed-Effects Concentration-QTc Models for Repeated ECGs

Concentration-QTc and Safety Models · Tutorial 371 of 598

Mixed-Effects Concentration-QTc Models for Repeated ECGs

Learn how subject-level random effects represent repeated ECG measurements and how within-subject concentration changes identify a distinct exposure-response association.

Advanced 12 min read

What You'll Learn

  • Specify a repeated-measures concentration-QTc model with random subject intercepts and slopes.
  • Separate within-subject concentration changes from differences in average concentration between subjects.
  • Interpret fixed effects and subject-specific deviations with their units.
  • Identify the assumptions that support mixed-effects estimation and interpretation.
  • Compare mixed-effects models with pooled regression and subject fixed-effects approaches.
  • Recognize sparse within-subject exposure variation and other warning signs.

Why Repeated ECGs Need a Subject-Level Model

When several ECGs are collected from one participant, their QTc measurements are not independent observations. Measurements from the same person may resemble one another because of stable individual characteristics, and a person’s QTc response to changing concentration may differ from the population average. Treating every ECG as independent can therefore misrepresent uncertainty and obscure what exposure variation is informing the estimated relationship.

The earlier material on the linear concentration-QTc model defines the population intercept and slope for a linear exposure-response relationship. Here the key extension is to represent repeated observations explicitly and distinguish two sources of concentration information: changes in concentration within a person and differences in average concentration between people. These sources need not imply the same association.

Definition: Let \(Y_{ij}\) be the baseline-adjusted, time-matched QTc change, in milliseconds, for subject \(i\) at ECG occasion \(j\). Let \(C_{ij}\) be the corresponding concentration, in a stated concentration unit, and let \(\bar C_i\) be subject \(i\)'s mean concentration across the observations included in the analysis. The within-subject concentration is \(C_{ij}-\bar C_i\); the between-subject concentration is \(\bar C_i-C_{\mathrm{ref}}\), where \(C_{\mathrm{ref}}\) is a chosen reference concentration.

A Mixed-Effects Model That Separates Exposure Information

One useful linear mixed-effects specification is

$$ Y_{ij}=\beta_0+\beta_W(C_{ij}-\bar C_i)+\beta_B(\bar C_i-C_{\mathrm{ref}})+b_{0i}+b_{1i}(C_{ij}-\bar C_i)+\epsilon_{ij}. $$

Here \(\beta_0\) is the population mean QTc change at the reference concentration for a subject whose mean concentration is \(C_{\mathrm{ref}}\). The coefficient \(\beta_W\) is the population-average within-subject association: the expected change in \(Y_{ij}\), in milliseconds, for a one-unit increase in concentration relative to that subject’s mean, holding the between-subject term fixed. The coefficient \(\beta_B\) describes how expected QTc change differs across subjects whose mean concentrations differ by one concentration unit. The distinction matters: \(\beta_W\) is informed by changes within subjects, whereas \(\beta_B\) is informed by contrasts in average concentration across subjects.

The subject-specific random intercept \(b_{0i}\) represents a deviation from the population intercept. The random slope \(b_{1i}\) represents a subject’s deviation from the population within-subject slope. Thus the within-subject slope for subject \(i\) is \(\beta_W+b_{1i}\). A common assumption is

$$ \begin{pmatrix}b_{0i}\\b_{1i}\end{pmatrix} \sim N\left( \begin{pmatrix}0\\0\end{pmatrix}, \begin{pmatrix}\tau_0^2&\tau_{01}\\\tau_{01}&\tau_1^2\end{pmatrix} \right),\qquad \epsilon_{ij}\sim N(0,\sigma^2). $$

Random effects are assumed independent across subjects, and residual errors are assumed independent across occasions and subjects, conditional on the random effects and the modeled predictors. The random effects and residual errors are also commonly assumed independent of the concentration predictors. These assumptions specify a model, not a guarantee about the data. In particular, the independence assumption between random effects and predictors can be consequential for the between-subject association.

Conditional on a subject’s random effects, the expected response is the fixed-effects mean plus that subject’s intercept and slope deviations. Marginally, averaging across subjects with mean-zero random effects, the expected response is the fixed-effects part. Correlation between repeated outcomes follows because ECGs from the same subject share \(b_{0i}\) and \(b_{1i}\); observations from different subjects do not share these subject-level effects.

Why Within-Subject Variation Identifies a Different Slope

The decomposition follows from writing a subject’s concentration as its mean plus its deviation from that mean:

$$ C_{ij}-C_{\mathrm{ref}} =(C_{ij}-\bar C_i)+(\bar C_i-C_{\mathrm{ref}}). $$

A single pooled concentration slope effectively asks whether outcomes differ across all observations as concentration differs. But a pooled contrast can combine changes within a person with differences between people. For example, subjects with higher average concentrations may also differ in stable characteristics related to QTc. Separating the two terms makes those distinct comparisons explicit. Subject-level random effects account for repeated-measure dependence and heterogeneity; they do not, by themselves, make a between-subject comparison free of confounding.

Interpretation: \(\beta_W\) is a within-subject exposure-response association under the specified model. It is not automatically a causal drug effect. Its interpretation depends on the model’s assumptions and on the design providing meaningful concentration variation within subjects.

A simple justification for this separation comes from subtracting each subject’s mean response from each response. In the model, the between-subject term and the random intercept are constant within a subject, so they cancel:

$$ Y_{ij}-\bar Y_i = \beta_W(C_{ij}-\bar C_i) +b_{1i}(C_{ij}-\bar C_i) +(\epsilon_{ij}-\bar\epsilon_i). $$

The remaining concentration predictor is the within-subject deviation. This shows why repeated concentration changes, rather than just differences in average concentrations across participants, carry direct information about the within-subject slope. In a mixed-effects fit, the random-slope distribution and residual model also influence estimation and uncertainty; the subtraction is an explanation of the source of information, not a replacement for fitting the specified model.

Worked Example: Separating Within- and Between-Subject Slopes

Consider hypothetical measurements for three subjects, each with two ECGs. Concentration is in mg/L, and \(Y\) is time-matched QTc change in milliseconds. Use \(C_{\mathrm{ref}}=10\) mg/L.

SubjectConcentrations (mg/L)QTc changes (ms)Mean concentration (mg/L)Mean QTc change (ms)
A8, 121.0, 3.0102.0
B18, 223.4, 4.6204.0
C28, 325.2, 6.8306.0

For subject A, the within-subject slope from the two observations is

$$ \frac{3.0-1.0\ \mathrm{ms}}{12-8\ \mathrm{mg/L}} =\frac{2.0\ \mathrm{ms}}{4\ \mathrm{mg/L}} =0.50\ \mathrm{ms/(mg/L)}. $$

For subject B, the corresponding calculation is \((4.6-3.4)\ \mathrm{ms}/(22-18)\ \mathrm{mg/L}=0.30\ \mathrm{ms/(mg/L)}\). For subject C it is \((6.8-5.2)\ \mathrm{ms}/(32-28)\ \mathrm{mg/L}=0.40\ \mathrm{ms/(mg/L)}\). Their simple average is \((0.50+0.30+0.40)/3=0.40\ \mathrm{ms/(mg/L)}\). This is a transparent summary of these within-subject contrasts; it is not necessarily the estimate produced by a mixed-effects fit, which depends on the fitted variance structure and estimation method.

The between-subject slope from the subject means is \((6.0-2.0)\ \mathrm{ms}/(30-10)\ \mathrm{mg/L}=0.20\ \mathrm{ms/(mg/L)}\). The data therefore illustrate different within- and between-subject patterns. A single slope that combines all six observations would conceal that distinction. With only two measurements per subject, this example also cannot establish the reliability of any subject-specific slope or support a precise estimate of random-slope variability.

Interpreting Predictions and Random-Effect Variability

Fixed effects describe the modeled population mean; random effects describe how a subject may depart from that mean. A prediction for a new subject generally uses the fixed-effects mean, whereas a prediction for a subject with observed data may also use estimated subject-specific random effects. These are different prediction targets and should not be interchanged.

Worked Example: Population and Subject-Specific Predictions

Suppose a hypothetical fitted model has \(\beta_0=2.0\) ms, \(\beta_W=0.40\ \mathrm{ms/(mg/L)}\), and \(\beta_B=0.20\ \mathrm{ms/(mg/L)}\), with \(C_{\mathrm{ref}}=10\) mg/L. For a subject with mean concentration \(\bar C_i=20\) mg/L and an ECG at \(C_{ij}=24\) mg/L, the within-subject deviation is \(24-20=4\) mg/L and the between-subject deviation is \(20-10=10\) mg/L. The population mean prediction is

$$ 2.0+0.40(4)+0.20(10)=2.0+1.6+2.0=5.6\ \mathrm{ms}. $$

If the subject’s estimated random intercept is \(b_{0i}=-1.0\) ms and random slope deviation is \(b_{1i}=0.10\ \mathrm{ms/(mg/L)}\), the subject-specific prediction is

$$ 5.6-1.0+0.10(4)=5.0\ \mathrm{ms}. $$

The population prediction does not include that subject-specific deviation. For a new subject without ECG data, the random effects are not known; a population-mean prediction averages over their assumed mean-zero distribution. A prediction interval for a future observation would also reflect random-effect and residual variability.

For example, if \(\tau_0^2=4\ \mathrm{ms}^2\), \(\tau_1^2=0.01\ [\mathrm{ms/(mg/L)}]^2\), \(\tau_{01}=0\), and \(\sigma^2=1\ \mathrm{ms}^2\), the marginal variance of a future observation at within-subject deviation \(x=C_{ij}-\bar C_i\) is

$$ \operatorname{Var}(Y_{ij}\mid C_{ij},\bar C_i) =\tau_0^2+2x\tau_{01}+x^2\tau_1^2+\sigma^2. $$

At \(x=4\) mg/L, this is \(4+2(4)(0)+16(0.01)+1=5.16\ \mathrm{ms}^2\), with standard deviation \(\sqrt{5.16}=2.27\) ms. This is marginal variability for a new observation under the model, not uncertainty in the fixed-effect estimate.

Worked Example: Diagnosing Weak Within-Subject Information

Suppose a hypothetical study has 40 subjects and four ECGs per subject, but each subject’s four concentrations are nearly identical. Across the study, subjects’ mean concentrations range from 2 to 30 mg/L. The large number of ECGs does not necessarily provide strong information about \(\beta_W\): the within-subject predictor \(C_{ij}-\bar C_i\) is close to zero for almost every observation.

The distinction can be checked directly by summarizing within-subject concentration ranges or standard deviations, as well as the range of \(\bar C_i\) across subjects. If the within-subject deviations are very small, the data may estimate the between-subject association more clearly than the within-subject association. In that setting, a precise-looking pooled slope should not be presented as strong evidence about the within-subject response. The model cannot recover information that the sampling design did not collect.

Assumptions, Alternatives, and Warning Signs

The model is most useful when subjects have repeated measurements, there is informative concentration variation within subjects, and the linear mean structure is a reasonable working representation over the concentrations analyzed. The Gaussian random-effects and residual assumptions support standard likelihood-based inference. Inference also relies on an adequate number of independent subjects to estimate population-level variation; many ECGs from only a few subjects do not substitute fully for independent subjects.

Several modeling choices answer different questions:

ApproachWhat it representsImportant limitation
Pooled linear regressionOne slope across all observations, ordinarily treating observations as independentIgnores within-subject dependence and mixes within- and between-subject information
Random-intercept mixed modelSubject-specific baseline deviations with a common concentration slopeDoes not allow subjects to have different concentration slopes
Random-intercept and random-slope modelSubject-specific intercepts and slopes, with population distributions for bothNeeds sufficient data and within-subject exposure spread to estimate slope variation
Subject fixed-effects regressionSubject-specific intercepts, with the slope principally identified by within-subject changesDoes not estimate a population distribution of random effects; time-invariant subject terms cannot be separately estimated

The random-intercept and random-slope model is not automatically preferable in every dataset. A random slope may be weakly identified when most subjects have few observations or little concentration variation. Variance estimates near zero, convergence warnings, or estimates that change substantially under reasonable model simplifications are reasons to investigate the fit rather than to report it uncritically. Residual patterns against fitted values or concentration, and subject-level plots of observed responses against concentration, can reveal systematic mismatch or unusually influential subjects. These checks flag concerns; they do not by themselves determine a uniquely correct model.

The decomposition also has limitations. \(\beta_B\) may reflect differences between subjects other than concentration, particularly if subject characteristics related to QTc also relate to mean concentration. The assumption that random effects are independent of the concentration predictors may not hold. And \(\beta_W\) remains an association unless the study design and assumptions support a causal interpretation. A mixed-effects structure accounts for clustering; it does not fix confounding, poor exposure coverage, or an unsuitable mean model.

Common Mistake

  • Wrong reasoning: “There are many repeated ECGs and a wide concentration range across the study, so the within-subject slope must be well determined.”
  • Correction: A wide overall range can come almost entirely from differences in subjects’ average concentrations. Assess variation in \(C_{ij}-\bar C_i\) within subjects. If it is limited, the within-subject slope can be weakly informed even when the total sample contains many observations and spans a broad concentration range.
  • Wrong reasoning: “The random intercept handles all dependence, so a common pooled slope is necessarily the within-subject relationship.”
  • Correction: A random intercept represents subject-level outcome differences, but it does not itself separate within- and between-subject concentration contrasts. Include the within- and between-subject terms when those associations need distinct interpretation.
Key takeaway: In repeated concentration-QTc data, subject-level random effects represent clustering and heterogeneity, while the within/between concentration decomposition clarifies which exposure contrasts inform each fixed-effect slope. Neither feature removes the need to check assumptions and exposure support.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. A subject’s mean concentration is 15 mg/L and one ECG is collected at 19 mg/L. What are the within-subject and between-subject concentration terms if \(C_{\mathrm{ref}}=10\) mg/L?
  2. In the model, what does \(\beta_W\) describe, and what are its units if \(Y_{ij}\) is measured in milliseconds and concentration in mg/L?
  3. Why might a dataset with a wide overall concentration range still provide little information about \(\beta_W\)?
  4. What does adding a random slope allow that a random-intercept-only model does not?

Solutions. (1) The within-subject term is \(19-15=4\) mg/L; the between-subject term is \(15-10=5\) mg/L. (2) It describes the population-average association between a subject’s concentration deviation from their own mean and QTc change; its units are ms per mg/L. (3) The overall range may arise mostly because subjects have different mean concentrations, while each subject’s repeated concentrations vary little around their own mean. (4) It allows the within-subject concentration slope to vary across subjects rather than requiring every subject to share the same slope.

Clinical Biostats