Tutorials › Nonlinear Mixed-Effects Models (NLME) › Scaling Parameters for Stable SAEM Simulation

The EM and SAEM Algorithms · Tutorial 219 of 797

Scaling Parameters for Stable SAEM Simulation

Learn to choose and apply parameter scales that improve SAEM computations without altering the model’s implied predictions or target distribution.

Advanced 12 min read

What You'll Learn

  • Distinguish a change of coordinates from a change to the statistical model.
  • Transform random effects and their covariance consistently using a fixed scale matrix.
  • Scale population parameters for more stable numerical M-steps.
  • Account for transformed densities and proposal distributions in conditional simulation.
  • Recognize when whitening, scaling, or a log transformation is unsuitable.

Why Scaling Matters in SAEM

In SAEM, the latent random effects are simulated conditionally on the observations, and population parameters are updated using the resulting information. Computation can become awkward when random effects have very different magnitudes or strong correlations, or when population parameters are measured on very different numerical scales. A proposal that moves effectively along one coordinate may barely move along another; an optimizer may likewise struggle when its numerical steps are unsuitable for the units of the parameters.

Scaling is a change of coordinates, not a license to change the model. If the transformation is invertible and the probability distribution and likelihood are transformed consistently, each point in the original model has a corresponding point in the scaled model. The predictions associated with corresponding points are identical. This tutorial focuses on fixed transformations that improve numerical behavior while retaining that equivalence.

Definition: A scaling transformation replaces a parameter or latent variable with an invertible function of it, chosen to make its computational scale more convenient. For an affine transformation of a vector, write \(\eta_i=S z_i\), where \(S\) is a fixed nonsingular matrix. The original random effect is \(\eta_i\); \(z_i=S^{-1}\eta_i\) is the same random effect expressed in new coordinates.

Write a general NLME model as \(y_i\mid\eta_i,\theta\sim p(y_i\mid\eta_i,\theta)\), with \(\eta_i\sim N(0,\Omega)\). Here \(y_i\) denotes subject \(i\)'s observations, \(\theta\) the population parameters, and \(\Omega\) the random-effect covariance matrix. For the transformation to preserve the model, the conditional data distribution must use \(\eta_i=S z_i\), and the distribution of \(z_i\) must be the transformed distribution implied by \(\eta_i\). Merely rescaling the values passed to the simulator while leaving the target distribution unchanged is not a valid reparameterization.

Transforming Random Effects Correctly

For fixed nonsingular \(S\), the transformed random effect has mean zero and covariance \(S^{-1}\Omega S^{-\mathsf T}\), where \(S^{-\mathsf T}=(S^{-1})^\mathsf T\). In density form, the change of variables also contributes the determinant of \(S\). These facts ensure that the transformed density represents the same probability distribution as the original one.

$$ z_i=S^{-1}\eta_i,\qquad z_i\sim N\!\left(0,S^{-1}\Omega S^{-\mathsf T}\right),\qquad p_z(z_i)=p_\eta(Sz_i)\lvert\det S\rvert. $$

If \(S\) is a Cholesky factor of a known covariance matrix, it can whiten the prior random effects: for \(\Omega=LL^\mathsf T\), choose \(S=L\), giving \(z_i\sim N(0,I)\). This can make a proposal scale that is sensible in standardized coordinates correspond to a correlated, scale-adapted move in the original coordinates.

There is an important qualification when \(\Omega\) is being estimated. A fixed reference matrix \(S\), perhaps chosen from initial values or a preliminary estimate, keeps the latent coordinates fixed during SAEM. Then the transformed covariance \(S^{-1}\Omega S^{-\mathsf T}\) must be updated as \(\Omega\) changes. By contrast, choosing \(S=L(\Omega)\) anew at each iteration makes the coordinates depend on the current parameter. That approach can be used only with a coherent treatment of the changing latent variables and transformed likelihood; it is not valid to keep treating all draws as if they were in one fixed coordinate system. A fixed scale is often the simpler and safer computational choice.

Worked Example: Exact Whitening With a Cholesky Factor

