Tutorials › Pharmacometric Workflows and Reproducible Modeling › Using Conservation Checks on Derived Model Outputs

Quality Control and Independent Review · Tutorial 349 of 399

Using Conservation Checks on Derived Model Outputs

Use conservation identities and unit checks to find inconsistencies in simulated amounts and reported exposure summaries.

Intermediate 11 min read

What You'll Learn

  • Set up dose-accounting checks for intravenous and extravascular doses.
  • Derive a compartment mass-balance identity by cancelling internal transfers.
  • Reconcile systemic input, amounts remaining, and cumulative elimination.
  • Check AUC and time-averaged concentration summaries for consistency.
  • Use units, tolerances, and output definitions to investigate discrepancies.
  • Recognize what a successful conservation check can—and cannot—establish.

Why Conservation Checks Matter

Simulation and reporting pipelines often transform model states into summaries: amounts in compartments, cumulative elimination, AUC, or average concentration. A simple accounting identity can reveal errors in those transformations even when the output looks plausible. The key question is whether the reported quantities can all be true at once, given the dose and the definitions used.

A conservation check is an internal-consistency check, not a complete validation of a pharmacometric model. If amounts disappear or are counted twice, the check can flag a problem. If the accounting balances, however, the model may still have incorrect parameters, an implausible time course, or an incorrect implementation that conserves mass.

Definition: A conservation check compares an accounted-for input with the corresponding amounts remaining and outputs over a specified interval. A mass-balance residual is the difference between the input and the sum of the accounted-for quantities. A zero residual indicates algebraic balance; in numerical output, a small residual may be expected from rounding or numerical integration.

Compartment Mass Balance

Let \(A_j(t)\) be the amount of drug in compartment \(j\), measured in mg. Drug can enter the system, move between compartments, and leave through elimination or other explicitly modeled output pathways. Transfers between compartments are internal: an amount leaving one compartment enters another, so those transfers must cancel when the compartments are considered together.

For a system with zero initial amount, let \(D_{\mathrm{sys}}(0,T)\) be the total amount entering the systemic compartments between times 0 and \(T\), and let \(E(0,T)\) be the cumulative amount leaving through the modeled output pathways. The conservation identity is:

$$ D_{\mathrm{sys}}(0,T) = \sum_{j=1}^{m} A_j(T) + E(0,T) $$

This form assumes the compartments initially contain no drug and that every systemic input and output pathway is included. If the initial amounts are not zero, add their sum to the right-hand accounting of available drug. If there are additional pathways—such as a separately tracked metabolite or excretion route—include them according to the model’s definitions, without counting the same drug twice.

Why Internal Transfers Cancel

The identity follows from the compartment rate equations. Write \(q_{jk}(t)\) for the rate of transfer from compartment \(j\) to compartment \(k\), \(r_j(t)\) for external input to compartment \(j\), and \(e_j(t)\) for output from it. For each compartment, the rate of change is external input plus transfers in, minus transfers out and external output:

$$ \frac{dA_j}{dt} = r_j(t) + \sum_{k\ne j} q_{kj}(t) - \sum_{k\ne j} q_{jk}(t) - e_j(t) $$

Sum these equations over all compartments. For every internal transfer \(q_{jk}\), the term appears once as an outflow from \(j\) and once as an inflow to \(k\), with opposite signs. Those terms cancel. Integrating the remaining equation from 0 to \(T\) gives:

$$ \sum_{j=1}^{m} A_j(T)-\sum_{j=1}^{m} A_j(0) = \int_0^T \sum_{j=1}^{m} r_j(t)\,dt - \int_0^T \sum_{j=1}^{m} e_j(t)\,dt $$

The integrals are total external input and cumulative external output. Rearranging yields the stated balance, including initial amounts when they are present. This justification depends on the model accounting for all relevant external pathways and defining transfers consistently; it does not require a particular compartment structure.

Worked Example: Checking an Intravenous Dose Account

Suppose a hypothetical intravenous dose is 100 mg. At 8 hours, a simulation reports 18 mg in the central compartment, 22 mg in a peripheral compartment, and 60 mg cumulatively eliminated. Assume there are no other input or output pathways, and the initial amount is zero. Check the account.

