3.2 Check: qc-data and qc-nm
Modelling starts with a question that is easy to skip: is what I am about to model what I think it is? Two commands
answer it. qc-data asks 99 questions of the dataset, and qc-nm asks 81 of the control stream. Both answer each
question with a status, give the line and the value for every finding, and write a checklist that you can file.
3.2.1 qc-data: the dataset
nlmx qc-data data/analysis.csv -o out_qcd
0.00s stage reading the dataset
0.00s ok 2200 records, 13 columns, 2201 lines
0.00s stage checking
0.01s ok READY WITH WARNINGS — review the warnings before analysis — 99 checks: 75 PASS, 8 COMMENT, 4 WARN, 0 FAIL, 12 N/A
0.01s stage writing outputs
0.77s ok 30 output file(s) written
nlmx qc-data — dataset quality control
====================================
Dataset data/analysis.csv
File 118,626 bytes, 2,201 lines, delimiter comma
Content 2,200 records, 13 columns; 200 individuals; 200 dose records; 2,000 observations (2,000 used)
Verdict READY WITH WARNINGS — review the warnings before analysis
Checks 99 checks: 75 PASS, 8 COMMENT, 4 WARN, 0 FAIL, 12 N/A
The verdict is one of three: ready, ready with warnings, or not ready (at least one FAIL). The counts add up to 99. The statuses mean:
| Status | Meaning | What you do |
|---|---|---|
| PASS | nothing found | nothing |
| COMMENT | information to read, not a problem | read it |
| WARN | review before analysis | look at the listed lines; decide |
| FAIL | fix before analysis | fix the data, or the check's settings, and re-run |
| N/A | the check does not apply to this dataset, or is turned off | read the reason; it may point to a column you forgot to name |
The listing on the console shows every check under its group; the excerpt below leaves out the PASS lines. The four WARN checks of the demo dataset are real features of the data:
WARN OBS02 Is DV free of negative values?
→ 1 negative observation(s) (1 individual). For example: line 878 ID 80: DV = -0.0162 is negative
To do: A negative concentration is impossible; for data that can be negative (PD, change from
baseline) set [observations] negative_ok = true.
WARN OBS06 Are there concentrations far from those of other individuals at similar times after the dose?
→ 2 outlying concentration(s) (2 individuals). For example: line 876 ID 80: DV = 0.2919 is 4.335x
below the typical value at about 8 h after the dose (8–8); line 779 ID 71: DV = 0.0205 is 17.73x
below the typical value at about 23.9 h after the dose (23.9–23.9)
WARN COV06 Are the continuous covariates free of extreme values (beyond the Tukey fences)?
→ 2 extreme covariate value(s) (1 individual). For example: line 277 ID 26: EGFR = 263 is outside
-52.75 to 249.5 (3 × IQR beyond the quartiles); line 277 ID 26: CRCL = 273.3 is outside …
WARN COV08 Are the continuous covariates free of strong pairwise correlation (|r| below the limit)?
→ 1 strongly associated covariate pair(s) (1 individual). For example: line 2 ID 1: EGFR and CRCL:
r = 0.98 (200 individuals)
To do: Strongly correlated covariates cannot be told apart in a covariate model; choose one or a
composite.
How to read them, in the order you would act.
- OBS02, the negative concentration. One record of subject 80 (line 878 of the file, not of the table) has a concentration of −0.0162. In a real dataset this would be an assay artefact or a data-entry error; you would trace it to the source. For the model it matters because a log-transformed analysis cannot use it: the log plot of Figure 3.1.1 says "1 non-positive value left out".
- OBS06, concentrations far from their peers. Two values are 4 to 18 times below the typical concentration at the same time after the dose. They are outliers relative to the others at that time, and they may be nothing more than the tail of the residual error, so you document them rather than delete them (the message says: "remove or exclude only with a documented reason").
- COV06, an extreme covariate. Subject 26 has an eGFR of 263 and a creatinine clearance of 273, far above the fences of three interquartile ranges. A single extreme value can drive a covariate effect, so you remember it when you read Section 3.5.
- COV08, two covariates that are nearly the same.
EGFRandCRCLcorrelate at 0.98. This is the warning that anticipates a result of the covariate analysis: the data cannot tell which of the two is the cause.
None of this stops the analysis. That is the point of the third verdict: ready with warnings means a modeller has something to write in the analysis plan.