Suppose a hypothetical two-dimensional random effect has covariance \[ \Omega= \begin{pmatrix} 0.04&0.012\\ 0.012&0.082 \end{pmatrix}. \] The entries have the appropriate squared units or cross-product units for the two random effects. Choose \[ L= \begin{pmatrix} 0.20&0\\ 0.06&0.28 \end{pmatrix}. \] Check the factorization rather than relying on rounded entries: \[ LL^\mathsf T= \begin{pmatrix} 0.20^2&0.20(0.06)\\ 0.20(0.06)&0.06^2+0.28^2 \end{pmatrix} = \begin{pmatrix} 0.04&0.012\\ 0.012&0.082 \end{pmatrix} =\Omega. \] Thus \(L\) is an exact Cholesky factor for the stated covariance.

For this example, define \(z_i=L^{-1}\eta_i\). Because \(L^{-1}\Omega L^{-\mathsf T}=I\), \(z_i\sim N(0,I)\). To see the arithmetic for a hypothetical draw \(\eta_i=(0.10,0.14)^\mathsf T\), solve \(Lz_i=\eta_i\): \[ z_{i1}=0.10/0.20=0.50,\qquad z_{i2}=(0.14-0.06(0.50))/0.28=0.3929. \] The draw is represented in standardized coordinates as approximately \((0.50,0.3929)^\mathsf T\). This exact identity depends on the exact factor; substituting a rounded factor that does not satisfy \(LL^\mathsf T=\Omega\) would make the whitening only approximate.

Scaling Conditional Proposals

Conditional simulation targets the random effects given the observations and current population parameters. A proposal can be constructed in transformed coordinates, but its density and the target density must refer to those same coordinates. For a fixed linear transformation, the Jacobian determinant is constant in \(z_i\) and cancels in a Metropolis-Hastings ratio when comparing two points under the same transformation. The transformed prior and the conditional data likelihood still both contribute to the target.

