Re: Storing simulations
From:Nick Holford
Subject:Re: [NMusers] Storing simulations
Date:Fri, 12 Jul 2002 08:14:54 +1200
I am not sure what you are trying to do but let me guess. If you want to simulate a data set using NONMEM
then estimate the parameters of that data set using NONMEM you have 2 choices:
1. One Stage
Stage 1: Add the $SIMULATION (1234567) SUBPROBLEMS=100 to an existing control stream.
This will use the dataset as a template, simulate a new DV which replaces the original DV value in a
temporary (hidden from the user) dataset, then estimate the parameters using the simulated data. With 100
subproblems this will be repeateed 100 times. The parameter estimates will appear in the usual NONMEM output
listing but instead of one problem you will find the results of 100 problems listed one after another.
Sounds too easy? 'Fraid so. NONMEM has a bug/feature that means that if one of the subproblems encounters
certain errors (which arise commonly when dealing with simulated data and using the same initial estimates
for all runs) it will not go onto the next problem but just stops. This unreliability makes it worthless for
serious work.
2. Two Stage
Stage 1: Add the $SIMULATION (1234567) ONLSIMULATION to an existing control stream.
This will simulate a new data set as in the one stage method but you can then save the simulated results (and
ID and other covariates) in a TABLE file in the usual way. The generated "population data" will be saved in
the TABLE file.
Stage 2: Change the dataset in your control stream to the name of the table file generated in Stage 1.
(Remove any $SIMULATION record!).
This will then run NONMEM in the usual way. the But if you are doing Monte Carlo simulation and need to do
this 100 times or more then you need to find a way to automate Stages 1 and 2.
With both methods you will need to find an automated way of extracting things such as objective function
values and parameter estimates in order to perform a meta-analysis. Wings for NONMEM (
http://wfn.sourceforge.net) will handle this for you if you use the One Stage method. I have also made
programs for doing the Two Stage method but they are a bit more clumsy and not currently supported directly
in the distributed version of WFN. The basic idea is to run Stage 1 with ONLYSIMULATION and SUBPROBLEMS=100.
Then extract, one at time, the 100 simulated data sets saved in the TABLE file output and run each of these
extracted data sets with a standard NONMEM control stream.
--
Nick Holford, Divn Pharmacology & Clinical Pharmacology
University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand
email:n.holford@auckland.ac.nz tel:+64(9)373-7599x6730 fax:373-7556
http://www.health.auckland.ac.nz/pharmacology/staff/nholford/