NONMEM Users Network Archive

Hosted by Cognigen

RE: question about random seed for simulation

From: Åstrand, Magnus <Magnus.Astrand>
Date: Thu, 9 Mar 2017 20:04:25 +0000

Hi Penny,
I suspect you are right in your conclusion that number of records for each =
id matters in this case.
My solution to your problem would be to add columns for IIV to your dataset=
 outside of NONMEM.
Quite easily done in R.

Use the rmvnorm R function to simulate your etas, 600 rows times as many et=
as you have

sigma<-diag(c(1,2,3)) ## example 3 etas , without block, variances 1,2 and =

Then load your NONMEM datafile as is now with dosing and observational reco=


Match each of the rows in Etas to ID in your data


and then append the simulated etas


and then finaly save the d1 R data.frame as a text file using write.table.

In your nonmem code you the just replace eta(1) with ETAR1, and so on.


Magnus strand
Principal Clinical Pharmacometrician, Ph.D.

Innovative Medicines | Quantitative Clinical Pharmacology
SE-431 83 Mlndal, Sweden
T: +46 (0)31 776 23 41
Mob: +46 (0)708 467 667

Please consider the environment before printing this e-mail

From: owner-nmusers
 Behalf Of Zhu, Penny
Sent: den 9 mars 2017 19:19
To: nmusers
Subject: [NMusers] question about random seed for simulation

Dear All
I have finished a multiple dose simulation for 600 subjects and want to per=
form a single dose simulation (different sampling time) on the same subject=
s (same ETA as the first simulation). I used the same seed for the simulat=
ion step, it turned out the first subject was the same and the rest of the =
subjects are not and I am not sure whether this was due to the fact that th=
e two simulation has different number TIME records. If so, I wonder what i=
s the proper way to set the simulation seed so that the ETAs for the second=
 simulation will be identical to the first one.

I know that I could output the individual parameter estimate from the first=
 simulation and import them into the second one. But I was thinking if the=
 random seed can be synchronized between the two simulation, it could be an=
 easier solution.

Your help is very much appreciated!

Thank you very much and best regards!

Penny (Peijuan) Zhu, Ph.D.
Associate Director Clinical Pharmacology

Cell: 862-926-9079

PD Bio-Pharma CDMA
1N025, 100 College Road West
Princeton, NJ 08540


Confidentiality Notice: This message is private and may contain confidentia=
l and proprietary information. If you have received this message in error, =
please notify us and remove it from your system and note that you must not =
copy, distribute or take any action in reliance on it. Any unauthorized use=
 or disclosure of the contents of this message is not permitted and may be =

Received on Thu Mar 09 2017 - 15:04:25 EST

The NONMEM Users Network is maintained by ICON plc. Requests to subscribe to the network should be sent to:

Once subscribed, you may contribute to the discussion by emailing: