Tutorials › Pharmacometric Workflows and Reproducible Modeling › Significant-Digit Loss in Parameter Values

Debugging Model Failures · Tutorial 147 of 399

Significant-Digit Loss in Parameter Values

Learn to detect when saved parameter values have lost enough precision to change predictions or destabilize an estimation restart, and how to preserve and check full-precision values.

Advanced 11 min read

What You'll Learn

  • Distinguish numerical parameter values used in computation from rounded values prepared for reporting.
  • Bound the error introduced by rounding and relate it to local model sensitivity.
  • Calculate how reduced precision changes a pharmacokinetic prediction.
  • Diagnose when rounded starting values move an optimizer substantially in a sensitive direction.
  • Compare original and round-tripped parameter files systematically.
  • Separate precision loss from unit, model, and optimization problems.

Why Saved Digits Matter

Parameter estimates are often saved, transferred between programs, or copied into a new analysis as text. A value displayed as 1.23 may represent a parameter stored internally as 1.23456789, or it may be the only value that remains. Those are not equivalent computational inputs. If the saved value becomes a new starting value, or is used to calculate a model prediction, digits discarded during export cannot be recovered by the later analysis.

The practical question is not whether a parameter has many digits on screen. It is whether the difference between the stored value and the value actually reused is consequential for the computation. That depends both on the size of the rounding error and on the model’s sensitivity to the parameter. A small absolute change can matter for a parameter near zero or along a sensitive direction; a larger change may have little effect in a locally insensitive direction.

Definition: Significant-digit loss occurs when a parameter value used in a later computation has fewer reliable digits than the value produced by the original computation. Rounding replaces a value by a nearby representable value according to a rule such as rounding to the nearest decimal place. Truncation discards digits without rounding to the nearest value and can introduce a directionally biased error.

A rounded estimate in a report is usually a communication choice, not a replacement for the computational result. For reproducible work, retain the full-precision parameter file or a suitably precise machine-readable checkpoint, and make clear which file is used for later calculations. The displayed number of digits alone does not establish the accuracy of an estimate; it only describes how the value was written.

Rounding Error and Local Sensitivity

Let \(\boldsymbol{\theta}\) denote a vector of parameter values, and let \(g(\boldsymbol{\theta})\) be a scalar model output, such as a predicted concentration at a specified time. Suppose a saved-and-reloaded vector is \(\boldsymbol{\theta}+\boldsymbol{\delta}\), where \(\boldsymbol{\delta}\) is the change caused by rounding or truncation. If \(g\) is differentiable near \(\boldsymbol{\theta}\), then

$$ g(\boldsymbol{\theta}+\boldsymbol{\delta})-g(\boldsymbol{\theta}) = \nabla g(\boldsymbol{\theta})^{\mathsf T}\boldsymbol{\delta} + o(\|\boldsymbol{\delta}\|). $$

Here \(\nabla g\) is the vector of partial derivatives, and \(\|\boldsymbol{\delta}\|\) is the size of the parameter perturbation under a chosen norm. The first-order term shows why digit count alone is not a sufficient diagnostic: the effect depends on how the perturbation aligns with the local sensitivity vector. Differentiability guarantees the remainder is smaller than first order as the perturbation shrinks, but does not by itself guarantee a quadratic remainder. If the second derivatives are bounded in a neighborhood, a second-order Taylor expansion does give a remainder of order \(O(\|\boldsymbol{\delta}\|^2)\).

For a single parameter \(\theta\), rounding to \(p\) significant decimal digits typically gives an absolute rounding error no larger than about half a unit in the last retained place. For a nonzero value away from exceptional floating-point cases, this corresponds approximately to a relative error no greater than \(0.5\times10^{1-p}\). Truncation can have an error approaching a full unit in that place and is not centered around zero. These bounds describe the input perturbation, not the resulting prediction error; sensitivity must still be considered.

Worked Example: Rounding Parameters Changes a Concentration Prediction

Consider a hypothetical one-compartment concentration expression \(C(t)=A\exp(-kt)\), with \(A=12.345\) mg/L and \(k=0.047863\) per hour. Evaluate the prediction at \(t=24\) hours, then compare it with a calculation using values rounded to three significant digits: \(A=12.3\) mg/L and \(k=0.0479\) per hour. This is a numerical illustration, not a real study.

