Tutorials › Optimal Design and Model-Informed Dosing › Latent Adherence in Individual Bayesian Models

Bayesian Forecasting and Dose Adaptation · Tutorial 324 of 497

Latent Adherence in Individual Bayesian Models

Build and interpret a joint posterior for an individual’s dose-taking history and PK parameters, rather than treating uncertain adherence as known.

Advanced 13 min read

What You'll Learn

  • Encode each uncertain dose event with a binary latent indicator and specify an adherence prior.
  • Write the joint posterior for latent dose events and individual PK parameters.
  • Marginalize over alternative dose histories when estimating adherence.
  • Calculate posterior adherence probabilities from hypothetical concentration data.
  • Diagnose when adherence and PK parameters are difficult to distinguish.
  • Compare latent-variable inference with fixing or imputing dose histories.

Why Treat Dose-Taking as Uncertain?

A concentration observation reflects both pharmacokinetics and the dose history that produced it. If a dose was recorded as scheduled but may not have been taken, treating that record as certain can distort the inferred individual PK parameters. Conversely, a concentration that seems inconsistent with the scheduled regimen does not by itself prove that a dose was missed: measurement error and parameter uncertainty also affect the prediction.

A Bayesian model can represent each uncertain dose event explicitly. The event is a latent variable: it is not observed directly, but its possible values contribute to the likelihood through the concentration model. The posterior then assigns probability to alternative adherence histories while updating the individual PK parameters. The key is to preserve both sources of uncertainty instead of selecting a dose history first and acting as if it were known.

Definition: For dose event \(j\), let \(A_j=1\) mean that the dose was taken and \(A_j=0\) mean that it was not taken. The vector \(\mathbf{A}=(A_1,\ldots,A_J)\) is the latent adherence history. Individual PK parameters are denoted by \(\theta\), concentration observations by \(y_i\), and their observation times by \(t_i\).

A Joint Model for Concentrations and Dose Events

The concentration model must specify how each possible dose history and each value of \(\theta\) generate expected concentrations. For example, under linear superposition, a model with known dose times \(t_j\), known dose amounts \(D_j\), and a known absorption or input profile can be written as:

$$ C(t_i;\theta,\mathbf{A})=\sum_{j=1}^{J} A_j\,g(t_i,t_j,D_j;\theta), $$

Here \(g\) is the contribution of dose \(j\) to concentration at time \(t_i\). This representation assumes that a dose contributes according to the specified PK model if taken and contributes zero if not taken. The formula is an example, not a requirement: a different structural PK model can be used if it correctly represents the dose input and concentration process.

For a basic residual model, suppose the observed concentrations are conditionally independent normal observations given the dose history and PK parameters:

$$ y_i\mid\theta,\mathbf{A}\sim N\!\left(C(t_i;\theta,\mathbf{A}),\sigma^2\right). $$

This assumption says that, after accounting for the model prediction, residuals have mean zero, variance \(\sigma^2\), and no remaining dependence across observations. A suitable residual error model may differ in a particular application, but the likelihood must be specified before calculating the posterior. The prior for \(\theta\) can be informed by population parameters and patient covariates, while the adherence prior specifies plausible dose-taking patterns.

Joint posterior: Given concentration data \(\mathbf{y}\), an individual PK prior \(p(\theta)\), and an adherence prior \(p(\mathbf{A})\), the joint posterior is proportional to the likelihood times both priors:
$$ p(\theta,\mathbf{A}\mid\mathbf{y}) \propto p(\mathbf{y}\mid\theta,\mathbf{A})\,p(\theta)\,p(\mathbf{A}). $$
The likelihood is conditional on both the PK parameters and the dose history. The adherence prior need not make dose events independent; for example, it may give different probabilities to a dose depending on whether the previous dose was taken.

When the PK parameters are uncertain, the posterior probability of a dose event is obtained by integrating over those parameters and summing over the other possible dose events. For a binary event \(A_j\), the posterior odds compare the total posterior weight of all histories with \(A_j=1\) against the total weight of all histories with \(A_j=0\). Thus, a single best-fitting PK parameter value or dose history is not enough to represent the full inference.

Why Marginalization Matters

The basic calculation follows directly from the definition of conditional probability. For a single uncertain event \(A\) and parameters \(\theta\), the unnormalized posterior weight for \(A=a\) is the prior probability of \(A=a\), multiplied by the likelihood averaged over the prior distribution of \(\theta\):

$$ p(A=a\mid\mathbf{y}) \propto p(A=a)\int p(\mathbf{y}\mid\theta,A=a)\,p(\theta\mid A=a)\,d\theta. $$

If the prior for \(\theta\) and \(A\) is independent, \(p(\theta\mid A=a)=p(\theta)\). Normalizing the two weights for \(a=0\) and \(a=1\) makes them sum to one. With several events, the same logic applies to each complete pattern \(\mathbf{A}\), followed by summation over patterns of interest. This is the reason a latent-variable model can represent uncertainty that a plug-in approach misses: evidence for a dose history is averaged across plausible PK parameter values, not evaluated only at one chosen value.