The conservation identity is dose equals the sum of amounts remaining and cumulative elimination:

$$ 100\ \mathrm{mg} \stackrel{?}{=} 18\ \mathrm{mg}+22\ \mathrm{mg}+60\ \mathrm{mg} $$

The right side is \(18+22+60=100\) mg, so the account balances. The mass-balance residual, defined here as input minus accounted amount, is \(100-100=0\) mg.

Now suppose a second output file reports 65 mg eliminated while leaving the compartment amounts unchanged. The accounted total is \(18+22+65=105\) mg, and the residual is \(100-105=-5\) mg. The output claims 5 mg more than the dose supplied. That discrepancy warrants investigation; possible causes include a duplicated elimination term, an incorrect dose or unit conversion, or a mismatch in the time intervals used for the summaries.

Accounting for Extravascular Doses

For an extravascular dose, the administered amount is not necessarily the amount entering the systemic circulation. Some drug may remain unabsorbed or leave through a presystemic pathway. A useful check separates the administered-dose account from the systemic account. The first accounts for the administered dose across unabsorbed or presystemic losses and systemic input. The second accounts for systemic input across systemic amounts remaining and systemic output.

Worked Example: Separating Oral Dose and Systemic Accounts

Consider a hypothetical oral dose of 250 mg. The model reports 50 mg as unabsorbed or otherwise not entering systemic circulation. Thus, 200 mg enters systemic circulation. At 12 hours, the total amount in systemic compartments is 25 mg, and cumulative systemic elimination is 175 mg. Check both parts of the account.

First, the administered-dose account is \(250=50+200\) mg: 50 mg does not enter the systemic circulation and 200 mg does. Next, the systemic account is:

$$ 200\ \mathrm{mg} = 25\ \mathrm{mg}+175\ \mathrm{mg} $$

Both accounts balance. The systemic residual is \(200-(25+175)=0\) mg. It would be incorrect to compare systemic amounts plus systemic elimination directly with the full 250 mg without also accounting for the 50 mg that did not enter systemic circulation. Conversely, counting the 50 mg as both unabsorbed and systemically eliminated would double-count it.

Checking Exposure Summaries

Exposure summaries can be checked against their definitions and units. For concentration \(C(t)\) over an interval from 0 to \(T\), the area under the concentration-time curve is the integral of concentration over time. The time-averaged concentration over that same interval is AUC divided by the interval duration:

$$ \mathrm{AUC}_{0-T}=\int_0^T C(t)\,dt \qquad\text{and}\qquad \bar{C}_{0-T}=\frac{\mathrm{AUC}_{0-T}}{T} $$

If concentration is in mg/L and time is in hours, AUC is in mg·h/L and the time-averaged concentration is in mg/L. These summaries must refer to the same concentration profile, time interval, and averaging definition. A simple arithmetic mean of values at irregularly spaced sample times is not generally the time average of the curve. In that case, the integration and averaging method matters.

Worked Example: Reconciling AUC and Average Concentration

A hypothetical report gives \(\mathrm{AUC}_{0-6}=18\) mg·h/L and an average concentration of 2 mg/L over the same 6-hour interval. Are the summaries consistent if the average is defined as AUC divided by interval duration?

Calculate the average implied by the AUC:

$$ \bar{C}_{0-6} = \frac{18\ \mathrm{mg\cdot h/L}}{6\ \mathrm{h}} = 3\ \mathrm{mg/L} $$

No. The AUC implies an average concentration of 3 mg/L, not 2 mg/L. Equivalently, an average of 2 mg/L over 6 hours would imply an AUC of \(2\ \mathrm{mg/L}\times 6\ \mathrm{h}=12\) mg·h/L. The reported summaries differ by 6 mg·h/L in AUC-equivalent terms, so check whether the interval, averaging definition, or reported value is inconsistent.

A related exposure identity can provide an independent aggregate check under specific assumptions. For linear, time-invariant pharmacokinetics with complete exposure to infinity, systemic AUC equals the systemically available dose divided by clearance. For an intravenous dose, the available dose is the administered dose. For an extravascular dose, it is \(F\) times the administered dose when \(F\) is the fraction reaching systemic circulation. This check is not generally valid without those assumptions—for example, nonlinear clearance or an AUC truncated at a finite time changes the comparison.