Using the retained values: the exponent is \(-(0.047863)(24)=-1.148712\). Therefore,

$$ C(24)=12.345\exp(-1.148712) \approx 3.913919\ \text{mg/L}. $$

Using the rounded values: the exponent is \(-(0.0479)(24)=-1.1496\). Thus,

$$ C_{\mathrm{rounded}}(24)=12.3\exp(-1.1496) \approx 3.896191\ \text{mg/L}. $$

The rounded-parameter prediction changes by approximately \(3.896191-3.913919=-0.017728\) mg/L. Relative to the prediction from the retained values, the change is \((-0.017728/3.913919)\times100\%\approx-0.4530\%\). In this example, the change is modest in relative terms, but it is real and may matter if the prediction is used in a sensitive downstream calculation or compared against a tight numerical tolerance.

The example also illustrates why reporting rounded values and reusing them computationally are different practices. Printing both parameters to three significant digits makes the output readable, but using that printed representation discards information that affected the calculated concentration.

Rounded Values as Optimizer Starting Points

A saved parameter vector may be reused as an initial value for a new fit, a restart after interruption, or a related model. In nonlinear estimation, the optimizer’s path can depend on its starting point. Rounding does not necessarily change the model or the optimum, and it does not guarantee a failed fit. It can, however, move the starting point far enough in a sensitive direction that convergence is slower, follows a different path, or encounters a numerical difficulty. Whether this happens depends on the objective surface, parameterization, constraints, scaling, and optimizer.

The absolute size of a change can be misleading when parameters have very different scales. A perturbation of 0.005 may be negligible for a parameter near 100 and material for one whose important local scale is 0.001. When parameters are represented through transformations—for example, an unconstrained parameter \(\eta\) mapped to a positive parameter \(\sigma=\exp(\eta)\)—rounding \(\eta\) changes \(\sigma\) nonlinearly. Check both the stored coordinate and the implied model parameter.

Worked Example: A Rounded Transformed Starting Value

Suppose a hypothetical positive scale parameter is represented as \(\sigma=\exp(\eta)\), and a saved starting value is \(\eta=0.693147\). Compare it with the value obtained after writing \(\eta\) to only two decimal places, giving \(\eta=0.69\).

With the retained value, \(\sigma=\exp(0.693147)\approx1.9999996\), or approximately 2.000 in the parameter’s units. With the rounded value, \(\sigma_{\mathrm{rounded}}=\exp(0.69)\approx1.993716\). The change is \(1.993716-1.9999996\approx-0.006284\), a relative change of about \((-0.006284/1.9999996)\times100\%=-0.3142\%\).

This calculation does not show that the optimizer must fail: it shows that the actual positive starting value is not the same as the value implied by the higher-precision saved coordinate. If the fitting problem is sensitive to this scale, compare convergence behavior from both starts rather than assuming that a short decimal representation is interchangeable with the retained one.

Worked Example: Measuring a Starting-Point Change in a Sensitive Direction

For illustration, suppose a hypothetical dimensionless objective near a candidate solution is \(Q(a)=((a-1.234567)/0.001)^2\). The scale 0.001 represents a narrow direction in this local example. A previous fit supplies \(a=1.234567\) as a starting value, but a text file rounded to two decimal places supplies \(a=1.23\).

At the retained starting value, \(Q(1.234567)=((1.234567-1.234567)/0.001)^2=0\). At the rounded value, the difference from the center is \(-0.004567\), so

$$ Q(1.23) = \left(\frac{1.23-1.234567}{0.001}\right)^2 = (-4.567)^2 = 20.857489. $$

The rounded value is more than four local scale units from the center in this direction. This does not prove that a real optimizer will fail or that this illustrative objective is a pharmacometric likelihood. It quantifies the point that a seemingly small absolute rounding change can be large relative to a narrow scale. In an actual restart, compare the parameter differences with the optimizer’s scaling and inspect whether the rerun converges to the same solution.

A Practical Diagnostic Workflow

