Tutorials › Pharmacometric Workflows and Reproducible Modeling › Scaling Parameters Before Optimization

Initial Estimates and Estimation Settings · Tutorial 87 of 399

Scaling Parameters Before Optimization

See how to choose parameter scales that make optimization steps interpretable and numerically balanced without changing the target optimum.

Advanced 12 min read

What You'll Learn

  • Define scaled, dimensionless coordinates for parameters with different units and magnitudes.
  • Derive how gradients and Hessians change under a diagonal scaling transformation.
  • Distinguish the effect of scaling on gradient-based steps from its effect on an exact Newton step.
  • Work through clearance, volume, and variance examples with explicit units and arithmetic.
  • Diagnose poor scaling and compare direct scaling with log transformations and optimizer-internal scaling.
  • Recognize when constraints or boundary optima require extra care.

Why Parameter Scale Matters

A likelihood-based model can have parameters with very different numerical magnitudes. For example, a hypothetical population PK model might estimate clearance near 5 L/h, volume near 50 L, and a random-effect variance near 0.1. An optimizer works with numerical coordinates and step rules, so a single-sized step in the raw parameters does not represent a comparable change in each quantity. The result can be slow progress in one direction and an excessively large, destabilizing step in another.

Parameter scaling changes the coordinates in which the optimizer searches. It does not, by itself, change the likelihood target or the parameter values that maximize it. Scaling is not a substitute for a suitable model, objective, or starting point; it is a way to make numerical movement through the parameter space more balanced.

Definition: Let \(\theta=(\theta_1,\ldots,\theta_p)^T\) be the model's original parameter vector, and let \(s_j>0\) be a chosen scale for parameter \(\theta_j\). Define the scaled coordinate \(z_j=\theta_j/s_j\), or in vector form \(\theta=Sz\), where \(S=\operatorname{diag}(s_1,\ldots,s_p)\). The \(z_j\) are dimensionless when \(s_j\) has the same units as \(\theta_j\).

The scales are reference magnitudes, not new parameter estimates and not weights applied to the likelihood. A scale near a plausible parameter magnitude often makes typical scaled coordinates order one, but that choice alone does not guarantee that the objective has similar curvature in every direction. Units, feasible ranges, and the objective's local curvature all matter.

What Scaling Does to the Objective

Write \(L(\theta)\) for the likelihood target, or more generally \(Q(\theta)\) for the objective being minimized, such as a negative log-likelihood. In scaled coordinates the same objective is \(Q_S(z)=Q(Sz)\). If all scales are positive, the mapping between \(\theta\) and \(z\) is one-to-one. Every feasible \(\theta\) then corresponds to exactly one \(z\), so the objective value at corresponding points is identical.

Key result: Under the one-to-one transformation \(\theta=Sz\), minimizing \(Q(\theta)\) over a feasible set is equivalent to minimizing \(Q(Sz)\) over the transformed feasible set. An optimum is unchanged as a physical parameter vector; its coordinates are merely reported as \(z=S^{-1}\theta\) during optimization.

The derivative changes because a step in \(z\) produces a rescaled step in \(\theta\). For a differentiable objective, the chain rule gives the scaled gradient and Hessian:

$$ \nabla_z Q_S(z)=S^T\nabla_\theta Q(\theta), \qquad \nabla_z^2 Q_S(z)=S^T\left(\nabla_\theta^2 Q(\theta)\right)S, \qquad \theta=Sz. $$

Here the gradient is the vector of first derivatives and the Hessian is the matrix of second derivatives. In a diagonal scaling, the \(j\)th gradient component is multiplied by \(s_j\), while Hessian entry \((j,k)\) is multiplied by \(s_js_k\). Consequently, an optimizer that chooses steps from gradient or curvature information can behave differently in scaled coordinates, even though the objective values and optimum correspond exactly.

Worked Example: A Gradient Step Across Three Parameter Scales

Worked Example: A Gradient Step Across Three Parameter Scales

Consider a fully hypothetical local objective for clearance \(CL\) in L/h, volume \(V\) in L, and a dimensionless random-effect variance \(\omega^2\):

$$ Q(CL,V,\omega^2) =\frac{1}{2}\left(\frac{CL-5}{5}\right)^2 +\frac{1}{2}\left(\frac{V-50}{50}\right)^2 +\frac{1}{2}\left(\frac{\omega^2-0.09}{0.1}\right)^2. $$

This simple smooth objective has its minimum at \((5\text{ L/h},50\text{ L},0.09)\). Suppose the current point is \((4\text{ L/h},40\text{ L},0.05)\). The raw-coordinate gradient is

$$ \nabla_\theta Q =\left(\frac{4-5}{5^2},\frac{40-50}{50^2}, \frac{0.05-0.09}{0.1^2}\right) =(-0.0400,-0.00400,-4.00). $$

With an illustrative gradient-descent step size \(\eta=0.1\), the update \(\theta_{\mathrm{new}}=\theta-\eta\nabla_\theta Q\) gives

