20.4 Control-stream anatomy
A fit control stream links data, model code, parameters and run instructions. $INPUT/$DATA define record interpretation. $SUBROUTINES plus $PK/$DES/$ERROR, or $PRED, define predictions/likelihood. $THETA/$OMEGA/$SIGMA define starting values and free structure. $ESTIMATION/$COVARIANCE request numerical methods.
$TABLE records are accepted so NONMEM-compatible streams parse, but nlmx writes its own standardized predictions.csv and parameter/matrix files. Comments on single THETA/OMEGA lines become useful labels.
Before fitting, use QC/validate to identify unsupported records, unused ETAs, data mapping, parameter bounds and fixed values. Ensure $PK assignments persist/branch as intended across records. $ERROR must provide positive variance or valid likelihood contribution.
The final generated control stream rewrites parameter records with fitted values while retaining bounds, FIX, BLOCK, SAME and comments. It is a continuation artifact, not a replacement for source/version history.
Read records as a connected program
The records are not independent form fields. $INPUT determines how data names enter the model; $SUBROUTINES and $MODEL determine state interpretation; $PK, $DES, $ERROR or $PRED define calculations; THETA/OMEGA/SIGMA determine parameter dimensions; and $ESTIMATION determines how the objective is approximated. A valid-looking edit in one record can invalidate assumptions elsewhere.
Trace one representative subject manually: dose record, state update, parameter calculation, prediction, residual likelihood and table output. Then trace special cases such as predose, infusion end, reset, missing DV and additional doses. This exercise often finds compartment or MDV errors before optimization obscures them.
Keep comments that express units, transformations and rationale. Labels improve output readability but should not be the only record of parameter meaning. For review, create a parameter dictionary mapping each THETA, ETA and EPS to its scale, units, covariate dependence, initial value, bounds and fixed status.
Common mistakes
Do not review parameter blocks separately from model code, assume $TABLE controls nlmx output, or rely on comments as executable semantics. A control stream that parses can still encode wrong compartments or units.
Checklist
- Map every record to data/model/parameter/run role.
- Verify parameter use and labels.
- Validate error/likelihood positivity.
- Confirm supported syntax/features.
- Preserve original and generated controls separately.
Further reading
See supported analytic models, ODEs, and parameters.