5.1 Control-stream records and parser support
A control stream is both a model and a set of instructions to a particular program. nlmx reads the parts needed to construct its own model, dataset and estimation problem. It does not attempt to execute arbitrary NONMEM code or reproduce every control record.
Figure 5.1. The parser first separates records, then either interprets, retains with a warning, or refuses them. “Recognised” is not a promise that every option on a record has an implemented effect.
5.1.1 Records and abbreviations
Record names are case-insensitive. Most record names accept an unambiguous prefix of at least three characters; records such as $PK retain their conventional short spelling. Semicolon comments are removed before a record is interpreted. A file containing more than one $PROBLEM is truncated at the second problem with a warning, because nlmx represents one problem at a time.
Table 5.1 is a support map for 4.3.0. It intentionally says core use rather than merely parsed: options within a record can have narrower support than the record as a whole.
Table 5.1. Control-stream record disposition in nlmx 4.3.0
| Disposition | Records | What the disposition means |
|---|---|---|
| Core model/data use | $PROBLEM, $INPUT, $DATA, $SUBROUTINES, $MODEL, $PK, $ERROR, $THETA, $OMEGA, $SIGMA, $ESTIMATION, $TABLE |
nlmx reads information from the record. Consult the command chapter for supported options and model grammar. |
| Accepted for a specialised path or recorded with limitations | $DESIGN, $NONPARAMETRIC, $INFN, $SIMULATION, $MSFI |
The general control-stream reader does not make every option operative. Dedicated commands can parse additional content; for example, simulation commands inspect $SIMULATION. Read the command's own output and warnings. |
| Refused | $MIX, $PRIOR, $LEVEL, $AES, $AESINITIAL, $THETAP, $THETAPV, $OMEGAP, $OMEGAPD, $SIGMAP, $SIGMAPD, $INCLUDE, $BIND |
Parsing stops. Rewrite the model explicitly or use a supported equivalent; do not silently drop the record. |
Other familiar record names can be recognised without full semantic support. The safe test is not “did the parser know the name?” but “does the relevant command document and exercise this option?” Warnings belong in the analysis record, even when the command exits successfully.
5.1.2 Data and model records
$INPUT supplies column labels and aliases. $DATA supplies the data path and data-level filtering instructions understood by nlmx. A relative data path is resolved relative to the control stream, not necessarily the shell's current directory. A command-line data override is useful when moving a fitted model family, but it should be recorded because it changes provenance.
$SUBROUTINES, $MODEL, $PK and $ERROR are used to construct the executable model. Their accepted grammar is a defined subset; arbitrary user Fortran and external routines are outside that subset. A control stream that depends on unsupported code must not be described as compatible merely because its parameter records parse.
$TABLE deserves special care. nlmx can use table information in relevant paths, and simulation has its own requested-column handling, but a normal fit writes nlmx diagnostic tables and does not promise to execute and reproduce every vendor $TABLE FILE=... directive. Archive the source control stream if exact downstream filenames are part of a workflow contract.
5.1.3 THETA forms
nlmx accepts the common forms:
$THETA 2.5
$THETA (0, 2.5)
$THETA (0, 2.5, 20)
$THETA 2.5 FIX
A single number is an unbounded initial value. Two numbers are lower bound and initial value. Three are lower bound, initial value and upper bound. FIX and FIXED mark a value as fixed. Scientific notation in a control stream may use D; nlmx normalises it while parsing.
Bounds affect fitting, but a rewritten control stream is a formatted representation rather than a byte-for-byte copy. In particular, very large finite bounds can be emitted as effectively unbounded. If a bound carries scientific meaning rather than serving as a numerical guard, compare the source and rewritten parameter blocks explicitly.
5.1.4 OMEGA and SIGMA
By default, values outside a BLOCK specification are independent diagonal elements. Line layout alone does not create covariance. A lower-triangular block is explicit:
$OMEGA BLOCK(2)
0.09
0.018 0.04
The equivalent standard-deviation/correlation form is:
$OMEGA BLOCK(2) SD CORRELATION
0.3
0.3 0.2
The off-diagonal entry in the second block is a correlation: 0.3 × 0.3 × 0.2 = 0.018. nlmx converts supported SD CORRELATION and Cholesky forms to its natural covariance representation internally. BLOCK(2) FIX fixes the whole block; it is not a per-element qualifier.
Repeated blocks can use SAME, but make the dimension explicit and place it on a separate $OMEGA record:
$OMEGA BLOCK(2)
0.09
0.018 0.04
$OMEGA BLOCK(2) SAME
That form is used in the Chapter 5 fixture. nlmx 4.3.0 has edge cases around omitted SAME dimensions, SAME(n), structural zero off-diagonal elements and analogous SIGMA tying. Avoid relying on those shortcuts. Inspect the written control stream and numerical parameter labels whenever a block is fixed, repeated or sparse.
5.1.5 Estimation records and the selected method
When several $ESTIMATION records occur, the general model representation retains the last one as the final estimation instruction. The common mapping is:
| Control-stream intent | nlmx interpretation in the classical fitting path |
|---|---|
METHOD=0 |
FO |
METHOD=1 without INTERACTION |
FOCE |
METHOD=1 INTERACTION |
FOCEI |
LAPLACE or a likelihood requiring it |
Laplace |
SAEM has a dedicated fitting path. Importance-sampling and Bayesian keywords do not by themselves turn the classical fit path into a reproduction of the corresponding NONMEM method. The command can fall back to a supported likelihood method with a warning. Treat that warning as a method change.
The last $ESTIMATION instruction and the selected .ext table must describe the same stage if estimates are imported from a multi-step run. nlmx selects the last parsed .ext table; it does not infer that an earlier table was the desired method from its label.
5.1.6 Assumptions and limits
The parser assumes a single problem and the supported nlmx model language. It is designed to fail on several high-risk records rather than silently discard them. Its acceptance of a record does not certify all options on the record, compiled user code, or vendor-specific behavior.
For software-comparison work, keep the original input, the exact executable versions, the warnings and the rewritten control stream. Compare the derived parameter order and covariance blocks before comparing objective functions.
Common mistakes
- Reading a successful parse as full NONMEM compatibility.
- Assuming two OMEGA values on one line form a block without
BLOCK(n). - Using
SAMEshorthand without an explicit dimension. - Assuming an imported multi-step
.exttable is matched automatically to the desired$ESTIMATIONrecord. - Expecting every
$TABLE FILE=directive to be reproduced byfit.
Checklist
- The file contains one
$PROBLEM. - No refused record is present.
- Every covariance block has an explicit dimension and parameterisation.
- Fixed and structural-zero elements were checked after import.
- The effective estimation method appears in the log.
- Warnings are retained with the analysis.
Further reading
Continue with Section 5.2 for numerical result files and Section 5.5 for the executable BLOCK example. The official NONMEM product page identifies the vendor distribution and documentation source; use documentation for the exact licensed NONMEM version in any formal comparison.