Tutorials › Nonlinear Mixed-Effects Models (NLME) › Repeated Pharmacokinetic Profiles as Clustered Data

Why Mixed-Effects Models · Tutorial 1 of 797

Repeated Pharmacokinetic Profiles as Clustered Data

Use subject identifiers and measurement times to read a repeated pharmacokinetic dataset as a collection of individual observed trajectories.

Beginner 9 min read

What You'll Learn

  • Identify subjects as the clusters in a repeated concentration-time dataset.
  • Distinguish a subject, a concentration measurement, and a sampling time.
  • Count subjects separately from the total number of measurement records.
  • Represent one subject’s observed profile as ordered time-concentration pairs.
  • Check subject identifiers, units, and time ordering when organizing repeated data.

Why the Subject Is the Organizing Unit

A pharmacokinetic dataset often contains several concentration measurements from each person. A row in the dataset may describe one assay result at one time, but it does not necessarily represent a different person. To read such data correctly, first identify who was sampled and then identify what was measured for that person, and when.

The subject is the cluster: the group of records that belong to one identified person. A concentration measurement is an observation made on that subject at a particular time. The subject is therefore the sampling unit when people are recruited and followed, whereas each assay result is a measurement occasion. These units answer different questions and should not be counted interchangeably.

Definition: In a repeated pharmacokinetic dataset, a subject is an identified participant, and a cluster is the set of observations associated with that subject. An observation is a recorded concentration for a subject at a specified time. A subject’s observed trajectory is the ordered collection of that subject’s observed time-concentration pairs. It describes the recorded points; it does not, by itself, specify concentrations at unmeasured times.

For describing the dataset, let \(i\) index subjects and \(j\) index measurements within a subject. Write \(t_{ij}\) for the time of measurement \(j\) on subject \(i\), and \(C_{ij}\) for its measured concentration. The records for subject \(i\) can then be written as \((t_{i1},C_{i1}), (t_{i2},C_{i2}), \ldots\), ordered by time. The index \(i\) identifies the person; the index \(j\) identifies a measurement occasion for that person.

$$ \text{Subject }i:\quad \{(t_{ij},C_{ij}):j=1,\ldots,m_i\} $$

Here \(m_i\) is the number of observed measurements for subject \(i\). It can differ across subjects. The total number of records is the sum of those subject-specific counts, while the number of sampled subjects is the number of distinct subject identifiers. Neither count should be substituted for the other.

Reading a Small Concentration-Time Dataset

Consider the following entirely hypothetical data. Concentrations are in milligrams per litre (mg/L), and time is in hours after dosing. Each row is one measurement record.

Subject IDTime (h)Concentration (mg/L)
A0.58.0
A1.06.0
A2.03.0
B0.56.0
B1.04.5
B2.02.2
C0.510.0
C1.07.0
C2.03.5

There are three distinct subject IDs, so there are three sampled subjects and three clusters. There are nine rows, so there are nine measurement records. Subject A’s observed trajectory is \((0.5\text{ h},8.0\text{ mg/L}), (1.0\text{ h},6.0\text{ mg/L}), (2.0\text{ h},3.0\text{ mg/L})\). Each other subject likewise has a trajectory made from that subject’s own rows.

Worked Example: Counting Subjects and Records

A hypothetical study follows four participants. Each has concentration measured at 0.25, 1, and 4 hours after dosing, with no missing records. How many subjects and how many measurement records are represented?

There are four distinct participants, so the subject count is \(N=4\). Each contributes \(m_i=3\) records. The total number of records is

$$ \sum_{i=1}^{4}m_i=3+3+3+3=12. $$

Thus, the dataset has four subjects and twelve concentration measurements. The twelve records do not describe twelve different participants: the subject IDs show that they are three repeated measurements on each of four participants.

Unequal Measurement Counts and Subject Trajectories

Repeated datasets need not have the same number of measurements for everyone. A participant may have fewer recorded concentrations because a visit was missed, a sample was unavailable, or the schedule differed. The indexing still works: \(m_i\) records how many observations are present for subject \(i\), and the observed trajectory contains those records only. A missing scheduled measurement is not an observed concentration and should not be silently filled in with a made-up value.

Worked Example: Counting an Uneven Dataset

In a hypothetical dataset, subject P has measurements at two times, subject Q at three times, and subject R at one time. Their recorded concentrations are as follows: P has 5.2 mg/L at 1 hour and 2.1 mg/L at 4 hours; Q has 7.0 mg/L at 0.5 hours, 4.0 mg/L at 2 hours, and 1.5 mg/L at 6 hours; R has 3.8 mg/L at 2 hours.

The number of sampled subjects is the number of distinct IDs: P, Q, and R, so \(N=3\). The number of measurement records is

$$ \sum_{i=1}^{3}m_i=2+3+1=6. $$

Subject Q’s trajectory is \((0.5\text{ h},7.0\text{ mg/L}), (2\text{ h},4.0\text{ mg/L}), (6\text{ h},1.5\text{ mg/L})\). Subject R’s observed trajectory consists of just \((2\text{ h},3.8\text{ mg/L})\). That single record is still associated with subject R, although it gives only a limited description of that subject’s time course.