A useful diagnostic isolates precision loss from other causes of a changed result. First verify that the values have the same meaning, units, parameter order, and transformation in both files. A unit mismatch is not a rounding problem. Then compare the original values with the values recovered after writing and reading the file, using the recovered values—not the displayed formatting alone—to calculate differences. Finally, evaluate whether those differences matter for the specific prediction or restart.

1
Preserve a reference.
Keep the original machine-readable parameter values and record which file generated each downstream calculation.
2
Round-trip the file.
Write and reload the values using the intended export process, then compute \(\boldsymbol{\delta}\) as reloaded minus original values.
3
Assess scale and sensitivity.
Compare each change with its parameter scale and, where relevant, evaluate changes in model outputs or in the optimizer’s starting-point behavior.
4
Repeat with full precision.
If restoring the retained values removes the discrepancy, precision loss is supported as a cause. If not, investigate other sources rather than adding digits indiscriminately.

Warning signs include estimates that change when a results file is copied through a spreadsheet, a restart that behaves differently from a direct continuation, predictions that disagree despite nominally identical parameters, or parameter files whose decimal formatting changes between software steps. A useful comparison records the original and reloaded values, their absolute and relative differences, and relevant output differences with units. For parameters equal or very close to zero, relative differences can be unstable or undefined; report absolute changes and use a meaningful parameter scale instead.

Alternatives, Limitations, and Common Mistakes

The simplest alternative to reusing a rounded report is to retain a full-precision computational file and create a separate rounded presentation table. If only rounded values remain, rerunning from them may be necessary, but that is a new numerical starting point and should be documented as such. Increasing the number of digits in a display is not a substitute for checking the actual file contents, and carrying many digits does not make an estimate more statistically certain.

A common mistake is to reason, “The parameter changed by less than one percent, so it cannot explain a changed fit.” The correction is that percent change alone does not determine computational impact. A small relative change may be large compared with a narrow scale, especially in a sensitive direction; conversely, a larger change may have little effect on a particular output. Compare the perturbation with the relevant scale and check the computation directly.

Another mistake is to treat a different result after rounding as proof that rounding is the only cause. That conclusion is not justified unless other inputs and settings are held fixed. Confirm the parameter mapping, units, model version, data, and computational settings. This tutorial concerns changes to saved parameter values and their use as model inputs or starting values. Changes in likelihood evaluation due to rounding are a separate numerical question.

Key takeaway: Keep full-precision computational values separate from rounded reporting values. To diagnose significant-digit loss, compare the actual round-tripped parameters, assess their scale and local sensitivity, and test whether restoring the retained values resolves the discrepancy.

Check Your Understanding

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

  1. A parameter is saved as 0.0123456 but reloaded as 0.0123. What is the absolute change, and why is the absolute change alone insufficient to judge its impact?
  2. Why does differentiability support a first-order remainder of \(o(\|\boldsymbol{\delta}\|)\), but not automatically a remainder of \(O(\|\boldsymbol{\delta}\|^2)\)?
  3. A positive parameter is represented by \(\sigma=\exp(\eta)\). Why should a precision check consider the implied change in \(\sigma\), not only the decimal change in \(\eta\)?
  4. A rounded restart gives a different optimization path. What evidence would help distinguish precision loss from a unit or parameter-mapping error?

Solutions. (1) The absolute change is \(0.0123-0.0123456=-0.0000456\). Its importance depends on the parameter’s scale and the sensitivity of the model or optimizer; a percentage alone may not resolve that question. (2) Differentiability gives a linear approximation whose error divided by \(\|\boldsymbol{\delta}\|\) tends to zero as the perturbation tends to zero. A quadratic-order bound requires stronger regularity, such as bounded second derivatives nearby. (3) The exponential transformation is nonlinear: a change in \(\eta\) produces a multiplicative change in \(\sigma\), so the computational parameter may shift by an amount that is not apparent from the transformed coordinate’s decimal difference alone. (4) Compare original and reloaded parameter values and mappings, verify units and ordering, hold model and data inputs fixed, and repeat the restart with the retained full-precision values. If that restores the prior behavior, precision loss is supported; a changed unit or mapping must be ruled out independently.

Clinical Biostats