$$ \alpha(z,z')= \min\left\{1,\, \frac{p(y_i\mid Sz',\theta)\,p_z(z')\,q(z\mid z')} {p(y_i\mid Sz,\theta)\,p_z(z)\,q(z'\mid z)} \right\}. $$

A symmetric random-walk proposal in \(z\), such as \(z'=z+\epsilon\) with \(\epsilon\sim N(0,h^2I)\), has a simple proposal ratio. In original coordinates, the corresponding increment is \(S\epsilon\), with covariance \(h^2SS^\mathsf T\). Thus, when \(S\) reflects the scales and correlations of the prior random effects, an isotropic step in \(z\) becomes a scale- and correlation-adapted step in \(\eta\). This does not guarantee good conditional mixing: the likelihood may produce posterior curvature quite different from the prior covariance. The earlier material on Metropolis-Hastings proposals and random-effect chain mixing covers acceptance and mixing assessment; scaling here changes the coordinates in which proposals are designed, not the conditional target.

Worked Example: Mapping a Proposal Back to Random-Effect Units

Continue with the exact \(L\) above, and suppose a hypothetical symmetric random-walk proposal in \(z\) uses \(\epsilon\sim N(0,0.25I)\). Its standard deviation in each transformed coordinate is \(0.5\). The induced proposal covariance for \(\eta\) is \[ 0.25LL^\mathsf T=0.25\Omega = \begin{pmatrix} 0.010&0.003\\ 0.003&0.0205 \end{pmatrix}. \] This proposal therefore allows different marginal step sizes and correlated steps in the original coordinates, rather than imposing equal independent increments on the two random effects.

For a concrete proposed move, start at the transformed draw \(z=(0.50,0.3929)^\mathsf T\) and take the hypothetical increment \(\epsilon=(0.20,-0.10)^\mathsf T\). Then \(z'=(0.70,0.2929)^\mathsf T\), and mapping back gives \[ \eta'=Lz' = \begin{pmatrix} 0.20(0.70)\\ 0.06(0.70)+0.28(0.2929) \end{pmatrix} \approx \begin{pmatrix} 0.140\\ 0.124 \end{pmatrix}. \] The Metropolis-Hastings decision must still use the conditional target at the mapped points. The transformation specifies a proposal scale; it does not determine whether this particular move is accepted.

Scaling Population Parameters for Numerical M-Steps

Population parameters can also be rescaled to make numerical optimization better conditioned. For an unconstrained parameter vector, an affine transformation \(\theta=c+D\xi\), with fixed nonsingular \(D\), gives a one-to-one correspondence between \(\theta\) and the scaled coordinate \(\xi\). The numerical M-step can optimize over \(\xi\) and map its result back to \(\theta\). With a differentiable objective \(Q(\theta)\), the gradient and Hessian in the new coordinates are \(D^\mathsf T\nabla_\theta Q\) and \(D^\mathsf T H_\theta D\), respectively. Suitable scales can reduce disparities in curvature that otherwise make numerical steps inefficient.

A positive parameter can instead be represented on a log scale, for example \(\log(\theta_j)=c_j+s_j\xi_j\), where \(s_j>0\). This ensures \(\theta_j>0\) for every real \(\xi_j\), but it is a nonlinear transformation, so gradients and optimization behavior must be understood on that transformed scale. In either case, parameter values in the model must be obtained by the stated inverse mapping. The model’s predictions at the mapped parameter values are unchanged; optimization may be numerically different, but the statistical model has not been altered.

Worked Example: Rescaling Parameters With Different Units

Consider a hypothetical exponential-decay prediction \(C(t)=A\exp(-kt)\), where \(A\) is in mg/L and \(k\) is in h\(^{-1}\). Suppose the current values are \(A=12\) mg/L and \(k=0.08\) h\(^{-1}\). Define \(A=10+2a\) mg/L and \(k=0.05+0.02b\) h\(^{-1}\). The corresponding scaled values are \(a=(12-10)/2=1\) and \(b=(0.08-0.05)/0.02=1.5\).

At \(t=5\) h, the prediction in original coordinates is \[ C(5)=12\exp(-0.08(5))=12\exp(-0.4)\approx 8.044\text{ mg/L}. \] Using the scaled values and their inverse mapping gives \(A=10+2(1)=12\) mg/L and \(k=0.05+0.02(1.5)=0.08\) h\(^{-1}\), hence the same calculation and the same prediction, \(8.044\) mg/L. If the numerical M-step is poorly scaled because its parameter coordinates have different units and sensitivities, \(a\) and \(b\) provide interpretable, order-one coordinates near these values. This coordinate choice does not by itself guarantee that the optimizer will converge or that the estimated parameters are well identified.

Worked Example: Effect on Numerical Curvature

To isolate the effect of units, consider a hypothetical local objective \[ Q(A,k)=\tfrac12\left(\frac{A-12}{0.2}\right)^2+ \tfrac12\left(\frac{k-0.08}{0.002}\right)^2, \] where \(A\) is in mg/L and \(k\) is in h\(^{-1}\). Its Hessian in \((A,k)\) coordinates is diagonal with entries \(1/(0.2)^2=25\) and \(1/(0.002)^2=250{,}000\). The ratio of the largest to smallest eigenvalue is \(250{,}000/25=10{,}000\), indicating very different curvature scales.

Set \(a=(A-12)/0.2\) and \(b=(k-0.08)/0.002\). Then \(Q(a,b)=\tfrac12(a^2+b^2)\), whose Hessian is the identity matrix and whose curvature ratio is \(1\). This exact calculation illustrates why dimensionless coordinates can help a numerical optimizer. Actual SAEM M-step objectives need not be quadratic, and an improvement in this local example is not a guarantee of global convergence.

Choosing a Transformation and Checking It

A useful transformation should be chosen from the scales, units, constraints, and dependence structure of the parameters being simulated or optimized. A diagonal \(S\) can standardize marginal random-effect scales; a full fixed matrix can additionally address correlation. Centering population parameters near plausible working values can make scaled coordinates easier to interpret. Transformations should be checked numerically and statistically, not chosen solely because the transformed variables look convenient.

1
Specify the original model.
Write the random-effect distribution, parameter constraints, and prediction function before choosing coordinates.
2
Choose a fixed, invertible scale.
Use scientifically meaningful units or a stable reference scale. Verify that the transformed covariance is computed as \(S^{-1}\Omega S^{-\mathsf T}\).
3
Transform simulation and optimization consistently.
Evaluate the likelihood using the mapped random effects and population parameters, and use the correct transformed target in conditional simulation.
4
Check equivalence and numerical behavior.
Map selected values back to the original units, confirm predictions agree, and inspect whether proposals and numerical updates behave sensibly.

A practical comparison is between unscaled coordinates, fixed standardization, and a parameterization that directly enforces constraints, such as a log scale for positive parameters. Unscaled coordinates are simplest but may be inefficient when numerical scales differ greatly. Fixed standardization can improve proposal geometry while retaining a fixed latent coordinate system, but requires consistent covariance and density calculations. A log transformation respects positivity, but changes the geometry of the optimization problem and may not solve correlation or poor identifiability. None of these options repairs a misspecified model or creates information absent from the data.

Diagnostics, Pitfalls, and Limitations

Scaling is worth revisiting if proposals still move very little in some directions, numerical M-steps take erratic or extremely small steps, or transformed covariance calculations lose symmetry or positive definiteness beyond expected rounding error. Also compare the model’s predictions at selected original and mapped parameter values: disagreement is evidence of an inconsistent transformation or implementation, not a harmless side effect of scaling. In SAEM, keep the coordinate definition and the interpretation of any accumulated statistics consistent; a statistic accumulated in one coordinate system cannot automatically be interpreted as though it had been accumulated in another.

  • Changing the proposal but not its target. Scaling a proposal does not change the conditional distribution being sampled. The Metropolis-Hastings ratio must still use the correctly transformed target and proposal densities.
  • Treating rounded whitening as exact. Rounded factors may not satisfy \(LL^\mathsf T=\Omega\). Check the factorization at working precision, or state and assess the approximation.
  • Ignoring constraints. An affine transformation does not automatically enforce positivity. Use a suitable constrained or log parameterization and verify the mapped values remain valid.
  • Assuming scaling guarantees mixing or convergence. Whitening the prior does not remove likelihood-induced posterior correlations, weak identification, or multimodality.

The central limitation is that scaling improves numerical representation, not the underlying statistical information. A poor reference scale can be ineffective, and an overly complicated transformation can introduce implementation errors. Preserve the exact model mapping, verify the transformed distribution, and judge a transformation by both its computational behavior and its equivalence to the original model.

Key takeaway: A fixed invertible scaling can improve SAEM proposals and numerical M-steps without changing implied predictions, provided random effects, covariances, densities, and parameter constraints are all transformed consistently.

Check Your Understanding

Work through these questions, then compare your reasoning with the solutions.

  1. If \(z_i=S^{-1}\eta_i\) and \(\eta_i\sim N(0,\Omega)\), what is the covariance of \(z_i\)?
  2. A fixed transformation uses \(S=L\), where \(LL^\mathsf T=\Omega\). What is the distribution of \(z_i\), and what condition makes the result exact?
  3. Why can an isotropic proposal in scaled random-effect coordinates produce correlated steps in the original coordinates?
  4. In the decay example, what scaled value \(b\) corresponds to \(k=0.07\) h\(^{-1}\) under \(k=0.05+0.02b\) h\(^{-1}\)?
  5. Does whitening the prior guarantee that the conditional random-effect chain mixes well? Explain.

Solutions. (1) Its covariance is \(S^{-1}\Omega S^{-\mathsf T}\). (2) It is \(N(0,I)\) when \(LL^\mathsf T=\Omega\) exactly; a rounded factor that fails this equality gives only approximate whitening. (3) The original-coordinate increment is \(S\epsilon\), so its covariance is \(S(h^2I)S^\mathsf T=h^2SS^\mathsf T\), which need not be diagonal. (4) \(b=(0.07-0.05)/0.02=1\). (5) No. The conditional likelihood can create dependence and curvature not represented by the prior covariance, so conditional mixing still needs to be assessed.