Worked Example: Comparing AUC With Dose and Clearance

Suppose a hypothetical linear intravenous model has a 120 mg dose and clearance of 4 L/h. Assume the reported AUC is intended to be the complete AUC from time zero to infinity. Calculate the expected AUC and assess a report of 24 mg·h/L.

Under the stated assumptions, \(\mathrm{AUC}_{0-\infty}=\mathrm{Dose}/CL\). Substituting the values gives:

$$ \mathrm{AUC}_{0-\infty} = \frac{120\ \mathrm{mg}}{4\ \mathrm{L/h}} = 30\ \mathrm{mg\cdot h/L} $$

The reported value of 24 mg·h/L is 6 mg·h/L below the expected value, so it is not consistent with the stated dose, clearance, and assumptions. Before treating this as an implementation error, confirm that the reported AUC is not truncated, that clearance and dose use compatible units, and that the model is in the linear regime for which this identity applies.

Diagnostics, Tolerances, and Failure Modes

In computed outputs, an exact zero residual is not always expected. Numerical integration, rounding, or exporting values at limited precision can produce a small difference. Report the residual in the same units as the accounted quantities, and judge it against the precision and numerical method used. A relative residual can help when the scale varies, but it is not meaningful when the reference total is zero or very close to zero. There is no universal tolerance suitable for every model and calculation.

  • Check units first. Amounts should be compared with amounts, not concentrations. Converting concentration to amount requires the relevant volume and a consistent definition of that volume.
  • Align time intervals. A cumulative output through 8 hours cannot balance an amount reported at 6 hours unless the accounting is adjusted to a common time.
  • Inspect definitions and pathways. Determine whether an output represents systemic elimination, total clearance, unabsorbed dose, or another quantity. Similar labels can refer to different accounts.
  • Look for double counting or omissions. A transfer between compartments is not an external loss. Adding it to total elimination, or omitting an output pathway, can make the total wrong.
  • Separate rounding from structural discrepancies. A small residual may reflect rounded display values; a substantial residual should be investigated in the unrounded outputs and calculation pipeline.

A passed balance check has important limitations. Two implementation errors can offset each other; a model can conserve total amount while placing drug in the wrong compartment; and internally consistent outputs can still be biologically implausible. Conservation checks complement, rather than replace, review of model intent, output definitions, units, and time-course behavior.

Choosing a Complementary Check

Conservation identities are especially useful for screening broad accounting errors. Other review approaches answer different questions. Recomputing a summary independently can check whether the reported value follows from its inputs. Comparing selected outputs with a separate reference implementation can test agreement across implementations. Reviewing plots and diagnostics can reveal timing or shape problems that a total-balance check misses. These approaches are complementary: a balanced total does not establish that the simulation is correct, and a matching summary does not establish that all compartments were accounted for properly.

Key takeaway: Define the input, remaining amounts, outputs, time interval, and units before calculating a conservation residual. A balance is evidence of internal accounting consistency under those definitions—not proof that the model or its predictions are correct.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. A 75 mg intravenous dose is reported as 10 mg remaining in one compartment, 15 mg in another, and 50 mg eliminated. Does the account balance?
  2. A 300 mg extravascular dose has 60 mg reported as not entering systemic circulation. What systemic input does the dose account imply?
  3. For a 4-hour interval, an AUC of 20 mg·h/L is reported with an AUC-based average concentration of 4 mg/L. Are the summaries consistent?
  4. Under linear, time-invariant pharmacokinetics, a hypothetical intravenous dose is 90 mg and clearance is 3 L/h. What complete AUC is implied?

Solutions. (1) Yes: \(10+15+50=75\) mg, so the residual is \(75-75=0\) mg. (2) The implied systemic input is \(300-60=240\) mg. This is a dose-account result, assuming the reported 60 mg is the only amount excluded from systemic input. (3) No. The AUC-based average is \(20/4=5\) mg/L, not 4 mg/L. (4) The complete AUC is \(90/3=30\) mg·h/L, using dose divided by clearance and the stated assumptions.

Clinical Biostats