Documentation

14.10 Best-fit window selection and adjusted R²

The default best-fit method tries nested terminal windows containing the last 3, 4, 5, and more eligible points after Tmax, bounded by configured minimum/maximum point counts.

Best-fit terminal selection

For each window it fits ln C on time. Only a negative slope (positive λz) with finite adjusted R² is eligible. Adjusted R² is

1 − (1−R²)(n−1)/(n−2)

which penalizes adding points compared with ordinary R². The candidate with largest adjusted R² wins; candidates within tolerance 1e-4 of the best are tied, and the one with more points is chosen. The automatic winner must meet minimum adjusted R² (0.7 by default).

Why nested windows

Starting from the tail and progressively adding earlier points searches for the longest well-described terminal region without arbitrary combinations. It cannot guarantee that the window is biologically terminal. A distribution point can sometimes improve adjusted R² by chance.

Every candidate should be retained in an audit table. Review n, start/end, λz, R²/adjusted R², span, and chosen status—not only the final half-life.

A reproducible tie decision

When candidates differ in adjusted R² by no more than the configured tolerance, nlmx treats them as effectively tied and prefers the window with more observations. This prevents insignificant floating-point variation from choosing a shorter line. A validator should create an explicit near-tie fixture because ordinary examples may never exercise the rule.

Eligibility also changes enumeration. Removing a BLQ, zero, excluded observation, or Tmax point changes the entire nested sequence. Compare actual point times and identifiers before comparing candidate numbers across programs.

Common mistakes

  • Choosing ordinary R² when the method specifies adjusted R².
  • Ignoring the tie tolerance and point-count rule.
  • Comparing non-nested arbitrary windows to the automatic algorithm.
  • Assuming the mathematically best line is biologically terminal.

Checklist

  • Enumerate all candidate windows.
  • Verify negative slope and minimum fit threshold.
  • Reproduce adjusted R² and tie handling.
  • Inspect the chosen line on the profile.
  • Preserve all candidates and the reason.

Further reading

See manual selections, diagnostic flags, and the csvworked candidate table.