Re: [NMusers] Cross-validation script in NM

From: Kajsa Harling <>
Date: Fri, 5 Dec 2014 09:41:49 +0100
Dear Pieter,

If your end goal is to perform k-fold cross-validation, you can use PsN's crossval program. It is run with commands like

crossval mymodel.mod -groups=5

where mymodel.mod is any regular estimation-type control stream. This will perform 'groups'-fold cross-validation. The prediction models are copies of the estimation models, except that $DATA is changed, initial estimates are automatically set to final estimates from the estimations, and MAXEVAL is set to 0 (or corresponding for non-classical estimation methods). $PK will be identical, so there should be no problem with time-varying covariates. Just make sure to delete the run folder after you have retrieved the results, because it will be very large.

Best regards,

On 12/04/2014 06:03 PM, Pieter Colin wrote:

Dear nm-users,


I’m trying to construct a NONMEM control file to be used in a cross-validation study.

In a first problem statement I run an estimation step on a subset of my data.

In a subsequent problem statement (within the same control file) I am trying to predict the PK of the subset that was not included in part 1.


I managed to do this by use of the MSFO option (in the first part of the control file) and the $MSFI in de second part.

However, it appears that time-varying covariates (defined under $PK in the first problem statement) are not evaluated when performing the predictions for the second problem statement.


Does anyone know of a workaround for this or is there another way of combining a fit and predict action (both on different data) within the same control-file?


Kind regards,





Pieter Colin, Pharm.D., Ph.D.


Post-Doctoral researcher

(Faculty of Pharmaceutical Sciences – Ghent University)

Associate Professor

(Department of Anesthesiology – UMCG)

Kajsa Harling, PhD
System Developer
Department of Pharmaceutical Biosciences
Uppsala University
+46-(0)18-471 4308
Received on Fri Dec 05 2014 - 03:41:49 EST

This archive was generated by hypermail 2.3.0 : Fri Sep 27 2019 - 16:42:23 EDT