In a small problem, all \(2^J\) dose histories can be enumerated. With many uncertain events, direct enumeration may be impractical; computational approaches can instead sample from the joint posterior or use other suitable numerical methods. Regardless of the computational approach, the target remains the same joint distribution. Computation cannot correct a misspecified concentration model or an unrealistic adherence prior.

Worked Example: Updating the Probability of One Missed Dose

Suppose one dose may have been missed. A hypothetical concentration observation has a Gaussian residual standard deviation of \(1.5\) mg/L under either candidate history. Let the squared residual under the missed-dose model exceed the squared residual under the taken-dose model by \(33.64\) \((\mathrm{mg/L})^2\). Before observing the concentration, assign probability \(0.40\) to a missed dose and \(0.60\) to a taken dose. Find the posterior probability that the dose was missed.

For Gaussian errors with the same variance, the ratio of the missed-dose likelihood to the taken-dose likelihood is the exponential of minus the difference in squared residuals divided by twice the variance. Here \(2\sigma^2=2(1.5^2)=4.5\;(\mathrm{mg/L})^2\), so:

$$ \frac{L_{\mathrm{missed}}}{L_{\mathrm{taken}}} = \exp\!\left(-\frac{33.64}{4.5}\right) = \exp(-7.47556) \approx 0.0005668. $$

Set the taken-dose likelihood to one as a relative reference. The unnormalized posterior weights are then:

$$ w_{\mathrm{missed}}=0.40(0.0005668)=0.0002267, \qquad w_{\mathrm{taken}}=0.60(1)=0.6000. $$

Normalize the weights:

$$ P(A=0\mid\mathbf{y}) = \frac{0.0002267}{0.0002267+0.6000} \approx 0.0003777. $$

Under this model and these hypothetical data, the posterior probability of a missed dose is about \(0.0378\%\); the posterior probability of a taken dose is about \(99.9622\%\). This result reflects both the prior probability and the relative likelihood. It is not a general conclusion that a low concentration makes a missed dose unlikely.

Joint Uncertainty Can Change the Adherence Inference

The preceding calculation treats the relative likelihood as already averaged over PK uncertainty, or as evaluated with PK parameters fixed. In an individual model, the PK parameters may themselves be uncertain. The next example shows why the posterior probability of a missed dose can depend strongly on which parameter values are plausible.

Worked Example: Averaging Over Two PK Parameter Values

Consider one uncertain dose and two possible values of an individual PK parameter, denoted \(\theta_1\) and \(\theta_2\). Assign prior probability \(0.50\) to each parameter value, and prior probabilities \(0.70\) and \(0.30\) to a taken and missed dose, respectively. For hypothetical concentration data, suppose the likelihoods relative to a common reference are:

PK valueDose taken: relative likelihoodDose missed: relative likelihood
\(\theta_1\)1.000.20
\(\theta_2\)0.250.80

Multiply each likelihood by its parameter prior and adherence prior to obtain four joint weights:

$$ \begin{aligned} w(\theta_1,A=1)&=0.50(0.70)(1.00)=0.3500,\\ w(\theta_1,A=0)&=0.50(0.30)(0.20)=0.0300,\\ w(\theta_2,A=1)&=0.50(0.70)(0.25)=0.08750,\\ w(\theta_2,A=0)&=0.50(0.30)(0.80)=0.1200. \end{aligned} $$

The total weight is \(0.3500+0.0300+0.08750+0.1200=0.5875\). Summing the missed-dose weights over both parameter values gives:

$$ P(A=0\mid\mathbf{y}) = \frac{0.0300+0.1200}{0.5875} \approx 0.2553. $$

The posterior probability of a missed dose is therefore about \(25.53\%\), not \(30\%\). The posterior also reveals dependence between adherence and the PK parameter: \(P(A=0\mid\theta_1,\mathbf{y})=0.0300/(0.3500+0.0300)\approx0.07895\), whereas \(P(A=0\mid\theta_2,\mathbf{y})=0.1200/(0.08750+0.1200)\approx0.5783\). Reporting only one parameter estimate would conceal this variation in the adherence inference.

Modeling More Than One Uncertain Event

If dose events may be related, the adherence prior should describe that dependence rather than assuming independent Bernoulli events by default. For example, a Markov prior specifies the probability of the next dose event conditional on the previous event. It can represent patterns such as a greater chance of taking a dose after taking the preceding dose. Such a prior is still an assumption, not evidence from the concentrations; the likelihood updates it.

Worked Example: Posterior Probabilities for Two Dose Events

Suppose two doses have uncertain adherence. In a hypothetical model, \(P(A_1=1)=0.80\), \(P(A_2=1\mid A_1=1)=0.90\), and \(P(A_2=1\mid A_1=0)=0.60\). The resulting pattern probabilities are \(P(11)=0.72\), \(P(10)=0.08\), \(P(01)=0.12\), and \(P(00)=0.08\), where the first digit refers to \(A_1\). Assume the concentration likelihoods for the four patterns, relative to the largest likelihood, are respectively \(0.50,\;0.10,\;0.20,\;0.40\). These relative likelihoods are hypothetical evaluations of the specified concentration model at the observed concentrations.

