Getting your NONMEM dataset to work – DATA ERROR summary

Getting your dataset in the right format to work with NONMEM can be a terrible job. Getting all your observations, doses, dosing times, etc. from different Excel sheets collected in the clinic can take a lot of time. However, the worst thing is when you think you are finished creating your dataset and immediately get an error when you start your NONMEM run. Especially when you encounter an error message that is difficult to interpret. This post will not show how to build your NM dataset, there are already multiple examples on that, but will show you what kind of errors you may encounter and how to fix them.

An example of a working dataset. With a dose being administered in compartment 1 and observations in compartment 2.

 

Where to find the data errors?

First of all, the error messages can be found in the generated .lst file. If you use PsN, these can be found in the modelfit_dir1/NM_run1 folder, even if your run was unsuccessful, or in the main model folder.

The examples provided below are the error messages copied from these .lst files. Every example also contains a dataset that can be used to reproduce the error.

 

Error messages

 

1. Non-numeric cells/columns in the dataset

All your cells in your NM dataset should be numbers. NONMEM can’t handle characters and will therefore throw an error when you try this. It can happen that your covariate is a character and you forgot to change it:

(DATA ERROR) RECORD 1, DATA ITEM 8, CONTENTS: MALE
ITEM IS NOT A NUMBER.

Our covariate column here contains the value “MALE”, which is not allowed.

FIX

Change your covariates to numeric, e.g. male/female can be changed to 0 and 1.

Dataset

Dataset.COV.Character.csv

 

2. NA’s in the DV column

If you have missing observations, and you work in R, your observations will probably be converted to NA. This will give the same error as above since NA is read as a character in NONMEM.

(DATA ERROR) RECORD 21, DATA ITEM 5, CONTENTS: NA
ITEM IS NOT A NUMBER.

FIX

When saving your dataset in R, make sure you specify the na=”.”, which will convert all the NA to dots. The dots can be used in NONMEM. Furthermore, make sure that your MDV column equals 1 when an observation is missing.

I personally use the following settings to create my NONMEM dataset:

write.table(df , file="NONMEMDATASET.csv",append =F, sep=",", na=".",row.names = FALSE,col.names = TRUE, quote = FALSE)

Dataset

Dataset.NADV.csv

 

3. Time not sorted

The following error message will show up when the time column is not sorted. NONMEM needs incremental times per individual, meaning that NONMEM cannot go back in time.

0DATA REC 3: TIME DATA ITEM IS LESS THAN PREVIOUS TIME DATA ITEM

This may also happen when you have multiple occasions in your dataset, where both occasions start at time 0. This is not allowed. If you have data from 2 occasions, you can add a fixed time to the second occasion. For example, start occasion 2 at time point 168 hours. Then, the time column is still incremental within an individual and you can stratify between occasion 1 (time < 168) and occasion 2 (time > 168).

FIX

Sort your dataframe correctly, first on ID, then on time. This should fix the problem.

df <- df [order(df$ID,df$TIME),]

Dataset

Dataset.TimeNotSorted.csv

 

4. EVID is always 0

An EVID column specifies what kind of row we are dealing with, an observation? dosing? or something else? The numbers have specific meanings, of which EVID = 0 is for observations and EVID = 1 for dosing records. An explanation of the other EVID’s can be found in the NM manual.

When you get the following error:

0DATA REC 1: OBSERVATION EVENT RECORD MAY NOT SPECIFY DOSING INFORMATION

This means that you specified with EVID that the record should be treated as an observation, however, there is dosing information included. In this case the AMT was larger then 0 whereas EVID = 0).

FIX

Make sure that all observations have EVID = 0 and all dosing records have EVID = 1.

Dataset

Dataset.EVID0.csv

 

5. Use wrong IGNORE statement

The IGNORE statement in the $INPUT block of your NONMEM model should be used to specify which rows to ignore from your original dataset.

In my model code I specified the following:

$INPUT ID TIME AMT EVID DV CMT MDV

$DATA Dataset.IGNORE.csv IGNORE=I

Which resulted in the following error:

(DATA ERROR) RECORD 1, DATA ITEM 1, CONTENTS: SubjectNr
ITEM IS NOT A NUMBER.

This is because the column name of my ID column is actually SubjectNr in the dataset. Therefore, ignoring all rows starting with I would not ignore the first row containing the column headers.

FIX

IGNORE=@ can be used to ignore all rows starting with a character. In this case, IGNORE=S would also have removed the first row, since the row started with the word SubjectNr.

Dataset

Dataset.IGNORE.csv

 

6. Switch $INPUT labels

Sometimes, the error may be completely different whereas the dataset seems to be correct. For example a combination of multiple error messages can occur:

0DATA REC 1: DOSE AMOUNT IS ZERO
0DATA REC 2: TIME DATA ITEM IS LESS THAN PREVIOUS TIME DATA ITEM
0DATA REC 2: OBSERVATION EVENT RECORD MAY NOT SPECIFY DOSING INFORMATION

This error was also previously encountered by others: https://www.pharmpk.com/PK11/PK2011112.html

FIX

Make sure your $INPUT is correct in your NONMEM model. If the order of your columns in the original dataset change, this will impact the way NONMEM reads your data. For example, your TIME column will suddenly be read as your DV column.

 

Remarks

Another check to perform is that the units of the AMT column and your concentrations (DV) are the same. For example make sure that the dose is in mg and the concentration is in mg/L. This would result in your volume of distribution being estimated in liters. Else, this would result in strange estimates that can be hard to explain at a later stage (and would need you to repeat model development…).

 

COMMENT

Any suggestions on other encountered errors or typo’s? Leave a comment or contact me at info@pmxsolutions.com!

4 thoughts on “Getting your NONMEM dataset to work – DATA ERROR summary

    • MJvanEsdonk Post authorReply

      To the best of my knowledge, there are 2 ways of handling a DV of 0.
      1: A DV=0 can indicate that there was no measurement performed and therefore the MDV column should be set to 1. This will ignore the observed DV in the estimation.
      2: A DV=0 can be the result of an observation below the lower limit of quantification. There are multiple ways to handle this, all with their own (dis)advantages. I can recommend to look at Chapter 2 of the “MI212: Advanced Topics in Population PK-PD Modeling & Simulation” which will discuss in detail different methodologies (https://www.metrumrg.com/course/mi212-advanced-topics-population-pk-pd-modeling-simulation/).

  1. Graziela Lock Reply

    I have a doubt: In my analysis I have 24 observations. If I lost the observations since the observation 12, I have to put this points 13 to 24 in my dataset and describe that these are missing variables?

Leave a Reply

Your email address will not be published. Required fields are marked *