The report. Open out_qcd/report.html in a browser. It is one self-contained file (no scripts, no external
resources) that follows the light or dark setting of your system. The top of the page repeats the command, shows the
verdict and the counts, and lists the checklist in ten groups (file and format, header, values, records, time, dosing,
observations, individuals, covariates and NONMEM readiness). Each group opens to its checks, and each check to the lines
and values found. The figures are in plots/ as PNG files, 15 of them here, including the findings per check, the
concentration-time profiles, the sampling times and the covariate distributions.
The files. qc_checklist.csv has one row per check (ID, CATEGORY, QUESTION, STATUS, ISSUES, INDIVIDUALS, CHECKED, COMMENT, ACTION); qc_findings.csv has one row per finding with the line and the value (CHECK, CATEGORY, LEVEL, LINE, ID, COLUMN, VALUE, MESSAGE), and is the file to hand to a data manager. qc_nonmem.txt is a suggested $INPUT and
$DATA for the dataset:
$INPUT ID TIME AMT ADDL II EVID MDV DV CMT WT SEX EGFR CRCL
$DATA analysis.csv IGNORE=@
3.2.2 qc-nm: the control stream
nlmx qc-nm models/run101.ctl -o out_qcn
0.00s stage reading the control stream
0.01s ok 62 lines, 14 records, 1 problem(s); READY
0.01s stage correcting
0.03s ok nothing to correct
0.03s stage writing outputs
0.04s ok 9 output file(s) written
nlmx qc-nm — control stream quality control
Control stream: models/run101.ctl
Verdict: READY (81 checks: 73 pass, 3 comment, 0 warn, 0 fail, 5 not applicable)
The control stream is ready, with nothing to correct. The checks are grouped as the control stream is: file and format,
records, $INPUT, $DATA and the dataset, subroutines and PK parameters, the abbreviated code, parameters, estimation
and covariance, tables, and documentation. Two features distinguish qc-nm from a syntax check.
- It reads the dataset too. The check
INP07asks whether the$INPUTlabels match the dataset header, andDAT07reports how many records and individuals NONMEM will read afterIGNORE: here2200 records read of 2200 data lines, 200 individuals. - It corrects. For faults it can repair safely (24 kinds), it writes a corrected copy,
<stem>_qc.ctl, re-checks it, and lists every change as CSV and as a diff. The original is never changed. Here there was nothing to correct, so no copy was written.
The three COMMENT lines are information: one problem record (FIL07), the record counts (DAT07), and a note that
the two OMEGA values are not labelled by a comment (DOC02), a style point rather than an error.
COMMENT DOC02 Are the THETA, OMEGA and SIGMA values labelled with comments?
→ 2 unlabelled value(s). line 48: ETA(1) has no label; line 48: ETA(2) has no label
3.2.3 What to fix first
When a check does not pass, the order of work is:
- FAIL in either command: fix it. A FAIL is a fault that NONMEM or the analysis would trip over.
- WARN in
qc-data: read each finding; fix the source, or write down why the value stays. - WARN in
qc-nm: read the finding; if it can be corrected automatically, compare the corrected copy with the original and adopt it. - COMMENT and N/A: read once; an N/A that says "no BLQ flag column" is a prompt to tell the program about a column
it could not find (Chapter 11 lists the options, such as
--blq-flagand--tad-col).
Two options matter for scripts. --fail-on sets the status that makes the command exit with an error (exit code 7 for
qc-data, 6 for qc-nm), so a pipeline can stop on a failing dataset; --list-checks prints all 99 questions
without running anything (nlmx qc-data --list-checks). And a note on options: --covariates WT,SEX takes a plain list in
these two commands, not the PARAMETER=COV form of cov; in versions before 4.2.1 this stopped with an error.
Chapters 11 and 12 describe every check.