$$ (4,40,0.05)-0.1(-0.0400,-0.00400,-4.00) =(4.004,40.0004,0.45). $$

The variance has jumped from 0.05 to 0.45, while clearance and volume barely move. This is not evidence that the optimum changed; it is a consequence of applying one step size to raw coordinates whose derivatives have very different magnitudes.

Now use scales \(s=(5\text{ L/h},50\text{ L},0.1)\), so \(z=(CL/5,V/50,\omega^2/0.1)\). The current point is \(z=(0.8,0.8,0.5)\), and the target is \((1,1,0.9)\). In these coordinates the objective is

$$ Q_S(z)=\frac{1}{2}(z_1-1)^2+ \frac{1}{2}(z_2-1)^2+ \frac{1}{2}(z_3-0.9)^2. $$

Its gradient at the current point is \((-0.2,-0.2,-0.4)\). Applying the same \(\eta=0.1\) gives \(z_{\mathrm{new}}=(0.82,0.82,0.54)\), which maps back to \((4.10\text{ L/h},41.0\text{ L},0.0540)\). Each parameter has moved by a modest fraction of its chosen scale. The transformed point has the same objective value as its corresponding raw-coordinate point; the change is in how a fixed numerical step acts.

Why an Exact Newton Step Is Different

Scaling does not improve every algorithm in the same way. An exact, unconstrained Newton step for a smooth objective solves \(H_\theta\Delta\theta=-g_\theta\), where \(g_\theta=\nabla_\theta Q\) and \(H_\theta=\nabla_\theta^2Q\). In scaled coordinates it solves the corresponding equation using the transformed gradient and Hessian. The two full steps map to the same parameter change, provided the Hessian is nonsingular and both calculations use the exact derivatives.

Justification: Since \(g_z=S^Tg_\theta\) and \(H_z=S^TH_\theta S\), the scaled Newton step satisfies \(\Delta z=-(S^TH_\theta S)^{-1}S^Tg_\theta=-S^{-1}H_\theta^{-1}g_\theta\). Multiplying by \(S\) gives \(\Delta\theta=S\Delta z=-H_\theta^{-1}g_\theta\), exactly the raw-coordinate Newton step.

This equality concerns an ideal full Newton step, not every practical algorithm. Gradient descent, coordinate-wise methods, finite-difference derivatives, approximate Hessians, trust-region rules, line searches, and stopping criteria can all respond to scaling. Constraints can also change the geometry of permitted steps. Thus scaling may materially affect convergence in practice even though it cannot move the corresponding unconstrained optimum.

Worked Example: Matching Newton Steps in Raw and Scaled Coordinates

Use the objective and current point from the preceding example. Its Hessian in raw coordinates is diagonal:

$$ H_\theta= \begin{pmatrix} 1/25&0&0\\ 0&1/2500&0\\ 0&0&100 \end{pmatrix} = \begin{pmatrix} 0.0400&0&0\\ 0&0.000400&0\\ 0&0&100 \end{pmatrix}. $$

With \(g_\theta=(-0.0400,-0.00400,-4.00)^T\), solving \(H_\theta\Delta\theta=-g_\theta\) gives \(\Delta\theta=(1,10,0.0400)^T\). The updated parameters are therefore \((5\text{ L/h},50\text{ L},0.0900)\), the minimum of this quadratic objective.

In scaled coordinates the Hessian is the identity matrix, because each term has unit curvature in \(z\). The gradient is \((-0.200,-0.200,-0.400)^T\), so the Newton update is \(\Delta z=(0.200,0.200,0.400)^T\). Mapping that update back gives \(S\Delta z=(1\text{ L/h},10\text{ L},0.0400)\), the same physical step. This example illustrates both the invariance of an exact Newton step and the changed scale of the derivatives.

Choosing Scales and Respecting Constraints

A practical scale should make a meaningful change in a parameter correspond to a manageable change in its scaled coordinate. Candidate scales may come from units, plausible parameter magnitudes, a feasible range, or a rough estimate of how much movement is needed near the starting point. For the illustrative values above, scales of 5 L/h, 50 L, and 0.1 put the parameters on a comparable numerical scale. They are examples, not universal recommendations for PK models.

Scaling by a positive constant preserves the sign of a parameter but does not remove constraints. If \(CL>0\), then \(z_{CL}>0\) under a positive scale. A variance constrained to be nonnegative likewise remains nonnegative. An optimizer must still enforce the appropriate feasible region; an unconstrained additive update can cross a boundary even when the coordinates have been rescaled.

A log transformation is a different coordinate choice that can encode strict positivity. For a positive parameter \(\theta\), setting \(u=\log(\theta/s)\) gives \(\theta=s\exp(u)\). This makes additive steps in \(u\) multiplicative in \(\theta\), rather than additive as they are under \(z=\theta/s\). For example, with variance scale \(s=0.1\) and current \(\omega^2=0.04\), \(u=\log(0.4)\approx-0.9163\). Increasing \(u\) by 0.1 gives \(\omega^2_{\mathrm{new}}=0.1\exp(-0.8163)\approx0.0442\). The positive value is maintained, but the step behavior differs from ordinary scaling. The transformation must be reflected consistently when evaluating derivatives and interpreting reported parameter values.