Multiply the prior probability by the relative likelihood for each pattern. The resulting weights are \(0.72(0.50)=0.3600\), \(0.08(0.10)=0.008000\), \(0.12(0.20)=0.02400\), and \(0.08(0.40)=0.03200\). Their sum is \(0.4240\), so the normalized posterior probabilities are:

$$ \begin{aligned} P(11\mid\mathbf{y})&=0.3600/0.4240=0.8491,\\ P(10\mid\mathbf{y})&=0.008000/0.4240=0.01887,\\ P(01\mid\mathbf{y})&=0.02400/0.4240=0.05660,\\ P(00\mid\mathbf{y})&=0.03200/0.4240=0.07547. \end{aligned} $$

The posterior probability that the second dose was missed is the sum of the probabilities of patterns \(10\) and \(00\): \(0.01887+0.07547=0.09434\). The posterior probability that at least one dose was missed is \(1-P(11\mid\mathbf{y})=0.1509\). These are different questions and have different answers.

Diagnostics, Alternatives, and Limitations

A latent-adherence analysis is most useful when the concentration likelihood and adherence prior are both credible. Check whether the model can reproduce the observed concentrations across plausible dose histories and PK values. If residuals remain systematically high or low, a particular pattern dominates only because the model has no other way to accommodate the data, or small changes to the adherence prior cause large posterior changes, the inference may be fragile. Review the dose record, sampling times, residual error assumptions, and prior sensitivity rather than interpreting a posterior probability as a direct measurement of adherence.

The main alternatives make different trade-offs:

ApproachWhat it doesMain limitation
Fix the recorded dose historyUses each recorded event as certainly taken or not taken.Unrecorded or uncertain events cannot be reflected in parameter uncertainty.
Impute one dose historySelects a history first, often using an external rule or an initial analysis.Downstream inference can appear more certain than warranted because other histories are discarded.
Latent adherence modelUpdates probabilities over dose histories jointly with individual PK parameters.Requires a specified adherence prior and can be computationally difficult when many events are uncertain.

The latent approach does not guarantee that adherence can be identified from concentration data. A missed dose and a different PK parameter value can sometimes produce similar predictions. In that situation, posterior dependence between \(A_j\) and \(\theta\), as in the second example, is an important finding rather than a nuisance to suppress. More informative sampling, reliable dose records, or defensible external information may be needed to distinguish explanations.

Other limitations include misspecified dose times, incorrect assumptions about which doses were uncertain, and residual errors that are not represented adequately. A posterior probability such as \(P(A_j=0\mid\mathbf{y})\) is conditional on the model, priors, and observations; it is not an error-free determination of what happened. The model also needs enough information to distinguish alternative patterns. When the number of uncertain events is large, approximate computation should be checked for adequate exploration of both discrete patterns and continuous parameter values.

Common pitfall: “The best-fitting pattern has a missed dose, so the dose was missed.” A best-fitting pattern ignores the prior and the weight of all alternative patterns and parameter values. Instead, compare normalized posterior probabilities after integrating or summing over uncertainty; if the posterior remains diffuse or sensitive to assumptions, report that uncertainty.

Check Your Understanding

Answer each question using the distinction between a likelihood, a prior, and a posterior. Solutions follow the questions.

  1. A dose has prior probability \(0.25\) of being missed. The likelihood ratio for missed versus taken is \(0.20\). What is the posterior probability of a missed dose?
  2. Why can fixing \(\theta\) at one estimate produce a different adherence probability than integrating over its posterior?
  3. For two dose events, the posterior probabilities of patterns \(11,10,01,00\) are \(0.70,0.10,0.15,0.05\). What is the posterior probability that the second dose was missed? What is the probability that at least one was missed?
  4. Name two checks that could reveal a fragile latent-adherence analysis.

Solutions. (1) The prior weights are \(0.25\) for missed and \(0.75\) for taken. After applying the likelihood ratio, the weights are \(0.25(0.20)=0.0500\) and \(0.75(1)=0.7500\). Thus \(P(\mathrm{missed}\mid\mathbf{y})=0.0500/(0.0500+0.7500)=0.06250\). (2) Different values of \(\theta\) can make the same concentration data more or less compatible with a missed dose. Integration averages that evidence over parameter uncertainty; a fixed value uses only one part of it. (3) The second dose was missed in patterns \(10\) and \(00\), so its posterior probability is \(0.10+0.05=0.15\). At least one dose was missed in patterns \(10,01,00\), giving \(0.10+0.15+0.05=0.30\). (4) Examples include checking residuals and model fit across plausible patterns, assessing sensitivity to the adherence prior, and checking whether posterior adherence probabilities change substantially across plausible PK parameter values.

Clinical Biostats