The key bookkeeping result follows directly from grouping records by ID. If there are \(N\) distinct subjects and subject \(i\) has \(m_i\) records, then the record count \(M\) is the sum of the sizes of the subject-specific groups:

$$ M=\sum_{i=1}^{N}m_i. $$

This identity does not make \(M\) a subject count. It is a count of all observed rows after the rows have been partitioned by subject. The distinction is descriptive and structural; it does not require equal measurement schedules or a particular concentration-time model.

From Records to a Usable Representation

A long-format table, like the one above, stores one measurement per row and repeats the subject ID on each row. It is often convenient for sorting, plotting, or applying software that expects one record per observation. A wide-format table places times or occasions in separate columns, which can make a balanced schedule easy to scan. Either format can represent the same observations, provided the subject identity, time, concentration, and units remain unambiguous.

Worked Example: Constructing One Trajectory From Rows

A hypothetical long-format file contains these records for subject D: 2 hours, 9.1 mg/L; 0.5 hours, 13.4 mg/L; and 1 hour, 11.2 mg/L. Write D’s trajectory in time order.

The listed rows are not already in chronological order, so sort them by time while retaining their paired concentrations. The ordered pairs are

$$ (0.5\text{ h},13.4\text{ mg/L}),\quad (1.0\text{ h},11.2\text{ mg/L}),\quad (2.0\text{ h},9.1\text{ mg/L}). $$

The result is one subject’s observed trajectory, with \(m_D=3\) measurements. Sorting changes only the order in which the records are displayed; it does not change which concentration belongs to which time or subject.

A useful first check is to confirm that every record can be assigned to the intended subject and time. If a subject ID is missing or reused for two different people, the cluster structure can be misidentified. If time units are inconsistent—for example, some entries are minutes and others hours—the apparent ordering and spacing can be wrong. Before interpreting any trajectory, check IDs, time units, concentration units, and the pairing of each value with its time.

What This Representation Does—and Does Not—Say

A trajectory is a way to preserve the subject-level order and grouping of the observed data. It does not assert that the concentration changes linearly between recorded times, nor does it provide measurements at times that were not sampled. Connecting points on a plot may help display their order, but the line is a visual aid, not an additional set of observed concentrations.

Likewise, identifying a subject as a cluster does not by itself specify a statistical model for the measurements. The records from one person are repeated observations from that person, not newly recruited people. How that repeated structure affects statistical assumptions and inference is a separate question. At this stage, the essential task is to preserve the identity and timing of every record.

The main alternatives are representations of the same information, rather than competing definitions of the sampling unit. A long table emphasizes individual records; a wide table emphasizes repeated occasions across subjects; and a subject-by-subject trajectory listing makes within-person time order explicit. A single summary per subject can be useful for a question that specifically concerns that summary, but it discards the separate time-specific concentrations. No one representation is universally best: choose one that keeps the subject ID, time, and concentration interpretable for the task.

Key takeaway: Count distinct subject IDs to count sampled subjects, and count measurement rows to count observations. Group each subject’s records by ID and order them by time to describe that subject’s observed trajectory.

Common Data-Handling Pitfalls

  • Calling every row a subject. This counts measurement occasions as if each were a different person. First count distinct subject IDs; then count rows separately.
  • Grouping by time instead of subject. Measurements taken at the same time can belong to different people. A trajectory is formed by subject ID, then ordered by time.
  • Assuming everyone has the same number of observations. Check the records for each ID. In an uneven dataset, use each subject’s actual \(m_i\), not a presumed common schedule.
  • Treating an unobserved time as a measured value. A blank or absent record is not a concentration of zero. Keep missing measurements distinct from measured concentrations.
  • Mixing units or mismatching pairs. Verify that times use a common unit and that each concentration remains attached to its correct subject and time.

Check Your Understanding

Answer each question using the definitions of subject, record, and trajectory. Brief solutions follow.

  1. A hypothetical dataset has subject IDs A, A, B, B, B, and C. How many subjects and how many records are present?
  2. Subject M has measurements of 12 mg/L at 0.5 hours and 5 mg/L at 3 hours. Write M’s observed trajectory in the course notation.
  3. Three subjects contribute 2, 4, and 3 records, respectively. Calculate the number of records and state the number of subjects.
  4. A file lists one person’s measurements at 4 hours, 1 hour, and 2 hours. What should be done before writing the trajectory, and what must remain paired during that step?

Solutions. (1) There are three distinct IDs, so three subjects; there are six listed rows, so six records. (2) M’s trajectory is \((0.5\text{ h},12\text{ mg/L}), (3\text{ h},5\text{ mg/L})\), in increasing time order. (3) The record count is \(2+4+3=9\), and the subject count is three. (4) Sort the records by time, keeping each concentration paired with its original time; the ordered trajectory then lists those time-concentration pairs from earliest to latest.