Worked Example: Checking a Scale and a Feasible Step

Suppose a hypothetical starting vector is \(CL=4.8\text{ L/h}\), \(V=42\text{ L}\), and \(\omega^2=0.040\). Choose \(s=(5\text{ L/h},50\text{ L},0.1)\). The scaled coordinates are

$$ z=\left(\frac{4.8}{5},\frac{42}{50},\frac{0.040}{0.1}\right) =(0.960,0.840,0.400). $$

Each coordinate is dimensionless and less than one; a one-unit change in them corresponds respectively to 5 L/h, 50 L, and 0.1 variance units. If a proposed optimizer step is \(\Delta z=(-0.10,0.05,-0.50)\), the new coordinates are \((0.860,0.890,-0.100)\). Mapping back gives \(CL=4.30\text{ L/h}\), \(V=44.5\text{ L}\), and \(\omega^2=-0.010\). The last value is infeasible for a variance. Scaling made the step's effects easy to compare, but did not make the step acceptable; a constraint or a positivity-preserving parameterization is still required.

Diagnostics, Alternatives, and Limitations

Scaling is worth reviewing when optimization repeatedly takes tiny steps in one parameter but oversized steps in another, when numerical derivatives are unstable, or when convergence depends strongly on the units used to express a parameter. Inspect the scaled coordinate values and the corresponding physical changes, not just the optimizer's convergence message. Also examine whether gradients are small at the reported solution, whether constraints are active, and whether the result is stable to reasonable changes in scale or starting point. A poorly conditioned Hessian may indicate strong parameter dependence or weakly identified directions; rescaling alone does not resolve that underlying problem.

Common approaches have different trade-offs:

ApproachWhat changesPractical consideration
Optimize in raw unitsNo parameter coordinate transformationSimple, but numerical step rules can be poorly matched to parameters with different magnitudes.
Explicit linear scalingUses \(z_j=\theta_j/s_j\)Preserves additive changes and maps constraints directly, but positivity still needs to be enforced.
Log coordinates for positive parametersUses multiplicative changes in the original parameterMaintains strict positivity, but changes step behavior and cannot represent a zero value at finite \(u\).
Optimizer-internal scalingThe software rescales coordinates or steps internallyCan be convenient, but the analyst should verify how scales, bounds, and reported coordinates are handled.

One common mistake is to conclude that a larger raw gradient component must mean that its parameter deserves the largest physical update. Gradient components carry the units and coordinate scales of their parameters, so their numerical sizes are not directly comparable. The correction is to inspect the transformation and the resulting changes in original units; a step that looks balanced in scaled coordinates can still be infeasible or scientifically implausible.

Another limitation is that scales chosen from starting values may be poor if those values are far from the relevant region, or if the objective's curvature changes substantially across the search. Scaling also does not fix an incorrect likelihood target, a flat direction, local optima, or a model that cannot be identified from the data. It is a numerical aid whose adequacy should be checked against the actual optimization behavior.

Key takeaway: Choose and document parameter scales so optimizer steps can be interpreted in meaningful units. A positive linear rescaling preserves the corresponding optimum, but it changes derivatives and the behavior of many practical step rules; constraints and convergence diagnostics remain necessary.

Check Your Understanding

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

  1. If \(s_{CL}=5\text{ L/h}\), what scaled coordinate corresponds to \(CL=7.5\text{ L/h}\)? What physical change does a 0.2 change in that coordinate represent?
  2. Under \(\theta=Sz\) with positive diagonal \(S\), does minimizing \(Q(\theta)\) change the optimum when expressed in scaled coordinates? State the condition that makes the equivalence hold.
  3. Why can a raw-coordinate gradient step be unsuitable when clearance, volume, and variance have very different scales?
  4. For a positive parameter, compare an additive step in \(z=\theta/s\) with an additive step in \(u=\log(\theta/s)\).
  5. A scaled optimizer reports a low objective and a convergence message, but a variance estimate is negative after mapping back. What should be checked?

Solutions. (1) \(z_{CL}=7.5/5=1.50\). A change of 0.2 in \(z_{CL}\) represents \(0.2(5)=1.0\text{ L/h}\). (2) No, provided the transformation is one-to-one and the feasible set is transformed consistently; positive scales give that one-to-one mapping. (3) Gradient components depend on parameter units and coordinate magnitudes, so one numerical step size can produce negligible movement in some parameters and excessive movement in others. (4) An additive change in \(z\) gives an additive change \(\Delta\theta=s\Delta z\); an additive change in \(u\) multiplies \(\theta\) by \(\exp(\Delta u)\) and preserves strict positivity. (5) Check how bounds and parameter transformations were implemented, verify the mapped estimate and feasible region, and do not treat the convergence message alone as evidence of a valid solution.

Clinical Biostats